Azure / Azure/azure-cli-extensions

[Auth] Regenerate vendored SDKs to comply with the correct `credential_scopes` handling logic

Open
#2,634 1 comment 0 reactions 1 assignee Claimed by @jiasli View on GitHub
Account feature-request
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

Derived from https://github.com/Azure/azure-cli/pull/15806

Some old Track 2 SDKs may have 2 issues when calling `get_token`:

1. Empty scopes
2. Multiple scopes

Both are incorrect logic. The correct `credential_scopes` handling logic is that Track 2 SDK should maintain **one and only one scope** as `credential_scopes`.

Please take the correct `azure-mgmt-resource` resource SDK as an example and make sure all vendored SDK comply with this logic:

https://github.com/Azure/azure-sdk-for-python/blob/27e4203818e227ba2604ff52dcf55ce2293c4c37/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_configuration.py#L41

```py
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
```

⚠ Although for now the erroneous SDKs work because CLI has added some workarounds to handle these issues, after migrating to Azure Identity and MSAL, these workarounds will fail. The old erroneous SDKs MUST be regenerated to comply with the correct `credential_scopes` handling logic.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.