diff --git a/providers/azure/helpers.go b/providers/azure/helpers.go index a4543c6..9448d47 100644 --- a/providers/azure/helpers.go +++ b/providers/azure/helpers.go @@ -85,14 +85,14 @@ func getContainerClient(conf Config, wrapRoundtripper func(http.RoundTripper) ht } func getTokenCredential(conf Config) (azcore.TokenCredential, error) { - if conf.UserAssignedID == "" { - return azidentity.NewDefaultAzureCredential(nil) - } - if conf.ClientSecret != "" && conf.TenantID != "" && conf.ClientID != "" { return azidentity.NewClientSecretCredential(conf.TenantID, conf.ClientID, conf.ClientSecret, &azidentity.ClientSecretCredentialOptions{}) } + if conf.UserAssignedID == "" { + return azidentity.NewDefaultAzureCredential(nil) + } + msiOpt := &azidentity.ManagedIdentityCredentialOptions{} msiOpt.ID = azidentity.ClientID(conf.UserAssignedID) return azidentity.NewManagedIdentityCredential(msiOpt)