Tag: Managed Identity

Secure model endpoints, including Managed Identity (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Implement data security and compliance
      --> Secure model endpoints, including Managed Identity


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

As organizations increasingly integrate Artificial Intelligence (AI) into database applications, protecting AI model endpoints has become a critical security requirement. AI-enabled SQL applications frequently invoke external AI services such as Azure OpenAI, Azure AI Foundry models, Azure AI Search, Azure Machine Learning endpoints, and custom REST APIs. These services often process sensitive business data, making endpoint security an important aspect of application architecture.

The DP-800 certification expects candidates to understand how to securely authenticate applications to AI services without exposing secrets. Microsoft recommends using Microsoft Entra ID (formerly Azure Active Directory) and Managed Identities whenever possible instead of storing passwords or API keys.

A major focus of the exam is understanding how SQL applications securely communicate with external AI services while following the Zero Trust security model.


Why AI Model Endpoints Must Be Secured

An AI model endpoint is the network endpoint that applications call to perform AI operations such as:

  • Text generation
  • Embedding generation
  • Semantic search
  • Retrieval-Augmented Generation (RAG)
  • Classification
  • Summarization
  • Vector similarity searches

Because endpoint requests frequently contain:

  • Customer information
  • Financial records
  • Healthcare data
  • Intellectual property
  • Confidential business documents

Unauthorized access can lead to:

  • Data leakage
  • Unauthorized AI usage
  • Excessive Azure costs
  • Compliance violations
  • Prompt injection attacks
  • Credential theft

Therefore, authentication and authorization are essential.


Authentication Options for AI Endpoints

Microsoft AI services generally support multiple authentication mechanisms.

Authentication MethodRecommendedNotes
API KeysGoodSimple but secrets must be managed
Microsoft Entra IDExcellentPreferred for enterprise environments
Managed IdentityBestEliminates secret management
Service PrincipalsVery GoodUsed for applications outside Azure
OAuth TokensGoodShort-lived secure tokens

For DP-800, Managed Identity is the preferred authentication method whenever available.


Understanding Managed Identity

A Managed Identity is an automatically managed identity in Microsoft Entra ID that Azure creates for an Azure resource.

Instead of storing:

  • passwords
  • connection strings
  • API keys
  • client secrets

the Azure platform authenticates on behalf of the application.

Examples of Azure resources supporting Managed Identity include:

  • Azure SQL Database
  • Azure SQL Managed Instance
  • Azure App Service
  • Azure Functions
  • Azure Container Apps
  • Azure Kubernetes Service
  • Azure Virtual Machines
  • Azure Data Factory
  • Azure Logic Apps
  • Azure Machine Learning

Types of Managed Identity

There are two types.

System-Assigned Managed Identity

Characteristics:

  • Created automatically
  • One identity per Azure resource
  • Deleted automatically with the resource
  • Cannot be shared

Example:

Azure Function → One Managed Identity

If the Function App is deleted:

Identity is deleted automatically.


User-Assigned Managed Identity

Characteristics:

  • Independent Azure resource
  • Can be assigned to multiple services
  • Exists after applications are deleted
  • Easier to reuse across environments

Example:

One User-Assigned Identity may be used by:

  • Azure Function
  • Azure App Service
  • Azure SQL Managed Instance
  • Azure Container App

This simplifies permission management.


Benefits of Managed Identity

Managed Identity provides several important advantages.

No Secret Management

Developers no longer store:

  • passwords
  • API keys
  • client secrets
  • certificates

This significantly reduces security risks.


Automatic Credential Rotation

Azure rotates credentials automatically.

Developers never need to:

  • renew certificates
  • rotate passwords
  • update connection strings

Reduced Attack Surface

Secrets stored in:

  • source code
  • configuration files
  • GitHub repositories
  • CI/CD pipelines

are eliminated.


Improved Compliance

Managed Identity helps organizations meet:

  • SOC
  • ISO
  • HIPAA
  • GDPR
  • PCI DSS

security recommendations.


Fine-Grained Access Control

Permissions are assigned through Azure Role-Based Access Control (RBAC).

Applications receive only the permissions they require.


Authentication Flow Using Managed Identity

A typical authentication sequence is:

  1. Azure resource requests an access token.
  2. Azure Instance Metadata Service validates the request.
  3. Microsoft Entra ID issues an OAuth access token.
  4. Application sends the token to the AI endpoint.
  5. Azure AI service validates the token.
  6. Request is processed.

No passwords or API keys are exchanged.


Using Managed Identity with Azure OpenAI

Instead of:

API Key

Applications can authenticate using:

Bearer Token

obtained through Managed Identity.

The application requests an OAuth token for the Azure OpenAI resource and includes it in the HTTP Authorization header.

Advantages include:

  • no API key storage
  • centralized identity management
  • automatic credential rotation
  • Azure RBAC integration

Managed Identity with Azure AI Search

Azure AI Search supports Microsoft Entra authentication.

Applications using Managed Identity can:

  • create indexes
  • query indexes
  • update indexes
  • execute semantic search
  • perform vector search

Access permissions are controlled using Azure RBAC rather than shared administrative keys.


Managed Identity with Azure SQL Database

SQL applications may access AI services.

Example workflow:

Azure SQL Stored Procedure

External Application

Managed Identity

Azure OpenAI

Generated Response

No API keys are embedded anywhere.


Securing Azure AI Foundry Models

Azure AI Foundry endpoints also support Microsoft Entra authentication.

Best practices include:

  • Disable anonymous access.
  • Use Managed Identity where supported.
  • Restrict endpoint access with RBAC.
  • Enable private networking.
  • Monitor endpoint usage.
  • Enable diagnostic logging.

Azure Role-Based Access Control (RBAC)

Authentication identifies who is making the request.

Authorization determines what they can do.

Azure RBAC assigns permissions using roles.

Common roles include:

  • Cognitive Services User
  • Cognitive Services Contributor
  • Search Service Contributor
  • Search Index Data Reader
  • Search Index Data Contributor

Assign the minimum permissions required.


Principle of Least Privilege

Applications should receive only the permissions necessary to perform their tasks.

For example:

Application that generates embeddings:

Needs:

  • Generate embeddings

Does NOT need:

  • Delete deployment
  • Create deployments
  • Manage subscriptions

This reduces the impact of compromised credentials.


Private Endpoints

Many Azure AI services support Azure Private Link.

Benefits include:

  • Private IP addresses
  • No public internet exposure
  • Reduced attack surface
  • Simplified firewall rules
  • Secure communication within Azure Virtual Networks

Private Endpoints are strongly recommended for production deployments handling sensitive data.


Network Security

Additional protections include:

  • Azure Firewall
  • Network Security Groups
  • IP restrictions
  • Virtual Networks
  • Private DNS Zones
  • Azure DDoS Protection

These layers complement identity-based security.


Monitoring AI Endpoint Usage

Organizations should continuously monitor:

  • Authentication failures
  • Unauthorized access attempts
  • High request volumes
  • Geographic anomalies
  • Excessive token usage
  • API throttling
  • Unusual costs

Useful monitoring services include:

  • Azure Monitor
  • Azure Activity Log
  • Azure Log Analytics
  • Microsoft Defender for Cloud
  • Microsoft Sentinel

Secure Secrets That Cannot Be Eliminated

Some scenarios still require secrets.

Store them in:

  • Azure Key Vault

Never store secrets in:

  • source code
  • Git repositories
  • application settings
  • SQL tables
  • configuration files

Common Security Mistakes

Avoid:

  • Hardcoding API keys
  • Sharing one API key among multiple applications
  • Granting Contributor rights unnecessarily
  • Disabling authentication
  • Using long-lived secrets
  • Storing credentials in GitHub
  • Ignoring endpoint monitoring
  • Using public endpoints for sensitive workloads

DP-800 Exam Tips

Remember these key points:

  • Managed Identity is Microsoft’s preferred authentication mechanism for Azure-hosted applications.
  • Managed Identity eliminates the need to store secrets.
  • Microsoft Entra ID provides identity and authentication.
  • Azure RBAC provides authorization.
  • Use Private Endpoints for production AI workloads whenever possible.
  • Follow the Principle of Least Privilege.
  • Monitor AI endpoint activity using Azure Monitor and Microsoft Sentinel.
  • Store unavoidable secrets in Azure Key Vault.
  • Prefer token-based authentication over API keys.

Practice Exam Questions

Question 1

A development team wants an Azure Function to securely access an Azure OpenAI endpoint without storing credentials. Which authentication method should be recommended?

A. SQL Authentication

B. API Key stored in configuration

C. System-assigned Managed Identity

D. Windows Authentication

Answer: C

Explanation:
A system-assigned Managed Identity allows the Azure Function to authenticate with Microsoft Entra ID without storing credentials. This is Microsoft’s recommended approach for Azure-hosted services.


Question 2

Which statement best describes Microsoft Entra ID in relation to AI endpoints?

A. It encrypts AI model outputs.

B. It provides identity and authentication services.

C. It compresses prompt data.

D. It performs semantic search.

Answer: B

Explanation:
Microsoft Entra ID authenticates users, services, and applications, issuing access tokens that AI services validate before granting access.


Question 3

Which Azure feature automatically rotates credentials used by applications?

A. Azure Firewall

B. Azure Key Vault

C. Private Endpoint

D. Managed Identity

Answer: D

Explanation:
Managed Identity automatically manages and rotates credentials, eliminating manual secret rotation.


Question 4

Which Azure service should be used to securely store secrets when Managed Identity cannot be used?

A. Azure Blob Storage

B. Azure Files

C. Azure Key Vault

D. Azure Monitor

Answer: C

Explanation:
Azure Key Vault securely stores secrets, certificates, and keys, making it the preferred repository for credentials that cannot be eliminated.


Question 5

What is the primary purpose of Azure RBAC?

A. Encrypt data at rest

B. Assign authorization permissions to authenticated identities

C. Compress AI embeddings

D. Improve query performance

Answer: B

Explanation:
Azure RBAC controls which actions authenticated users, applications, and services can perform on Azure resources.


Question 6

An organization wants AI model traffic to remain entirely within its Azure virtual network. Which feature should be implemented?

A. API Management

B. Azure CDN

C. Private Endpoint

D. Azure Backup

Answer: C

Explanation:
Private Endpoints expose Azure services through private IP addresses within a virtual network, preventing traffic from traversing the public internet.


Question 7

Which authentication approach most reduces the risk of credential exposure?

A. Hard-coded API keys

B. Shared service accounts

C. Managed Identity

D. SQL logins

Answer: C

Explanation:
Managed Identity removes the need to store credentials in application code or configuration, significantly reducing the attack surface.


Question 8

What security principle recommends granting only the permissions an application requires?

A. Defense in Depth

B. Zero Downtime

C. Fail Fast

D. Principle of Least Privilege

Answer: D

Explanation:
The Principle of Least Privilege minimizes security risks by limiting permissions to only those necessary for a specific task.


Question 9

Which service is most appropriate for monitoring authentication failures and unusual AI endpoint activity?

A. Azure Monitor

B. Azure DNS

C. Azure Bastion

D. Azure Disk Storage

Answer: A

Explanation:
Azure Monitor collects logs, metrics, and alerts that help detect authentication failures, unusual access patterns, and operational issues affecting AI services.


Question 10

A company currently authenticates to Azure OpenAI using API keys embedded in application configuration files. What is the best modernization recommendation?

A. Store the API key in a SQL table.

B. Replace API keys with Managed Identity authentication whenever supported.

C. Increase the API key expiration period.

D. Share a single API key across all applications.

Answer: B

Explanation:
Replacing API keys with Managed Identity improves security by eliminating stored secrets, enabling automatic credential management, and integrating with Microsoft Entra ID and Azure RBAC.


Go to the DP-800 Exam Prep Hub main page