Skip to content

Instantly share code, notes, and snippets.

@averkinderen
Created September 5, 2017 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save averkinderen/11af0d59de4fc87b626e02a7e7fd613f to your computer and use it in GitHub Desktop.
Save averkinderen/11af0d59de4fc87b626e02a7e7fd613f to your computer and use it in GitHub Desktop.
Increase number of instances in a Azure scaleset
#################################################
# Author: Alexandre Verkinderen
# Company: cubesys
# date: 05/09/2017
################################################
#Login-AzureRmAccount
#region variables
#select resource Group
$rgName = ( Get-AzureRmResourceGroup | Out-GridView -Title "Select an Azure Resource Group ...and press Enter" -PassThru).ResourceGroupName
#Select Virtual Machine ScaleSet
$vmss = ( Get-AzureRmVmss -ResourceGroupName $rgName | Out-GridView -Title "Select a scale set ...and press Enter" -PassThru)
$capacity = Read-Host -Prompt 'Provide new capacity'
$caption = "Confirm"
$message = "Are you sure you want to increase the number of instances for scale set " + $vmss.Name + " from resource group " + $rgName
$yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes","help"
$no = new-Object System.Management.Automation.Host.ChoiceDescription "&No","help"
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
#endregion
$answer = $host.ui.PromptForChoice($caption,$message,$choices,0)
switch ($answer){
0 {
$vmss.sku.capacity = $capacity
Update-AzureRmVmss -ResourceGroupName $rgName -Name $vmss.Name -VirtualMachineScaleSet $vmss
}
1 {"You entered no"; break}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment