(cherry picked from commit c6356c5bba)
Co-authored-by: Sergey Kostrukov <sekost@microsoft.com>
This commit is contained in:
co-authored by
Sergey Kostrukov
parent
3baec71cce
commit
1fe8b3a7b0
@@ -140,6 +140,12 @@ func (c *managedIdentityTokenRetriever) Init() error {
|
||||
}
|
||||
|
||||
func (c *managedIdentityTokenRetriever) GetAccessToken(ctx context.Context, scopes []string) (*AccessToken, error) {
|
||||
// Workaround for a bug in Azure SDK which mutates the passed array of scopes
|
||||
// See details https://github.com/Azure/azure-sdk-for-go/issues/15308
|
||||
arr := make([]string, len(scopes))
|
||||
copy(arr, scopes)
|
||||
scopes = arr
|
||||
|
||||
accessToken, err := c.credential.GetToken(ctx, azcore.TokenRequestOptions{Scopes: scopes})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user