For 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)
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.
Download the code from the link above and run the installer.
Watch the green bar as the installer downloads files (sorry no screenshots of the green bars)
Watch the next green bar as the installer installs those files
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.
- 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.
- 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.
- Now from the PowerShell commnad line run Import-AzurePublishSettingsFile to import the certificate and subscription information. “Import-AzurePublishSettingsfile c:\temp\your-filename.publishsettings”
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: