Microsoft AI-103: Managed Identities for AI Apps
An AI application may access a model endpoint, search index, storage container and internal tool API in one user request. Putting an access key for every dependency into application settings creates a maintenance burden and a serious incident risk when one secret leaks. Managed identities can replace many stored Azure credentials with Microsoft Entra tokens issued to a workload, but they do not make authorization automatic. The hard design work is deciding which workload identity calls each service, what data that identity may reach, and how those permissions change between development, publication and production operations.
On this page
- Map the caller chain before assigning a role
- Use system-assigned and user-assigned identities deliberately
- Separate token acquisition, RBAC assignment and network reachability
- Give the retrieval pipeline its own data permissions
- Understand agent identities when moving from project to publication
- Avoid secrets where identities work, but keep a plan for exceptions
- Design least privilege around outcomes rather than generic job titles
- Test failures with the actual production identity boundary
- Treat identity design as part of the AI application’s product contract
Map the caller chain before assigning a role
Consider a help-desk assistant hosted in Azure. A signed-in employee sends a question to a web front end; a backend calls a deployed model, retrieves matching knowledge from Azure AI Search and sometimes reads an attachment from Azure Storage. A Microsoft AI-103 workload should use identity-bound resource access and prove the permission boundary with an authorized and a denied request.
Follow three identities through a help-desk assistant: the employee asking a question, the backend workload retrieving information, and any separately authorized agent or tool identity. A managed identity can spare the backend from storing a secret, but the workload may still have broader access to Azure AI Search or Storage than the employee is allowed to exercise. Pass verified user context into the authorization decision and test a document that the backend can access but the user cannot. A successful token exchange proves which workload authenticated; it does not prove that every retrieved result is safe to disclose to the requester.
Draw each network and API call as an arrow with an authenticated principal, target resource and required operation. A backend may have permission to query a search index, while the employee has permission to view only certain documents within it. The workload’s successful token acquisition does not make every search result appropriate to show to that employee. End-user document restrictions require their own enforcement in the query and data model.
Record whether the operation is management-plane or data-plane. A principal may be able to see resource properties without having permission to read blob contents or query documents. Conversely, a narrow data role can allow useful runtime access without permitting infrastructure changes. Misdiagnosing a failed call as a “missing Contributor role” often leads teams to grant far more access than the application needs.
Use system-assigned and user-assigned identities deliberately
A system-assigned managed identity is attached to a supported Azure resource and follows that resource’s lifecycle. It is a reasonable default when one hosted workload owns one runtime responsibility and its permissions should disappear with the resource. A user-assigned managed identity has a separate lifecycle and can be associated with multiple supported resources. That can help when a controlled identity must persist through a deployment replacement or be reused by a defined set of services.
Neither choice guarantees good isolation by itself. Sharing one user-assigned identity across development, testing and production expands the consequences of a compromised environment. Attaching several applications to the same identity may also make audit trails harder to interpret. Use separate identities for distinct privilege boundaries, and document why any shared assignment is intentional. Resource ownership, not convenience, should determine reuse.
Managed identity availability and token acquisition mechanisms depend on the Azure hosting service. Local development usually relies on an authenticated developer identity or another supported credential in a development chain; developers should not assume a managed identity can be used outside an environment that provides it. Keep local developer privileges distinct from the permissions used by the deployed application.
Separate token acquisition, RBAC assignment and network reachability
A successful access token means the workload authenticated to the identity provider for a requested audience. It does not prove the destination service will authorize the requested operation. A 403 response may indicate a missing data-plane role, an overly narrow scope, the wrong principal or a role assignment that has not propagated yet. An authentication error may instead indicate an invalid audience or unsupported credential configuration. These need different remedies.
Start diagnosis by identifying the actual principal ID used by the running service. Confirm the target resource and required data action, then examine effective role assignments and their scopes. Resource-level roles are easier to reason about than blanket subscription grants when the application needs only a search index or storage account.
Azure AI Search defines roles for querying and managing search data; Storage defines separate blob data roles. A management role with a familiar name is not a substitute for the precise data permission.
Network rules add an independent boundary. An identity can possess the right Azure role yet be blocked by a private endpoint, firewall or DNS configuration. Conversely, making an endpoint publicly reachable does not authorize a caller. Keep the troubleshooting sequence explicit: token audience, principal, role, data action, network resolution and service logs. Changing all of them at once hides the root cause and often creates unintended exposure.
Give the retrieval pipeline its own data permissions
The backend that serves queries and the service that indexes content need not use the same identity. For example, an Azure AI Search indexer may use a managed identity to read a blob container, while an application uses another identity to query indexed content.
The indexer can require Storage Blob Data Reader or another appropriate source-specific role; the serving application needs only query access to the search resource. This is a cleaner boundary than giving the chatbot the ability to crawl and rewrite the original content repository.
Azure AI Search documents managed-identity connections for supported data sources. The exact configuration varies by source, network protection and API version. In a real deployment, validate the chosen source adapter and credential type instead of copying a storage-account sample into an unrelated connector. A successful scheduled ingestion job should produce a distinct audit event from an end-user search query.
Document-level authorization remains a separate concern. If employees in different departments share an index, retrieval must filter or enforce permissions that correspond to the actual caller. Microsoft documents native access-control features and security-filter alternatives, some with preview constraints. A string stored inside an index is not an identity by itself: the application must derive trustworthy group or user membership and apply the filter consistently before any restricted passage reaches the model.
Understand agent identities when moving from project to publication
Microsoft Foundry has an identity model for agents in addition to the managed identities used by conventional hosted applications. Its documentation distinguishes the shared project identity used by certain unpublished agents from identities associated with published agent applications, and notes that the publishing model is evolving. A tool that works in a developer project can fail after publication because the agent’s principal changed.
The safe release sequence is to identify which agent object and publishing experience the application uses, determine the identity assigned in that experience, and grant only the roles that its supported tools require. Do not assume project-level permissions automatically transfer to a published endpoint. Record the old and new principal IDs in the deployment evidence so an authorization failure can be traced without opening access broadly.
Some tools support agent identity authentication while others use different connection credentials or delegated user flows. Check the specific tool’s documented mechanism. In particular, a service principal for an agent is not evidence that it is acting on behalf of the current employee. If the business operation needs per-user authority, implement the supported delegation pattern and validate the user’s rights in the target system.
Avoid secrets where identities work, but keep a plan for exceptions
Not every integration supports Microsoft Entra workload identity. A third-party API may still require a secret, signing certificate or token exchange. In that case, store credentials in a managed secret service, restrict who can retrieve them, rotate them when possible and keep their scope narrow. The goal is not a universal “zero secrets” slogan; it is minimizing reusable credentials and making remaining exceptions auditable.
A service-to-service connection should not smuggle an administrator API key into a configuration file merely to make a proof of concept work. Prefer the service’s documented keyless authentication route and RBAC role when supported. If a key is unavoidable, make its owner, expiry, rotation process and revocation path explicit. Testing environments should use separate credentials from production, even if both call a model with the same API shape.
Protect configuration and logs as carefully as code. Accidentally including a token in an exception message, trace or support ticket can defeat the benefit of managed identity. Scrub authentication headers and signed URLs from routine telemetry, and keep any privileged diagnostic capture behind a documented incident procedure.
Design least privilege around outcomes rather than generic job titles
Imagine a document-answering assistant with an optional “request access” tool. Its normal runtime needs to read the search index and invoke its model. It should not be able to assign Azure RBAC roles just because some user might ask for permission. An access request can be queued for a separately authorized workflow whose operator or service identity possesses the necessary permissions after approval.
Use the narrowest workable assignment scope and separate read operations from writes. A search-only workload rarely needs to create indexes. An ingestion identity may need read access to a specific source, but not to every container in a subscription. A monitoring identity may need to read health metrics, not to rotate storage keys. These divisions make troubleshooting and incident containment easier.
Review assignments after deployment, not just during setup. An identity left behind from a pilot can retain data access even after the application no longer uses it. Infrastructure-as-code can help teams declare intended role assignments and detect drift. The review should ask what each identity actually does today and whether the assignment remains justified.
Test failures with the actual production identity boundary
Create a permissions matrix with rows for the application’s principal identities and columns for intended resource operations. Test a successful allowed query, a denied document, a denied write and a target resource in another environment.
Use non-sensitive test records where possible and capture the resulting service diagnostic IDs. A system that can retrieve a document while it is acting as a privileged developer should not be declared safe for production without repeating the same test as the deployment identity.
During an authorization incident, avoid immediately granting broad Contributor or Owner rights as a diagnostic shortcut. First confirm token audience, effective identity, exact API operation and data-plane role. Check whether published-agent identity changes or configuration propagation explains the failure. If a private network is involved, verify DNS and endpoint connectivity separately. Reproduce the specific denied request with the minimum privilege needed, then remove any temporary diagnostic access.
Run a periodic access review after deployment. Compare desired RBAC assignments with actual roles, test cross-tenant and cross-department cases when relevant, and confirm revoked users stop receiving restricted retrieval content. Include machine identities in incident response alongside human accounts, because compromised workload credentials or an overly broad agent principal can expose the same business information as a user compromise.
Treat identity design as part of the AI application’s product contract
A practical architecture record should show which principal invokes the model, which principal queries Azure AI Search, how the indexer reaches source storage, whether a Foundry agent has a separate published identity, and what rules protect user-specific results. Include the authentication audience, data roles, scopes, network restrictions and owner responsible for access reviews. That document is more useful than a list of resource keys, especially when services change.
Managed identities simplify credential handling, but they do not answer the authorization question. The decisive work is assigning the right principal to the right operation, enforcing user visibility even when the backend is privileged, and verifying permissions at publication and during outages. Those controls let an AI application call powerful services without quietly turning an assistant into a broadly trusted administrator.