Skip to content

Commit

Permalink
[azblobproxy] report an error when tenant id is required but not set
Browse files Browse the repository at this point in the history
  • Loading branch information
mostynb committed Aug 31, 2022
1 parent 897df09 commit cf45f0e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/azblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ func (azblobc AzBlobStorageConfig) GetCredentials() (azcore.TokenCredential, err
if err != nil {
return nil, fmt.Errorf(`failed to load certificate from "%s": %v`, azblobc.CertPath, err)
}
if azblobc.TenantID == "" {
return nil, fmt.Errorf("An Azure blob tenant ID is required.")
}

return azidentity.NewClientCertificateCredential(azblobc.TenantID, azblobc.ClientID, certs, key, nil)
}

if azblobc.AuthMethod == azblobproxy.AuthMethodClientSecret {
if azblobc.TenantID == "" {
return nil, fmt.Errorf("An Azure blob tenant ID is required.")
}

log.Println("AzBlob Credentials: using client secret credentials")
return azidentity.NewClientSecretCredential(azblobc.TenantID, azblobc.ClientID, azblobc.ClientSecret, nil)
}
Expand Down

0 comments on commit cf45f0e

Please sign in to comment.