mirror of
https://github.com/azure/login.git
synced 2026-06-08 22:47:11 +00:00
Azure/login should logout the active account at the beginning (#376)
* logout at the beginning * remove logout step in test case
This commit is contained in:
parent
34b958dce7
commit
40935f9fb5
2 changed files with 7 additions and 5 deletions
5
.github/workflows/azure-login-negative.yml
vendored
5
.github/workflows/azure-login-negative.yml
vendored
|
|
@ -347,11 +347,6 @@ jobs:
|
|||
script: |
|
||||
core.setFailed('Last action should fail but not. Please check it.')
|
||||
|
||||
# logout first to avoid the conflict with SP1
|
||||
- name: Azure CLI logout
|
||||
run: |
|
||||
az logout
|
||||
|
||||
# SP1 is ignored and SP2 will be used for login, but it will fail since SP2 has no access to the given subscription
|
||||
- name: Login with both creds and individual parameters
|
||||
id: login_12
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ export class AzureCliLogin {
|
|||
await this.executeAzCliCommand(["--version"], true, execOptions);
|
||||
core.debug(`Azure CLI version used:\n${output}`);
|
||||
|
||||
try {
|
||||
await this.executeAzCliCommand(["logout"], true, execOptions);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(`Ignore logout error: "${error}"`);
|
||||
}
|
||||
|
||||
this.setAzurestackEnvIfNecessary();
|
||||
|
||||
await this.executeAzCliCommand(["cloud", "set", "-n", this.loginConfig.environment], false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue