Hello
Thank you for reaching out to Microsoft QnA Platform. I would like to share following troubleshooting steps/workarounds which might help in resolving the issue on hand.
- As a first step I would recommend you to make sure that you’re using the latest version of Azure PowerShell. If not, consider updating it.
- Try to execute
Clear-AzContext -Force
beforeConnect-AzAccount
. - Clear the cache and try running the following commands:
- Import-Module Az
- Connect-AzAccount.
- Try to connect using organizational ID credentials:
$Credential = Get-Credential
Connect-AzAccount -Credential $Credential
- Try to connect using interactive login to connect to a specific tenant and subscription:
Connect-AzAccount -Tenant 'xxxx-xxxx-xxxx-xxxx' -SubscriptionId 'yyyy-yyyy-yyyy-yyyy'
- Try to run your powershell as admin, update the module with Update-Module -Name Az, then login again.
- You may use "Connect-AzAccount -Identity -ErrorAction Stop" To catch the error.
For more information or switches that can be used to connect to Azure account please review following documentation: https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-11.2.0
I hope this answer helps to resolve your issue. Please "Accept the answer" if the information helped you. This will help us and others in the community as well.