Created
September 5, 2017 03:03
-
-
Save averkinderen/11af0d59de4fc87b626e02a7e7fd613f to your computer and use it in GitHub Desktop.
Increase number of instances in a Azure scaleset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################# | |
# 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