-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Support AZURE_AUTH_LOCATION
#9311
Conversation
I'm not 100% sure on the design here, @schaabs, but I think this is good enough to land. I could image creating an actual The reason I didn't take that approach at first is that I believe that this new token would need to be an Note that this does yet support a SDK Auth file that uses |
34a2021
to
27f8512
Compare
throw new Exception(builder.ToString()); | ||
} | ||
|
||
return new ClientSecretCredential(tenantId, clientId, clientSecret, _pipeline.WithAuthorityHost(new Uri(activeDirectoryEndpointUrl))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that in cases where the SDK Auth File has a different Authority than what is configured on the pipeline we prefer the one in the file. That feels like it's the correct behavior, but I wanted to call out the choice here.
} | ||
else | ||
{ | ||
StringBuilder builder = new StringBuilder("Environment variables not fully configured. AZURE_TENANT_ID and AZURE_CLIENT_ID must be set, along with either AZURE_CLIENT_SECRET or AZURE_USERNAME and AZURE_PASSWORD. Alternately, AZURE_AUTH_LOCATION may be used to specify the location of a Azure SDK Auth file. Currently set variables ["); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that Jon has an open PR to basically remove all of this text. It has definitely gotten longer. I'm not sure if we'd rather reference some page in our documentation about how the EnvironmentCredential in the error (maybe via a shortlink)?
This change adds support to EnvironmentCredential so that it can consider `AZURE_AUTH_LOCATION` as a location to get credentials. This file can be generated with the Azure CLI. The invasive part of the change here is refactoring things such that instead of constructing the inner credential object eagerly when `EnvironmentCredential` is constructed we build it on the first call to GetToken or GetTokenAsync. This is done so that we do not have do preform IO when constructing the credential object. Contributes to #9309
27f8512
to
4a45e79
Compare
Closing in favor of #9312 (which has the correct remote for the HEAD branch). |
This change adds support to EnvironmentCredential so that it can
consider
AZURE_AUTH_LOCATION
as a location to get credentials. Thisfile can be generated with the Azure CLI.
The invasive part of the change here is refactoring things such that
instead of constructing the inner credential object eagerly when
EnvironmentCredential
is constructed we build it on the first call toGetToken or GetTokenAsync. This is done so that we do not have do
preform IO when constructing the credential object.
Contributes to #9309