Henrik Gering
Henrik Gering

Reputation: 1891

Accessing API's using Azure Managed Identity

I am trying to connect two Web API's. I wish to use managed identity to allow access from the source API to the target API.

In source the API I run this code in order to obtain an access token:

token = await new ManagedIdentityCredential()
                   .GetTokenAsync(new TokenRequestContext(new string[] {/*Scope here*/}));

The scope is the URL of the second API with prefix app instead of http.

When I run the code in the source app service, I get this error:

ManagedIdentityCredential authentication failed: Service request failed. Status: 500 (Internal Server Error) Content: {"statusCode":500,"message":"An unexpected error occured while fetching the AAD

I am puzzled about the 500 error, I would assume if I had misconfigured anything I would get a 401.

Upvotes: 0

Views: 708

Answers (0)

Related Questions