Azure Get-AzureSubscription: Same SubscriptionName And Blank SubscriptionID

25 Oct

I was going to set up a new azure environment for a new customer with a powershell script when I encountered the following error:

Get-AzureVNetConfig : Value cannot be null.
Parametername: subscriptionId
At line:1 char:1
+ Get-AzureVNetConfig
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureVNetConfig], ArgumentNullException
+ FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVNetConfigCommand

It seems that I was too quick to start with the new environment. I had forgotten to download the latest publishsettings file which contains the new customer subscription.

What instead happened now was that it created a new subscription named “CUSTOMERNAME” with SubscriptionID blank.

I realized the mistake and downloaded the latest publishsettings file.

After the import I ran Get-AzureSubscription and then I had two subscriptions with the same name. The problem now was that every time I ran Select-AzureSubscription CUSTOMERNAME it would choose the wrong one with the empty SubscriptionId. Select-AzureSubscription only selects by name and not by subscription id.

Blank SubscriptionID

There are two solutions. Since the result from Get-AzureSubscription is stored in a local file and the azure commands use the subscription id we can manage the source file or the publishsettings file.

Solution 1 (the nice one) – Edit WindowsAzureProfile.xml
Got to C:\Users\UserName\AppData\Roaming\Windows Azure Powershell and open WindowsAzureProfile.xml
Look for:

<RegisteredResourceProviders xmlns:d4p1=”; />
<SubscriptionId i:nil=”true”

Remove everything that is included in, and the section (be safe and take a copy first):


Save, restart your powershell and run Get-AzureSubscription again. And voila! The faulty subscription is gone.

Solution 2 (the ugly one) – Edit the publishsettings file

Open up the file and find the subscription name CUSTOMERNAME. Rename it to CUSTOMERNAME2, save and exit. Import the publishsettings file again.
If you now use Select-AzureSubscription CUSTOMER2 and run Get-AzureVNetConfig it will work.

Leave a comment

Posted by on 2014-10-25 in Okategoriserade


Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Mark Brummel Blog | Microsoft Dynamics NAV

Master Classes Design Patterns and more...

ideas in the cloud

Goprowe AB

Reflections from the ERP field

ArcherPoint Developer Blog

Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for waldo's blog

Reflections from the ERP field

Nav Can Be Fun

Its Really Fun to Work with Microsoft Dynamics Nav / D365 Business Central


Reflections from the ERP field


Tips, Tricks, How-To's & News about Microsoft Dynamics NAV & Dynamics 365 for Financials

Kine's Info

Reflections from the ERP field

Just another site

NAV/SQL Performance - My Two Cents

Reflections from the ERP field – Applied Hacking

Reflections from the ERP field

Kauffmann @ Dynamics 365 Business Central

Reflections from the ERP field

Kriki’s Dynamics NAV blog

Reflections from the ERP field

Rashed Amini

Reflections from the ERP field

Olof Simren - Microsoft Dynamics NAV Blog

My blog about Microsoft Dynamic NAV tips and tricks. Remember to Subscribe!

Van Vugt's dynamiXs

Reflections from the ERP field

Navisionary – Dynamics NAV

Reflections from the ERP field

%d bloggers like this: