Your Azure credentials have not been set up or have expired

Sometimes you may see this kind of error on the PowerShell prompt, where an error message would be like, “Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials.”

Error Message
Error Message

This may persist even if you add azure account again or restart powershell prompt or restart windows as well. In such a case, you can use below command to first remove all existing azure account:

Get-AzureAccount | %{Remove-AzureAccount -Name $_.Id}

After this, run below command:

Clear-AzureProfile

This will remove all associated environments, subscriptions, and accounts. After this, you can add-azureaccount again to add your profile and be happy on your way. A quick google search indicates that if you are using two or more profile for Azure, sometimes corruption happens and same was case for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s