From 2b98fbf3b7efb9bcaee8500746d385526a524b17 Mon Sep 17 00:00:00 2001 From: Aaron Peschel Date: Fri, 21 Apr 2023 12:54:25 -0700 Subject: [PATCH] Fix SOPS azkv envCred At the moment, the envCred logic can't actually set the Azure credentials. This commit fixes the logic so that the environment variables can actually be used to set the Azure credentials. There are other issues that come up from this block of code, but those can be dealt with separately. Signed-off-by: Aaron Peschel --- internal/sops/azkv/keysource.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/sops/azkv/keysource.go b/internal/sops/azkv/keysource.go index b0b0f496..855ba327 100644 --- a/internal/sops/azkv/keysource.go +++ b/internal/sops/azkv/keysource.go @@ -222,14 +222,13 @@ func getDefaultAzureCredential() (azcore.TokenCredential, error) { ) var errorMessages []string - var creds []azcore.TokenCredential options := &azidentity.DefaultAzureCredentialOptions{} envCred, err := azidentity.NewEnvironmentCredential(&azidentity.EnvironmentCredentialOptions{ ClientOptions: options.ClientOptions, DisableInstanceDiscovery: options.DisableInstanceDiscovery}, ) if err == nil { - creds = append(creds, envCred) + return envCred, nil } else { errorMessages = append(errorMessages, "EnvironmentCredential: "+err.Error()) }