Azure Deployment Follow-up

In my recent screencast on Azure deployment, I focused mainly on deploying manually through the Azure web interface.   You can also use the management API to deploy/configure/reconfigure your applications programmatically from your custom code or via powershell scripts.

The one thing you cannot do via the web interface that you can do programmatically is change the WAD (Windows Azure Diagnostics) performance counter and logging information.  This is really useful because many times, you profile an application for a given period of time and not all the time.

To do this, you need to first configure a certificate that will be used to control access to the management API and send it with every request to the REST-based API (for example, when uploading a package).  The easiest way to create a self signed certificate is with the makecert utility included in the Windows SDK:

makecert -r -pe -a sha1 -n "CN=Azure Service Management" -ss My -len 2048 -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 AzureServiceManagement.cer

The public key is then uploaded to your Azure account via the web interface:

image

If you’re looking for powershell examples, check out the Azure Powershell CmdLets in the resources I list below.   For example, you could write a simple powershell script to take your deployment, upload it to Azure Storage, update the staging slot, and start the service by doing something like:

$cert = Get-Item cert:\CurrentUser\My\{thumbprint}
$sub = "{subscription GUID}"
$servicename = "service name"
$package = "CloudApp.cspkg"
$config = "ServiceConfiguration.cscfg"

[DateTime]$datelabel = Get-Date
$lbl = $datelabel.ToString("MM-dd-yyyy-HH:mm")

Write-Host "Label for deployment: " $lbl

Add-PSSnapin AzureManagementToolsSnapIn

Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
New-Deployment -Slot Staging $package $config -Label $lbl |
Get-OperationStatus -WaitToComplete

Get-Deployment staging -serviceName $servicename -SubscriptionId $sub -Certificate $cert |
Set-DeploymentStatus running |
Get-OperationStatus -WaitToComplete

Alternatively, check out the Windows Azure code samples (reference below) for doing this via C#.  Two immediate possibilities are:  ease in deploying applications, configuring performance counters, and scaling applications by adjusting the number of instances on the fly.

Resources:

MSDN API Reference

Azure Powershell CmdLets

Windows Azure Code Samples – Specifically, CSManage.exe

Comments are closed

My Apps

Dark Skies Astrophotography Journal Vol 1 Explore The Moon
Mars Explorer Moons of Jupiter Messier Object Explorer
Brew Finder Earthquake Explorer Venus Explorer  

My Worldmap

Month List