imageFor more information on this Blog Series refer to this post: http://mythoughtsonit.com/2013/01/31-days-of-servers-in-the-cloud-windows-azure-iaas-and-you/
****************************

Managing your Cloud based servers in the Windows Azure IAAS web based management portal works great. It is the place to start out creating and managing servers, but if you want to automate and script your management or even do advanced management tasks that the portal doesn’t provide – then you need the Azure Command line tools. There are tools for Windows, Mac, and Linux. On Mac and Linux you run Java Script tools, but the most powerful tools are the Azure PowerShell tools that you run on Windows. Surprised? (update: PHP was added in addition to Java Script)

image
You can find those tools here: http://www.windowsazure.com/en-us/manage/downloads/

Lets walk through setting up the PowerShell tools for Windows Azure.

  1. Download the code from the link above and run the installer.
  2. Click on “Install” image
  3. Click on “I accept” image
  4. Watch the green bar as the installer downloads files (sorry no screenshots of the green bars)
  5. Watch the next green bar as the installer installs those files
  6. Click Finish

Great! We now we have the Windows Azure PowerShell cmdlets installed, but we can’t use them yet because we need to setup a secure connection to our Azure account. To do this we will use a certificate.

  1. The first thing we need to do is start a PowerShell Command prompt with Admin privileges. From the Start Screen type “power” then right click on the “Windows Azure PowerShell “ Icon. Then left click on run as Administrator.
     image
  2. Now type in the command “Get-AzurePublishSettingsFile” <enter>. This will launch a browser window to Azure where you will download the published settings file. Save it to c:\temp.
     image   image
  3. Now from the PowerShell commnad line run Import-AzurePublishSettingsFile to import the certificate and subscription information. “Import-AzurePublishSettingsfile c:\temp\your-filename.publishsettings”
    image
  4. That should do it. If you are having problems:
    – make sure your in an elevated PowerShell Prompt. (step 1)
    - You can try “Import-Module Azure” (this shouldn’t be needed)
    - You can try  “Set-ExecutionPolicy RemoteSigned”

You are now ready to manage your Azure Cloud Servers from PowerShell!

In my next post I will walk you through creating an Azure VM from PowerShell. Until then you can refer to this list of PowerShell commands you can now run against your Azure environment:
http://msdn.microsoft.com/en-us/library/windowsazure/jj152841

-Cheers