AZURE boot CAMP POWERSHELL SAMPLES

May 10, 2011

powershellOver the past couple of days I gave several talks at the Windows Azure Boot Camp in Minneapolis. Most of these talks, and associated demos, were talks I had already given over the past four months as part of the boot camp series, with one notable exception. One of the last talks I give over the course of the two day boot camps has to do with Azure diagnostics and deployment models. Typically I just show a quick diagnostics demo of how to set up various diagnostic data sources and create scheduled transfers. Today I wanted to add another demo and show how to automate various aspects of deployment using Powershell. To do so I wrote five small scripts you can download here. The following is a description of each script included in the download:

start.ps1 – This script will start the current deployment in the Production slot.

suspend.ps1 – This script will stop the current deployment in the Production slot.

remove.ps1 – This script will delete the current deployment from the Production slot.

increase.ps1 – This script will increase the number of instances of the specified role in the Production slot by 1.

decrease.ps1 – This script will decrease the number of instances of the specified role in the Production slot by 1.

A few notes about the scripts:

  1. I am not a Powershell guru. Allow me to repeat I AM NOT A POWERSHELL GURU. I have no doubt these scripts could be written better, and I plan on improving them as my Powershell knowledge increases. However, I believe they serve the purpose of providing simple examples of how to leverage Powershell and Azure together.
  2. All of the scripts require you to specify the management certificate, subscription id, and service name of the deployment you want to manage. Make sure you update the scripts appropriately with your information.
  3. All of the scripts target the Production slot. If you want to change this to Staging simply replace Production with Staging in the appropriate script.
  4. These scripts don’t show you how to deploy to Production/Staging or how to perform a VIP swap. I’ll be creating scripts to do this over the next week or so.

Happy Powershelling!