Skip to content

Commit

Permalink
🧹 Use DefaultAzureCredential for token resolving in the Azure provide…
Browse files Browse the repository at this point in the history
…r. This extends the connection capabilities of the azure provider from just CLI creds to env var, workload identity, managed identity and CLI creds. (#3071)

Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev authored Jan 25, 2024
1 parent 83023b4 commit b130500
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions providers/azure/connection/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
func GetTokenCredential(credential *vault.Credential, tenantId, clientId string) (azcore.TokenCredential, error) {
var azCred azcore.TokenCredential
var err error
// fallback to CLI authorizer if no credentials are specified
// fallback to default authorizer if no credentials are specified
if credential == nil {
log.Debug().Msg("using azure cli to get a token")
azCred, err = azidentity.NewAzureCLICredential(&azidentity.AzureCLICredentialOptions{})
log.Debug().Msg("using default azure token resolver")
azCred, err = azidentity.NewDefaultAzureCredential(&azidentity.DefaultAzureCredentialOptions{})
if err != nil {
return nil, errors.Wrap(err, "error creating CLI credentials")
}
Expand Down

0 comments on commit b130500

Please sign in to comment.