I recently ran into a frustrating issue where I setup a new subscription in Azure and when I went to manage with Powershell I couldn’t see on the list that gets output from the following command:
Get-AzSubscription


The resulting list was only showing me a handful of subscriptions.
Figuring it to be a permissions issue I spent 20 minutes comparing my assigned roles for my user account and tried a few different things. This was fruitless.

I then updated Azure Powershell module to the latest version… also fruitless…

Then my admin brain kicked in and I thought… “Do I need to turn it off and back on again…?” i.e. I wonder if there is something cached somewhere…? A bit of google-fu later and I found this:

Clear-AzContext


Running this logs your powershell session out of everything azure (for the currently logged in user on the system you are working from). I did that, then logged back in and re-ran my commands.

Connect-AzAccount
Get-AzSubscription


Presto… all subscriptions showed up. Simple fix… but googling around for “Can’t see all my subscriptions in Azure Powershell” turned up absolutely nothing so I figured it is probably something obvious to most folks but all the same, I am documenting it here. Hope this helps!

REFERENCE:
https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/clear-azurermcontext

This post has no comments. Be the first to leave one!

Join the discussion

Your email address will not be published. Required fields are marked *