Browse Source

fix: leaving out managed id is not an invalid config (#4890)

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Gergely Brautigam 10 months ago
parent
commit
29908a7c8e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      pkg/generator/acr/acr.go

+ 2 - 1
pkg/generator/acr/acr.go

@@ -297,11 +297,12 @@ func accessTokenForManagedIdentity(ctx context.Context, envType esv1.AzureEnviro
 		opts = &azidentity.ManagedIdentityCredentialOptions{
 			ID: azidentity.ResourceID(identityID),
 		}
-	} else {
+	} else if identityID != "" {
 		opts = &azidentity.ManagedIdentityCredentialOptions{
 			ID: azidentity.ClientID(identityID),
 		}
 	}
+	// lacking option ID, az will default to `id := managedidentity.SystemAssigned()`.
 	creds, err := azidentity.NewManagedIdentityCredential(opts)
 	if err != nil {
 		return "", err