Thursday, November 29, 2012

Updating an Azure Service Project when Publishing fails

This post is for Windows Azure users who are using Windows Azure PowerShell cmdlets to fool around with your Azure Service's

Tally ho:
In case for some reason Publish-AzureServiceProject returns a bunch of cryptic errors that you don't care to understand. I would strongly recommend using Set-AzureDeployment.

Set-AzureDeployment requires a properly rebuilt cspkg Package. There are various ways that you can google to know how to rebuild the cspkg. I simply issue a Publish-AzureServiceProject command and when it reaches the uploading part, I ctrl-c and that exits the process prematurely without it going through the whole rigmarole and then getting stuck at those aforementioned cryptic errors.

Oh and make sure you use the -Force command when calling Set-AzureDeployment.

And here's a bloody good example (or so I like to think):

PS X:\ProjectsAndShit\MyServiceProjectFolder> set-azuredeployment -Upgrade -ServiceName "MyService" -Mode Auto -Package "X:\ProjectsAndShit\MyServiceProjectFolder\cloud_package.cspkg" -Configuration "X:\ProjectsAndShit\MyServiceProjectFolder\ServiceConfiguration.Cloud.cscfg" -Force

The above command (change paths and project name etc where ever applicable [like D'oh]) will do its mumbo jumbo and then ask you to enter a Slot. You have a choice, Production or Staging and you choose whatever the hell fits your bill. (Red pill/Blue pill sorta thing). Like so...

Slot: Production

That's it. Hope this helps you peoples!