Managed identity with target permissions for secretless Azure calls

AI-200 By islever Editorial Last updated

Short answer

D Enable a managed identity on the Azure compute resource and grant that identity the target service's required permissions, so Microsoft Entra tokens are issued without a stored client secret.

Question

Calls from an Azure compute resource to a service that accepts Microsoft Entra tokens must avoid stored client secrets. What configuration is required?
  1. Assign Contributor to the compute resource's resource group only.
  2. Store an application secret in an environment variable.
  3. Enable a managed identity without assigning target permissions.
  4. Enable a managed identity and grant it target permissions. Correct Answer

Key Takeaways

Secretless authentication from Azure compute to Microsoft Entra-protected services relies on a managed identity plus a permission grant at the destination. Option D is correct because enabling the identity supplies the token, while assigning target permissions authorizes the operation without storing a client secret. Options that keep a secret or widen Contributor access fail the no-credential and least-privilege requirements.

Expert Analysis

A managed identity that also holds the destination's required permissions is the only configuration here that removes stored client secrets while still letting an Azure compute resource call a Microsoft Entra-protected service.

Managed identity plus a destination grant is the configuration that satisfies both halves

The binding constraint is not merely getting a token without a secret; it is getting a token without a secret and still being allowed to perform the operation. A managed identity gives the Azure compute resource — a virtual machine, App Service app, Functions app, container app, or AKS workload — an Entra ID service principal whose credentials are rotated and protected by the platform. No client secret sits in application code, an environment variable, Key Vault, or a deployment template. But the identity's token carries its object ID and whatever app roles or group memberships have been assigned; the destination still evaluates that principal against its own authorization model. Without a role assignment, data-plane role, or app role at the target, the call returns an authorization failure even though authentication succeeded. Option D is the sole choice that names both the identity and the destination permission, which is why it holds under the stated constraint. A Contributor role at the compute resource group does not substitute, because it governs management-plane actions on Azure resources rather than the target service's data or API operations and can be far broader than the workload needs. The decisive condition is therefore the pairing, not the identity alone.

Token acquisition through a local endpoint precedes target permission evaluation

At run time, enabling the managed identity causes the compute platform to expose a local token endpoint; on a VM or VM scale set this is the Instance Metadata Service at 169.254.169.254, and other hosts provide an equivalent managed identity endpoint. The application requests a token for a specific resource or audience, such as https://storage.azure.com/ or https://vault.azure.net/, and Entra ID returns a short-lived access token representing the identity's service principal. This is the exact step where stored secrets disappear: the application never proves a password or client secret; the platform attests the workload to Entra ID and the token request is scoped to the target. The destination then validates the token's signature, issuer, audience, and expiry, and checks the caller's object ID against its authorization store. That second check is why the role assignment in Option D matters. For Azure RBAC-protected services, the assignment can be a control-plane role or a data-plane role; for Microsoft Graph or a custom API, it may be an app role or delegated permission with consent. Propagation of a new role assignment can take minutes, so a freshly enabled identity may briefly receive 403 responses even after the grant. The permission is evaluated by the target, not embedded in the token, so the token remains valid but insufficient if the grant is missing.

Environment-secret and resource-group Contributor routes reintroduce credential or scope risk

Option A assigns Contributor only at the compute resource's resource group, which is a management-plane role over Azure resources; it neither creates a workload identity nor grants the target service's data or API permissions, and it violates least privilege by allowing broad resource changes. Option B stores an application secret in an environment variable, which directly contradicts the no-stored-client-secret requirement and adds rotation, leakage, and secret-sprawl exposure through process dumps, deployment logs, and container images. Option C enables a managed identity without assigning target permissions, so token acquisition works but the destination rejects the call because the principal has no role, data-plane permission, or app role there. Option D is the only one that pairs the identity with the needed grant at the destination, keeping credentials out of the application while limiting access to the service operations the workload requires. A narrower target role — for example a data-plane reader rather than Contributor on the resource group — is the least-privilege form of that second half. If the target supports only app roles, the equivalent is an app role assignment to the managed identity's service principal; if it supports Azure RBAC, it is a role assignment scoped to the specific resource.

Destination services lacking an authorization layer would make identity-only enablement sufficient

Option C would become the right answer if the target service accepted any valid Microsoft Entra token and had no per-principal authorization decision — for example a diagnostic endpoint that only proves the caller is authenticated. In that narrow case, enabling the managed identity without a target permission would meet the stated goal because the token alone would be enough. That condition is absent here: the service is described as accepting Microsoft Entra tokens, and production services use that token to identify a principal before applying Azure RBAC, data-plane roles, app roles, ACLs, or tenant policy. The phrase "without assigning target permissions" is precisely what breaks Option C, because a managed identity authenticates a caller but does not automatically authorize it. Likewise, Option B would be defensible only for a workload outside Azure that cannot obtain a managed identity or federated credential; an Azure compute resource has the platform-managed credential path. Option A might fit if the goal were managing Azure resources at resource-group scope, but the goal is calling a token-protected service, so broad Contributor access is the wrong plane and the wrong scope. The missing authorization layer is the counterfactual that would promote C; it is not present.

Official Reference

Exam Strategy

When an item says “no stored secrets” and names an Azure compute resource, look for managed identity first, then check the second half of the option for a destination grant. Authentication and authorization are separate checkpoints: enabling an identity only gets a token, while a target role, data-plane role, or app role assignment is what makes the call succeed. Eliminate answers that move a secret into an environment variable or grant broad Contributor scope, since both violate the credential-avoidance and least-privilege intent.

Practice All AI-200 Questions

Access 69 questions with complete answers and detailed explanations.

View Full AI-200 Practice Test →

← Back to AI-200 Study Guide