-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Profile] az account get-access-token: Allow specifying --tenant with the current tenant
#31869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -360,17 +360,20 @@ def get_raw_token(self, resource=None, scopes=None, subscription=None, tenant=No | |||||
|
|
||||||
| managed_identity_type, managed_identity_id = Profile._parse_managed_identity_account(account) | ||||||
|
|
||||||
| non_current_tenant_template = ("For {} account, getting access token for non-current tenants is not " | ||||||
| "supported. The specified tenant must be the current tenant " | ||||||
| f"{account[_TENANT_ID]}") | ||||||
|
||||||
| f"{account[_TENANT_ID]}") | |
| "{}").format(account[_TENANT_ID]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This copilot comment is incorrect. f-string is preferred in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of raising an error, another possible solution is to ignore the specified tenant and just return the access token for the current tenant, but it will result in wrong access token being returned, making it difficult to troubleshoot. I don't agree with this solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The template string construction is unnecessarily complex and hard to read. Consider using a single f-string or format method call instead of concatenating strings and mixing f-string syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is incorrect. Prefixing the substring with
fis unnecessary.