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:
- Close any open PowerShell windows.
- Delete the XML files that are located under \%appdata%\Windows Azure Powershell.
- 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.