diff --git a/providers/azure/helpers.go b/providers/azure/helpers.go index 7b4a5fbe..01708770 100644 --- a/providers/azure/helpers.go +++ b/providers/azure/helpers.go @@ -6,12 +6,14 @@ package azure import ( "fmt" "net/http" + "os" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container" + "github.com/pkg/errors" "github.com/thanos-io/objstore/exthttp" ) @@ -64,11 +66,12 @@ func getContainerClient(conf Config) (*container.Client, error) { } // Use MSI for authentication. - msiOpt := &azidentity.ManagedIdentityCredentialOptions{} if conf.UserAssignedID != "" { - msiOpt.ID = azidentity.ClientID(conf.UserAssignedID) + if err := os.Setenv("AZURE_CLIENT_ID", conf.UserAssignedID); err != nil { + return nil, errors.Wrapf(err, "unable to set environment variable for AZURE_CLIENT_ID") + } } - cred, err := azidentity.NewManagedIdentityCredential(msiOpt) + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { return nil, err }