Skip to content

[Identity] Adjust log level for EnvCred warning#31814

Merged
pvaneck merged 2 commits intoAzure:mainfrom
pvaneck:identity-env-client-id
Aug 29, 2023
Merged

[Identity] Adjust log level for EnvCred warning#31814
pvaneck merged 2 commits intoAzure:mainfrom
pvaneck:identity-env-client-id

Conversation

@pvaneck
Copy link
Copy Markdown
Member

@pvaneck pvaneck commented Aug 25, 2023

If a possible environment credential is passed in, but no complete environment configuration is found, we output a warning log statement.

However, since the default log level is WARNING, this warning is always printed when a user is trying to use DefaultAzureCredential with the AZURE_CLIENT_ID envvar set (typically for using a user-assigned managed identity).

This warning is not printed with the WARNING prefix and can cause confusion for the user.

To address the most common case of this confusing users using DAC, the log level has been changed to INFO if the credential is detected to be within DAC.

Closes: #30214

@pvaneck pvaneck self-assigned this Aug 25, 2023
@pvaneck pvaneck force-pushed the identity-env-client-id branch from a3086db to d7cc436 Compare August 25, 2023 19:23
@azure-sdk
Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

@pvaneck pvaneck marked this pull request as ready for review August 25, 2023 20:18
@pvaneck pvaneck requested review from a team and xiangyan99 as code owners August 25, 2023 20:18
Comment thread sdk/identity/azure-identity/azure/identity/_credentials/environment.py Outdated
If a possible environment credential is passed in, but no complete
environment configuration is found, we output a warning log statement.

However, since the default log level is WARNING, this warning is always printed
when a user is trying to use DefaultAzureCredential with the AZURE_CLIENT_ID
envvar set (typically for using a user-assigned managed identity).

This warning is not printed with the `WARNING` prefix and can cause confusion
for the user.

Since setting AZURE_CLIENT_ID is a common use case outside of
EnvironmentCredential, the log level is relaxed to INFO if that's the
only environment config set.

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck force-pushed the identity-env-client-id branch from 77f7ebf to 4e77a91 Compare August 29, 2023 01:05
@pvaneck pvaneck requested a review from xiangyan99 August 29, 2023 19:09
@pvaneck pvaneck merged commit cdab548 into Azure:main Aug 29, 2023
@pvaneck pvaneck deleted the identity-env-client-id branch August 29, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

UX issue when trying to use user assigned managed identity.

4 participants