Clear Azure Subscriptions with No ID from PowerShell

Solve the problem of an Azure subscription with no ID in PowerShell.

John Savill

August 29, 2014

1 Min Read
clouds

Q: I'm using PowerShell with Azure, but I have a subscription with no subscription ID. How do I clear that subscription from Azure?

A: I've seen a few environments that have a subscription as part of the environment, with no subscription ID. This doesn't actually work when you try to run PowerShell against it. The exact cause is unclear; however, running the following command will confirm the details of all known subscriptions.

Get-AzureSubscription | ft SubscriptionName, SubscriptionID, IsDefault -AutoSize

You can then use Select-AzureSubscription to choose a subscription. If you see a result with no subscriptionID, you'll need to clean up your environment as follows:

  1. Close any open PowerShell windows.

  2. Delete the XML files that are located under %appdata%Windows Azure Powershell.

  3. Open PowerShell again and re-add PowerShell subscriptions using either Add-AzureAccount (preferred because it doesn't rely on management certificates and it uses Azure Active Directory for authentication) or Get-AzurePublishSettingsFile/Import-AzurePublishSettingsFile.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like