Azure/login should logout the active account at the beginning - #376
Merged
Conversation
Shiying Chen (MoChilia)
had a problem deploying
to
Automation test
November 27, 2023 08:57 — with
GitHub Actions
Failure
Shiying Chen (MoChilia)
temporarily deployed
to
Automation test
November 27, 2023 09:06 — with
GitHub Actions
Inactive
Yan Xu (YanaXu)
approved these changes
Nov 27, 2023
| core.debug(`Azure CLI version used:\n${output}`); | ||
|
|
||
| try { | ||
| await this.executeAzCliCommand(["logout"], true, execOptions); |
Contributor
There was a problem hiding this comment.
Perhaps az account clear for a cleaner environment?
Member
Author
There was a problem hiding this comment.
I suppose az logout is enough for signing out the current active subscription. And the following steps will use the subscription set in azure/login. There may be a situation that customer needs to switch the active subscription by manually running az account set.
Member
Author
There was a problem hiding this comment.
In automation, az account clear may be a better choice for a cleaner environment. I will modify the code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Azure CLI should run
az logoutto clear the active account at the beginning like what is done in Azure PowerShell:login/src/PowerShell/AzPSScriptBuilder.ts
Lines 27 to 28 in 34b958d
Otherwise, when the user doesn't explicitly give the
subscription-idor the givensubscription-idis invaild, the post steps will continue using the user's active subscription which has set last time and not logged out.The following test case will encounter this issue:
login/.github/workflows/azure-login-negative.yml
Lines 355 to 366 in 34b958d