Recently I’ve been diving into the Windows Azure PowerShell Cmdlets published by Microsoft on CodePlex. First off, let me say that I think these tools are incredible powerful. They allow you easily automate the management of numerous components of the Windows Azure platform (including hosted services, storage, SQL Azure, and the Access Control Service). However as I began to really get into the API’s I found one feature was missing from cmdlets that involve managing hosted services. The feature is the ability to simply delete a deployment. Don’t misunderstand me, you can cobble several calls together to delete a deployment. Here’s what you would have to do:

 How to Delete A Deployment

Notice, you have to suspend the deployment first before you can remove it. Failing to put the deployment in a suspended state before attempting to remove it will result in an exception. Also notices you have to specify which slot you want to remove the deployment from.

While the above method, wouldn’t it be nicer if you could call something like Delete-Deployment that would perform both the suspend and remove operations? Taking it one step further, wouldn’t it be even nicer if you could call something like Delete-StagingDeployment and Delete-ProductionDeployment so you didn’t have to specify which slot you wanted to remove the deployment from in your arguments? Well I think so, and if you’re still reading you probably think so to. I decided to take action and create a repository on github to house scripts that contain functions to extend the tools provided by Microsoft. You can browse the repository here. Currently there are three scripts in the repository:

Deletes a deployment from a specified slot

Deletes a deployment from the production slot

Deletes a deployment from the staging slot

Each script is documented and contains examples which you can view when running in PowerShell by using the get-help command.

Once again, you can get the scripts here.

Hope this helps.


RBA Author

Leave a Reply