I am trying to get the access token for the Azure function app. I have enabled managed identity for the function app(system assigned). but while fetching the token using the nuget Azure.Identity.
var tokenCredential = new DefaultAzureCredential(); var accessToken = await tokenCredential.GetTokenAsync( new TokenRequestContext(scopes: new string[] { "https://xxx.azure-api.net/" + "/.default" }) { } );
I am getting the error.
The resource principal named 'xxx.azure-api.net' was not found in the tenant 123
but when run az cli to check the subscription details, the subscription indeed part of the tenant 123 only.
https://xxx.azurewebsites.net/.default
. – Carl Zhao