azure-sdk-for-net
azure-sdk-for-net copied to clipboard
[QUERY] How to replace GetAccessTokenAsync from Microsoft.Azure.Services.AppAuthentication
Library name and version
Azure.Identity 1.6.1
Query/Question
Dear,
I was using Microsoft.Azure.Services.AppAuthentication and the GetAccessTokenAsync to get the access token of the scope "https://database.windows.net/"
Now with Azure.Identity I tried like this : var _defaultAzureCredential = new DefaultAzureCredential(new DefaultAzureCredentialOptions { InteractiveBrowserTenantId = "TestTenant" //_tenantId });
var accessToken = await _defaultAzureCredential.GetTokenAsync( new TokenRequestContext(new[] { _azureServiceTokenProviderResource })).ConfigureAwait(false);
The issue is that the tenantId is ignored, it will use the one of my azure account and not the tenantId of my sql database. So the accessToken is always valid and I don't want this to be the case.
Is it possible to help me to fix this issue ?
Regards
Environment
No response
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @azerios - Are you sure that the credential being selected is the InteractiveBrowserCredential? Enabling logging may provide more helpful information - Details:
https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md#logging
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!