title: Unable to get access token. 'AADSTS500011: The resource principal named 'xxx' was not found in the tenant -tenantid
body: <p>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.</p>
  <p>var tokenCredential = new DefaultAzureCredential();
  var accessToken = await tokenCredential.GetTokenAsync(
  new TokenRequestContext(scopes: new string[] { &quot;https://xxx.azure-api.net/&quot; + &quot;/.default&quot; }) { }
  );</p>
  <p>I am getting the error.</p>
  <blockquote>
  <p>The resource principal named 'xxx.azure-api.net' was not found in
  the tenant 123</p>
  </blockquote>
  <p>but when run az cli to check the subscription details, the subscription indeed part of the tenant 123 only.</p>