Over the last few weeks I’ve been writing about Windows Azure IaaS.
- Step-By-Step: Setting up Network Access Control Lists (ACLs) in Azure
- Step-By-Step: Azure Networking
- Step-By-Step: Creating a Windows 2012 R2 Lab on Windows Azure
- Step-by-Step: Extending Windows Server 2012 Active Directory into the Cloud - Part 2
- Step-By-Step: Create a Site-to-Site VPN between your network and Azure
- Step-By-Step: Deploying Active Directory to Azure
- Step-By-Step: Migrating From VMware to Windows Azure
- Step-By-Step: Windows Azure - Back to the basics
So far, other that the ACL setting post, we’ve been using the portal to get everything done. I was thinking of how easy it was to automate the ACL settings using PowerShell. I thought this would make a good few post.
In my Lab environment I have the following setup
I created this lab using Windows Server 2012 R2 evaluation copies. You can find it here. and here are some free training on Azure.
- Introduction To Windows Azure Training
- Introduction to Private, Hybrid and Public Cloud
- Windows Azure for IT Pros Jump Start
Anyway, back to Managing Azure using PowerShell.
Install Windows Azure PowerShell
I installed the Windows Azure PowerShell module by running the Microsoft Web Platform Installer This is the easiest when you have an internet connection.
When prompted, click Run. The Microsoft Web Platform Installer loads, with the Windows Azure PowerShell module available for installation. The Web Platform Installer installs all dependencies for the Windows Azure PowerShell cmdlets.
Connect to your subscription
The PowerShell cmdlets require your subscription information so that it can be used to manage your services. As of the .0.7 release of the module, In order to do that I downloaded the management certificate that contains the information needed to connect PowerShell to my Azure subscription.
The Windows Azure PowerShell module includes cmdlets that help you download and import the certificate. I started PowerShell from the start Screen
and used the following cmdlet to setup access.
The Get-AzurePublishSettingsFile cmdlet opens a web page on the Windows Azure Management Portal, from which you can download the subscription information. The information is contained in a .publishsettings file.
- Once saved, I used the Import-AzurePublishSettingsFile to imports the .publishsettings file for use by the module. This file includes a management certificate that has security credentials.
Import-AzurePublishSettingsFile “C:\Users\administrator.CONTOSO\Downloads\Windows Azure MSDN - Visual Studio Ultimate-10-29-2013-credentials.publishsettings”
View account and subscription details
You can have multiple accounts and subscriptions available for use by Windows Azure PowerShell. You can add multiple accounts by running Add-AzureAccount more than once. To see the available accounts, type:
And to see subscription information, type:
Update your help files.
I’m always looking for help on the syntax for PowerShell cmdlets.
so to ensure I have the right files I just ran the following commands
And it updated all the help files.
We’re ready now to look at some scenarios for managing Azure using PowerShell.