-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppAuthentication 1.1.0-preview: TenantId is mandatory in connection string with RunAs=App #4169
Comments
Thanks for the feedback. I agree, the TenantId should not be mandatory if it will not be used in some scenarios. We will make a change in a future release to make it optional in the connection string, and throw in GetTokenAsync, if it is needed for that scenario. |
After thinking more on this, we think this change will cause confusion for some users. If they do not specify tenant Id, and it works for Key Vault, but not for other scenarios, it will not be easy for users to know what to change to fix the issue. This way, even though the tenant id is not required for key vault scenario, the usage causes no confusion. |
Can you please give an example of other services that use the same format of connection string and which do require TenantId? |
If you see the usage here, https://docs.microsoft.com/en-us/azure/key-vault/service-to-service-authentication#using-the-library string accessToken = await azureServiceTokenProvider2.GetAccessTokenAsync("https://management.azure.com/").ConfigureAwait(false); Anytime you use the library to get an access token for an Azure service, you will need to specify the tenant in the connection string, if you use a cert. This is the other pattern where tenant is not required. var azureServiceTokenProvider1 = new AzureServiceTokenProvider(); |
Closing this as per the details provided above. |
The
ClientCertificateAzureServiceTokenProvider
seams to only use the tenant id in its methodGetTokenAsync
if theauthority
parameter is null or white space. But some clients, for example theKeyVaultClient
ofMicrosoft.Azure.KeyVault
, provides aauthority
parameter. This makes theTenantId
-part of the connection string possibly redundant.For example, the following code works just fine:
I propose making the
TenantId
optional and instead throw inClientCertificateAzureServiceTokenProvider.GetTokenAsync
if authority is null or white space and_tenantId
is not set.The text was updated successfully, but these errors were encountered: