Setting up Azure PowerShell and connecting it to your Azure Subscriptions

Start by installing Azure PowerShell on your system. I have it installed on a Windows 2008 r2 server and a Windows 7 laptop, it works fine on either. The install files can be found at the following location.

http://www.windowsazure.com/en-us/downloads/?fb=en-us

When you open the website browse to the area below and go to the “Command Line Tools” area. Click on the Windows Azure Powershell icon. Depending on the status of your system it may require a reboot or two.

Once everything is installed you can go to Start -> Programs and open Windows Azure PowerShell

It will open up a PowerShell command prompt and look like this.

First step is to type the following command

Import-Module “C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1”

Running it will look like the following. It will import all the necessary modules in.

Next step will be to get a copy of the Azure publishing file. When you run the following command it will bring you to an Azure login page.

PS C:> Get-AzurePublishSettingsFile

When the page opens you will need to log in with your Azure ID and the following page will appear. There will be a file download prompt at the bottom of the site. The file will be called something like “SubscriptionA- SubscriptionB- SubscriptionC-5-05-2013-credentials.publishsetting”. Save the file to the location of your choice.

After you’ve saved the file to your system run the following command to import it. Once the file imports you will have connectivity from PowerShell to your Azure subscription.

PS C:> Import-AzurePublishSettingsFile c:\location\filename.publishsettings

The results will look like this.

PS C:> Import-AzurePublishSettingsFile C:\files\SubscriptionASubscriptionB– SubscriptionC-5-05-2013-credentials.publishsettings

VERBOSE: Setting: SubscriptionA as the default and current subscription. To view other subscriptions use Get-AzureSubscription

Running the following command will list the details of all your Azure subscriptions

PS C:> Get-AzureSubscription

SubscriptionName : SubscriptionA

SubscriptionId : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Certificate : [Subject]

CN=Windows Azure Tools

[Issuer]

CN=Windows Azure Tools

[Serial Number]

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[Not Before]

5/5/2013 10:11:33 AM

[Not After]

5/5/2014 10:11:33 AM

[Thumbprint]

Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Now you can run all of your Azure tasks via PowerShell instead of the console. Details of the Azure PowerShell commands we use moving forward will be posted shortly.

Share Button
Author: JA


Leave a Reply

Your email address will not be published. Required fields are marked *