Ошибка при попытке получить токен доступа для управляемого удостоверения, назначенного системой. ⇐ C#
Ошибка при попытке получить токен доступа для управляемого удостоверения, назначенного системой.
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
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
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Доступ SQL с помощью управляемого удостоверения – срок действия токена истекает
Anonymous » » в форуме C# - 0 Ответы
- 23 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Доступ SQL с помощью управляемого удостоверения – срок действия токена истекает
Anonymous » » в форуме C# - 0 Ответы
- 13 Просмотры
-
Последнее сообщение Anonymous
-