Skip to content

Commit 08badfe

Browse files
Merge pull request #1079 from bryan-cox/revert-1020-IR-467
Revert "IR-467: Enable Azure MSI authentication"
2 parents 1089344 + cd8afd9 commit 08badfe

File tree

2 files changed

+20
-52
lines changed

2 files changed

+20
-52
lines changed

pkg/storage/azure/azure.go

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -341,33 +341,17 @@ func (d *driver) storageAccountsClient(cfg *Azure, environment autorestazure.Env
341341
err error
342342
)
343343
if strings.TrimSpace(cfg.ClientSecret) == "" {
344-
if strings.TrimSpace(cfg.FederatedTokenFile) != "" {
345-
options := azidentity.WorkloadIdentityCredentialOptions{
346-
ClientOptions: azcore.ClientOptions{
347-
Cloud: cloudConfig,
348-
},
349-
ClientID: cfg.ClientID,
350-
TenantID: cfg.TenantID,
351-
TokenFilePath: cfg.FederatedTokenFile,
352-
}
353-
cred, err = azidentity.NewWorkloadIdentityCredential(&options)
354-
if err != nil {
355-
return storage.AccountsClient{}, err
356-
}
357-
} else {
358-
options := azidentity.ManagedIdentityCredentialOptions{
359-
ClientOptions: azcore.ClientOptions{
360-
Cloud: cloudConfig,
361-
},
362-
}
363-
if cfg.ClientID != "" {
364-
options.ID = azidentity.ClientID(cfg.ClientID)
365-
}
366-
var err error
367-
cred, err = azidentity.NewManagedIdentityCredential(&options)
368-
if err != nil {
369-
return storage.AccountsClient{}, err
370-
}
344+
options := azidentity.WorkloadIdentityCredentialOptions{
345+
ClientOptions: azcore.ClientOptions{
346+
Cloud: cloudConfig,
347+
},
348+
ClientID: cfg.ClientID,
349+
TenantID: cfg.TenantID,
350+
TokenFilePath: cfg.FederatedTokenFile,
351+
}
352+
cred, err = azidentity.NewWorkloadIdentityCredential(&options)
353+
if err != nil {
354+
return storage.AccountsClient{}, err
371355
}
372356
} else {
373357
options := azidentity.ClientSecretCredentialOptions{

pkg/storage/azure/azureclient/azureclient.go

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,15 @@ func New(opts *Options) (*Client, error) {
8686
if creds == nil {
8787
var err error
8888
if strings.TrimSpace(opts.ClientSecret) == "" {
89-
if strings.TrimSpace(opts.FederatedTokenFile) != "" {
90-
options := azidentity.WorkloadIdentityCredentialOptions{
91-
ClientOptions: coreOpts,
92-
ClientID: opts.ClientID,
93-
TenantID: opts.TenantID,
94-
TokenFilePath: opts.FederatedTokenFile,
95-
}
96-
creds, err = azidentity.NewWorkloadIdentityCredential(&options)
97-
if err != nil {
98-
return nil, err
99-
}
100-
} else {
101-
options := azidentity.ManagedIdentityCredentialOptions{
102-
ClientOptions: azcore.ClientOptions{
103-
Cloud: cloudConfig,
104-
},
105-
}
106-
if opts.ClientID != "" {
107-
options.ID = azidentity.ClientID(opts.ClientID)
108-
}
109-
var err error
110-
creds, err = azidentity.NewManagedIdentityCredential(&options)
111-
if err != nil {
112-
return nil, err
113-
}
89+
options := azidentity.WorkloadIdentityCredentialOptions{
90+
ClientOptions: coreOpts,
91+
ClientID: opts.ClientID,
92+
TenantID: opts.TenantID,
93+
TokenFilePath: opts.FederatedTokenFile,
94+
}
95+
creds, err = azidentity.NewWorkloadIdentityCredential(&options)
96+
if err != nil {
97+
return nil, err
11498
}
11599
} else {
116100
options := azidentity.ClientSecretCredentialOptions{

0 commit comments

Comments
 (0)