Quantcast
Channel: key – marcelzehner.ch
Viewing all articles
Browse latest Browse all 9

Manage Windows Azure using PowerShell: Part 1 –“The Setup”

$
0
0

When companies start using Windows Azure it sooner or later comes to the situation that you want to use the same management tools to manage on premise VMs and apps and azure-based VMs and apps. No big deal: Microsoft delivers a PowerShell module for managing Windows Azure! Together with other cool things like the Azure integration in SCOM, the Azure SCORCH integration pack etc. you get a great toolset for managing hybrid infrastructures. In this article I will demonstrate the steps that are needed to bring the PowerShell module for Windows Azure to life.

Before we can use Azure PowerShell cmdlets we need to create a Windows Azure management certificate and assign it to an Azure subscription. There are multiple ways to do that, I will demonstrate how to create a self signed certificate using makecert.exe.

-sk “name” —> Subject key container name
-pe –> Marks private key as exportable
-ss “my” –> Certificate store used to sace the certificates/keys
-n “cn=name” –> Subject name

image

Once the certificate is created and stored in the defined container, we need to export the certificate to a file. Start mmc.exe and add the certificates snap-in. Choose the correct area from where certificates should be displayed. In this example I stored the certificate in the user personal store and therefore select “My User Account”. The certificate should be visible under “”Personal\Certificates” and can now be exported.

image

We only need the certificate, not the private key. This key needs to be stored in a safe place and will be used later when we connect to Windows Azure using PowerShell.

image

image

Select a path and file name to save the certificate.

image

The next step uploads this certificate to Windows Azure management certificates store. You can see those certificates using the Windows Azure management web site.

image

Now start the upload wizard and enter the path to the exported management certificate.

image

Done! Now you can download and install the Windows Azure PowerShell module from here. Now start the PowerShell module (by using the search term “PowerShell” or something). Use the cmdlet “Get-AzurePublishSettingsFile” to get the settings file from your Azure subscription that holds all the connection details. A Browser will automatically start and you need to login to Windows Azure. Save the file that automatically gets downloaded on your computer.

Depending on the system configuration you may need to change the execution policy by using the command “Set-ExecutionPolicy remotesigned”

image

Once the file is saved, import it using the cmdlet “Import-AzurePublishSettingsFile”.

image

Done! You can now start using the Azure PowerShell module. As a quick example I demonstrate how Azure VMs can be started.

– There are 2 stopped VMs

image

– Get all Azure VMs and start them (Get-AzureVM, Start-AzureVM)

image

– Check the result, VMs are starting/started

image

With that up and running you can now start manage your Azure VMs, applications etc. the same way as your on premise stuff. Pretty cool!

In the next post I will demonstrate some handy script to manage your Azure subscription, VMs etc. So make sure you don’t miss that!

Cheers
Marcel


Viewing all articles
Browse latest Browse all 9

Trending Articles