Worth posting  out there in  case you didn’t see the  new version of Cerebrata’s Azure Management Cmdlets. You can use this cmdlet to scale up/down your role instances with very minimal code! No need to modify manually from the Portal…

Set-RoleInstanceCount:

   1: Set-RoleInstanceCount -ServiceName $serviceName -Slot $slot -RoleName $roleName -InstanceCount $instanceCount -SubscriptionId $subscriptionId -Certificate $certificate –WaitToComplete

Here is a brief explanation of the parameters:

$subscriptionId

This is your Windows Azure subscription id which you can get from Windows Azure Portal.

$certificate

This is the API certificate. This must be uploaded already in Windows Azure Portal.

$serviceName

Name of your hosted service.

$slot

Slot (Production or Staging) in which your hosted service is currently deployed.

$roleName

Name of the role which you wish to scale up or down.

$instanceCount

This is the new instance count.

Once this cmdlet is executed, what it does is that it fetches the configuration file for you, updates the “Instances” node with new count value and then updates the configuration file.

Thanks for @gmantri for the update.

Related Articles: