Share via


Get-AzureVM: Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials

Azure is a pretty sweet cloud environment, with a powerful management portal to help you drive ops.  But the management portal isn't enough when it comes to quickly scaling up operations. PowerShell is available from a DevOps perspective to script a large variety of tasks. Sometimes though, you get some strange errors out of PowerShell cmdlets.

I was running the Get-AzureVM cmdlet and got the error - "Your Azure credentials have not been set up or have expired, please run Add-AzureAccount to set up your Azure credentials" . Which was frustrating to me, as I was sure the Azure account I had selected using Select-AzureSubscription in my account was valid.  I had setup several websites and a storage account in it earlier in the year.

Running Add-AzureAccount did nothing to resolve the error.  Creds were stored and visible via Get-AzureSubscription cmdlet.  I was at a wall. Then I took a step back.

Resolution - Login to the Azure portal and check your account status. Mine was still in the "welcome wizard" even though I already had a few websites running in it. Walking through the wizard cleared up the message and now the scripts run successfully.

Here's to the SEO god, may this post help some other person not spend an hour wrestling out of an awkward situation.

Additional keywords: Select-AzureSubscription Get-AzureVM FullyQualifiedErrorId Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand

Comments

  • Anonymous
    March 06, 2015
    sorry, I was wrong, your topic is good

  • Anonymous
    March 30, 2015
    Alright Joe, I'm getting the same issue, but my account status is Active.  What next?

  • Anonymous
    March 30, 2015
    @alex - pop me an email to jhealy at Microsoft dot com ...  Lets see where it can go.

  • Anonymous
    April 01, 2015
    I had the same error and it was caused by the newest versions of Azure PowerShell. I had to install back to version 8.14 (February 2015) in order for it to work. az412849.vo.msecnd.net/.../azure-powershell.0.8.14.msi

  • Anonymous
    April 01, 2015
    @veaziemi19 - great tip.  thanks for sharing..

  • Anonymous
    April 09, 2015
    @veaziemi19 - thanks, this was the solution to my problem as well :)

  • Anonymous
    April 15, 2015
    Got same problem. However my account status - active. Installing powershell tools from Feb 2015 got message that I already have newer tools and it won't do anything. Any other ideas what can I do to make by account working?

  • Anonymous
    April 15, 2015
    I found an article about that issue: www.heukels.nz/.../your-azure-credentials-have-not-been.html So, I removed azure account and when I try to add it back it says: Add-AzureAccount : The given key was not present in the dictionary.

  • Anonymous
    April 15, 2015
    Managed to fix the issue. Basically for me it was:

  1. Remove-AzureAccount (for all accounts)
  2. Clear-AzureProfile
  3. Add-AzureAccount
  • Anonymous
    April 15, 2015
    @dmytro - thanks for shareing.  this is an awkward process to figure out whats going wrong, and all tips are welcome!

  • Anonymous
    June 03, 2015
    adding Clear-AzureProfile before the Add-AzureAccount cleared up my script where I was having this issue; I never had to do this before but I am juggling several Azure accounts

  • Anonymous
    August 06, 2015
    As mentioned, this issue is the result of having more than one Azure account setup with a instance of Azure PowerShell on a PC. Run 'Get-AzureAccount' to see what subscriptions are associated with the Azure PowerShell instance on your PC.  Then, run 'foreach ($AzureAccount in (Get-AzureAccount).ID) {Remove-AzureAccount $AzureAccount}' to remove all of those accounts.  Finally, use the 'Add-AzureAccount' command to add the one and only one Azure Subscription that you wish to access with your instance of Azure PowerShell (running your machine.)  This method resolved the issue for us.

  • Anonymous
    October 25, 2015
    Thanks, this worked:

  1. Remove-AzureAccount (for all accounts)
  2. Clear-AzureProfile
  3. Add-AzureAccount
  • Anonymous
    November 18, 2015
    Thanks for posting and to everyone for the comments.  Clear-AzureProfile did the trick for me.

  • Anonymous
    December 04, 2015
    The comment has been removed

  • Anonymous
    December 30, 2015
    thanks veaziemi19 - none of the other options worked for me.  I loaded 8.14 version (removed Nov. version) and is working.  must be an ongoing bug in versions past 8.14 - who can ask for the fix?