Step-By-Step: Manage Windows Azure using PowerShell

Step-By-Step: Manage Windows Azure using PowerShell

  • Comments 3
  • Likes

Hello folks,

Over the last few weeks I’ve been writing about Windows Azure IaaS.

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

image

I created this lab using Windows Server 2012 R2 evaluation copies.  You can find it here. and here are some free training on Azure.

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.

image

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

image

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.

image

  • 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”

image

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:

Get-AzureAccount

And to see subscription information, type:

Get-AzureSubscription

image

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

Update-Help

And it updated all the help files.

image

We’re ready now to look at some scenarios for managing Azure using PowerShell.

Cheers!

clip_image011

Pierre Roman | Technology Evangelist
Twitter | Facebook | LinkedIn

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Awesome Information. Thank you

  • Very helpful post.

  • And you forgot the mention the BEST Part.  Once you learn how to do it, You can keep a nice handy little pile of scripts on your USB key to do ALL the work for you (And then get home early but STILL bill for piles of Consulting hours!)

    :-)

    YEAH BABY! POWERSHELL ! :)

    Sean

    PowerShell MVP

    (and not allowed anywhere near the Coffee)