Ошибка при попытке получить токен доступа для управляемого удостоверения, назначенного системой.C#

Место общения программистов C#
Ответить
Anonymous
 Ошибка при попытке получить токен доступа для управляемого удостоверения, назначенного системой.

Сообщение Anonymous »


I am trying to acquire an access token for the system-assigned managed identity of my web app. Here's the code I tried:

DefaultAzureCredential cred = new DefaultAzureCredential(new DefaultAzureCredentialOptions() { ManagedIdentityClientId = Constants.ManagedIdentityId, }); var accessToken = cred.GetToken(new TokenRequestContext(new[] { "https://management.azure.com" })); When I try to use this access token to access the API Management REST API, I get the following error:

The access token is from the wrong issuer 'https://sts.windows.net/TENANT_ID1/'. It must match the tenant 'https://sts.windows.net/TENANT_ID2/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/TENANT_ID2' to get the token.

How/where do I set the Tenant ID?

NB: At this stage I'm running the code on my dev machine in Visual Studio.


Источник: https://stackoverflow.com/questions/779 ... d-identity
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»