Nov 192015

Microsoft Azure PowerShell is a very powerful way to script deployment and tweaks to your environment in Azure. There are cmdlets for creating webapps, storage, and other resources. You can also use the PowerShell to automate modifications to app settings on your sites. The hardest part is getting started, so here are a few steps to take to give it a shot:

  1. Download Microsoft Azure PowerShell – You download the tool through the Microsoft Web Platform Installer.
  2. Launch the PowerShell and run the cmdlet Get-AzurePublishSettingsFile.  This will launch your default browser and take you to a page to download your Azure subscription file.  You need to do this step so that the PowerShell will have your credentials.Azure PowerShellAzure PowerShell Settings File
  3. Select your subscription and submit.  This will download your subscription file.
  4. Follow the instructions by running the Import-AzurePublishSettingsFile with the path to your settings file.  This will return the names and Ids of your environments.  You can now use this to run the many cmdlets available via Azure.

One other important thing to keep in mind for later, when you may be managing multiple Azure subscriptions, is that you need to make sure that the Azure Powershell has the subscription you want to work in set as the default.  To find out what subscription is set as default, run the command “Get-AzureSubscription”.  In my example, Powershell knows about two subscriptions that I have been working with.  You can see from this example, that Powershell knows about two subscriptions and that the Free Trial subscription is set as the default.


To switch to the other account so that my scripting will run against it instead of the Free Trial subscription, I had to run “Select-AzureSubscription”.  This allowed me to select my Pay-As-You-Go subscription by name.  Running “Get-AzureSubscription” after this showed that the Pay-As-You-Go subscription was select.  All subsequent commands acted upon this account.

This is (by no means) meant to be a complete post on all of the powerful things available via the Azure PowerShell, but rather is a quick start to get your settings file and get moving.  For more information, read up at the Azure PowerShell page.