File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ public static TokenCredential CreateCredential(IConfiguration config)
5454 if ( string . IsNullOrWhiteSpace ( clientSecret ) )
5555 clientSecret = null ;
5656
57+ // Fallback to the standard AZURE_* environment variables (read here via
58+ // IConfiguration's environment-variable provider) when the corresponding
59+ // AzureAd:* keys are not set in any config source. This matches the
60+ // convention used by the Azure SDK credentials and keeps env-only
61+ // configuration (e.g. cloud pods that only set AZURE_TENANT_ID /
62+ // AZURE_CLIENT_ID via the deployment manifest, or local shells / CI
63+ // jobs that only export AZURE_CLIENT_SECRET) working without requiring
64+ // a parallel AzureAd:* entry in appsettings.
5765 tenantId ??= config [ "AZURE_TENANT_ID" ] ;
5866 clientId ??= config [ "AZURE_CLIENT_ID" ] ;
5967 clientSecret ??= config [ "AZURE_CLIENT_SECRET" ] ;
@@ -175,6 +183,9 @@ public static TokenCredential CreateRuntimeCredential(IConfiguration config)
175183 if ( string . IsNullOrWhiteSpace ( clientSecret ) )
176184 clientSecret = null ;
177185
186+ // See CreateCredential above for rationale: same fallback to the
187+ // standard AZURE_* environment variables when the AzureAd:* keys are
188+ // not populated in any other config source.
178189 tenantId ??= config [ "AZURE_TENANT_ID" ] ;
179190 clientId ??= config [ "AZURE_CLIENT_ID" ] ;
180191 clientSecret ??= config [ "AZURE_CLIENT_SECRET" ] ;
You can’t perform that action at this time.
0 commit comments