-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Clear azure rm context in initialize azure #7778
Conversation
if (Get-Command -Name "Add-AzureRmAccount" -ErrorAction "SilentlyContinue") { | ||
if (Get-Command -Name "Add-AzureRmAccount" -ErrorAction "SilentlyContinue") { | ||
Write-Host "##[command]Clear-AzureRmContext -Scope Process" | ||
$null = Clear-AzureRmContext -Scope Process |
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.
Do you know the PS version from which this command is supported?
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.
Yes, the command is available from version 4.
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.
Can you please check if this cmdlet exists. I think that way it won't even break for customers on version less that 4 too.
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.
Can you please check if this cmdlet exists. I think that way it won't even break for customers on version less than 4 too.
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.
Should we move this cmdlet outside of the if condition.
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.
AS per offline discussion made changes
Write-Host "##[command]Clear-AzureRmContext -Scope Process" | ||
$null = Clear-AzureRmContext -Scope Process | ||
Write-Host "##[command]Clear-AzureRmContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue" | ||
$null = Clear-AzureRmContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue |
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.
Wasn't there recommendation to actually to Set-AzureRMContext?
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.
The recommendation was to Select-AzureRmContext, but that will not resolve all issues. We are still under discussion with Azure PS team. In the meanwhile, this is the fix we have recognized.
* Clear azure rm context in initialize azure * resolve PR commets
* Clear azure rm context in initialize azure (#7778) * Clear azure rm context in initialize azure * resolve PR commets * clear context before azure stack * merge fix * AFC patch update
No description provided.