A developer is configuring a background service running on an on-premises server that must retrieve data from a custom Web API secured by Microsoft Entra ID. The background service runs autonomously without any user interaction and authenticates using its client secret.
The developer manually updates the Microsoft Entra ID application manifest of the background service to request access to the Web API. In the requiredResourceAccess section of the manifest, the developer adds the correct resource app ID and includes the permission ID in the resourceAccess array, setting the type property of the permission to Scope.
After the developer grants administrator consent, the background service successfully obtains an access token using the OAuth 2.0 client credentials grant flow. However, when the service presents the token to the Web API, the API rejects the request with an HTTP 403 Forbidden error.
What is the cause of this authentication issue?
- The permission was configured with a type of Scope instead of Role, which prevents the permission from being included in the token during a client credentials grant flow.Answer
- BThe developer enabled a system-assigned managed identity for the on-premises server, which does not support the client credentials grant flow using a client secret.
- CThe developer did not configure a Key Vault access policy to grant the service principal GET permissions, preventing it from validating the client secret.
- DThe developer configured a Shared Access Signature (SAS) token with restricted scopes instead of registering a service principal to authenticate against Microsoft Entra ID.