From a95a395e753abd52a629f427532aeefea4f7eb9d Mon Sep 17 00:00:00 2001 From: DylanGuedes Date: Fri, 29 Nov 2024 07:45:04 -0300 Subject: [PATCH] Fix the order of checkage --- providers/azure/helpers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)