Add-AzureAccount issue: Your Azure credentials have not been set up or have expired

For some reason, I started experiencing this issue. Tried clearing the local cache, temp folders or cookies etc but none helped. So grabbed fiddler log to see what is going wrong. Noticed it was having the very old session token (3-4 months older) getting served for some reason and no clue where it lies also. Checked few command lets to clear this out within PS and noted Clear-AzureProfile flushed the older tokens which resolved this issue.

PS C:\WINDOWS\system32> Add-AzureAccount

Id Type Subscriptions Tenants

-- ---- ------------- ------- User xx-c5bc-xx-a7e0-xx{xxx-86f1-41af-91ab-xxxx}

PS C:\WINDOWS\system32> Get-AzureRoleSize

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

At line:1 char:1

+ Get-AzureRoleSize

+ ~~~~~~~~~~~~~~~~~

+ CategoryInfo : CloseError: (:) [Get-AzureRoleSize], ArgumentException

+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.AzureRoleSizeCommand



Run the Clear-AzureProfle Commandlet and then try Add-AzureAccount to get the valid bearer token to continue.

PS C:\WINDOWS\system32> Clear-AzureProfile –Force

Let me know if you see this issue and root cause for this.

Happy scripting…

Comments (4)

  1. Kathy Harwood says:

    You are my saviour - I was going absolutely mad with this exact same problem. Thank you so much.

  2. stej says:

    Helped a lot! Thanks for sharing.

  3. Karen says:

    Thank you so much, perfect solution. I think its because I've used Azure a few times on same machine with different subscriptions so it must have remembered something from previous one. Thank you

  4. RK Vedula says:

    Wow... Thank you very much 🙂

Skip to main content