Microsoft Azure PowerShell – Resolving SubsctiptionID cannot be null

Share this:

We are going to work on a possible solution for the error  Get-AzureRMResourceGroup : ‘this.Client.SubscriptionID’ cannot be null. which can be caused by a disabled subscription.

Solution


After connecting to the Azure using PowerShell (if you need more details how to do that, please check it out this following Tutorial: http://itprocentral.com/connect-microsoft-azure-using-powershell/ ), and trying to list some configuration you can get the following error.

In our case, we were trying to list the Resource Group of the subscription.

image

That issue could be caused by a disabled subscription, a workaround is to list the current subscriptions using Get-AzureRmSubscription, and then select the given subscription using the ID field that was listed from the previous cmdlet.

After that, we just need to use the following cmdlet to connect to the subscription (pay attention to the warning message), and then the previous Get-AzureRMREsourceGroup will work.

Select-AzureRMSubscription <Subscription-ID>

image

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).