Remember to Set Your Subscription When Using Azure PowerShell Tools

I was working through setting up a virtual network, Active Directory and SharePoint 2013 environment using this MSDN article.

One of the task is to reserve a static IP address for your AD server so that your domain controller always has the same IP address. You do this in PowerShell using the following command:

Get-AzureVM -ServiceName CloudServiceName -Name VMName | Set-AzureStaticVNetIP -IPAddress 10.0.0.4 | Update-AzureVM

In my case, this was failing for me and it wasn’t finding the service. After banging my head for 30 minutes, I realized that I had multiple subscriptions and the default one wasn’t the one that my VM and cloud service was located.

To find out what subscriptions you have, you can run the following powershell cmdlet:

Get-AzureSubscription

and this will report the subscriptions available. Before you run the command above, run the following powershell cmdlet:

Select-AzureSubscription

and then specify the specific subscription containing your VMs and other services.

Once you do this, then you can run the above command successfully.

Christopher Woodill

About ME

Enterprise technology leader for the past 15+ years…certified PMP, Six Sigma Black Belt and TOGAF Enterprise Architect. I collaborate with companies to help align their strategic objectives with concrete implementable technology strategies. I am Vice President, Enterprise Solutions for Klick Health.

Leave a Comment