Dhanuka777
Dhanuka777

Reputation: 8616

Is it possible to add a Scale Set to existing VNET

I have already created a VNet and subnet. Added other resources for this Vnet. Now I need to add a Scale Set to this subnet. Is this possible?

When I created a VM Scale Set from the Azure Portal, it does not ask for a VNet and it creates it's own VNet/subnet.

Upvotes: 0

Views: 1655

Answers (1)

Derek
Derek

Reputation: 837

Assume that you have all the resources need for the scale set configuration, below are the steps to create virtual machine scale set.

#IP configuration
$ipName = "IP configuration name"

#create the IP configuration
$ipConfig = New-AzureRmVmssIpConfig -Name $ipName -LoadBalancerBackendAddressPoolsId $null -SubnetId $vnet.Subnets[0].Id

$vmssConfig = "Scale set configuration name"

#create the configuration for the scale set
$vmss = New-AzureRmVmssConfig -Location $locName -SkuCapacity 3 -SkuName "Standard_A0" -UpgradePolicyMode "manual"

#Add the network interface configuration to the scale set configuration
Add-AzureRmVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $vmss -Name $vmssConfig -Primary $true -IPConfiguration $ipConfig

$vmssName = "scale set name"

#create the scale set 
New-AzureRmVmss -ResourceGroupName $rgName -Name $vmssName -VirtualMachineScaleSet $vmss

Refer to https://azure.microsoft.com/en-us/documentation/articles/virtual-machine-scale-sets-windows-create/ for step-by-step guidance.

Notice that you are using the latest version of Azure Powershell otherwise you will miss some Powershell cmdlets.

Hope this helps.

Upvotes: 1

Related Questions