You are configuring an Azure API Management (APIM) instance to authenticate to a backend API. The backend API is secured with Microsoft Entra ID and requires an authentication token. You configure the APIM instance to use a system-assigned managed identity.
You need to add a policy that obtains an OAuth token for the resource `https://graph.microsoft.com` and presents it to the backend API.
Which XML policy configuration should you apply?
- A<outbound>
<base />
<authentication-managed-identity resource="https://graph.microsoft.com" />
</outbound> - <inbound>
<base />
<authentication-managed-identity resource="https://graph.microsoft.com" />
</inbound>Cevap - CConfigure a user-assigned managed identity in the API Management instance settings, and apply the following policy:
<inbound>
<base />
<authentication-managed-identity resource="https://graph.microsoft.com" />
</inbound>
without specifying the client ID or object ID of the user-assigned identity in the policy. - DCreate an API Management Named Value referencing an Azure Key Vault secret that contains a client secret, and retrieve it using:
<inbound>
<base />
<set-header name="Authorization" exists-action="override">
<value>{{keyvault-secret-named-value}}</value>
</set-header>
</inbound>
without granting the API Management system-assigned managed identity Get secret permissions in the Key Vault access policies.
Cevap
The correct configuration is the inbound policy block containing the authentication-managed-identity element with the resource attribute set to the Microsoft Graph audience.
The correct configuration uses the `<authentication-managed-identity>` policy placed within the `<inbound>` section. This policy instructs Azure API Management to use its system-assigned managed identity to acquire an OAuth token for the specified resource (in this case, `https://graph.microsoft.com`) and add it as an Authorization header to the request before forwarding it to the backend API.
Adım Adım Çözüm
Anahtar Kavram
Acquiring an OAuth token for backend authentication using the APIM system-assigned managed identity via the authentication-managed-identity policy in the inbound section.