< Back
New-AzureRmVmss
Post
NAME New-AzureRmVmss
SYNOPSIS
Creates a VMSS.
SYNTAX
New-AzureRmVmss [[-ResourceGroupName] <String>] [-VMScaleSetName] <String> [-AllocationMethod {Static | Dynamic}] [-AsJob] [-BackendPoolName
<String>] [-BackendPort <Int32[]>] -Credential <PSCredential> [-DataDiskSizeInGb <Int32[]>] [-DefaultProfile <IAzureContextContainer>]
[-DomainNameLabel <String>] [-FrontendPoolName <String>] [-ImageName <String>] [-InstanceCount <Int32>] [-LoadBalancerName <String>] [-Location
<String>] [-NatBackendPort <Int32[]>] [-PublicIpAddressName <String>] [-SecurityGroupName <String>] [-SubnetAddressPrefix <String>] [-SubnetName
<String>] [-UpgradePolicyMode {Automatic | Manual | Rolling}] [-VirtualNetworkName <String>] [-VmSize <String>] [-VnetAddressPrefix <String>]
[-Zone <System.Collections.Generic.List`1[System.String]>] [-Confirm] [-WhatIf] [<CommonParameters>]
New-AzureRmVmss [-ResourceGroupName] <String> [-VMScaleSetName] <String> [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet> [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-AzureRmVmss cmdlet creates a Virtual Machine Scale Set (VMSS) in Azure. This cmdlet takes a VirtualMachineScaleSet object as input.
PARAMETERS
-AllocationMethod <String>
Allocation method for the Public IP Address of the Scale Set (Static or Dynamic). If no value is supplied, allocation will be static.
Required? false
Position? named
Default value Static
Accept pipeline input? False
Accept wildcard characters? false
-AsJob [<SwitchParameter>]
Run cmdlet in the background and return a Job to track progress.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-BackendPoolName <String>
The name of the backend address pool to use in the load balancer for this Scale Set. If no value is provided, a new backend pool will be
created, with the same name as the Scale Set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-BackendPort <Int32[]>
Backend port numbers used by the Scale Set load balancer to communicate with VMs in the Scale Set. If no values are specified, ports 3389 and
5985 will be used for Windows VMS, and port 22 will be used for Linux VMs.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Credential <PSCredential>
The administrator credentials (username and password) for VMs in this Scale Set.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DataDiskSizeInGb <Int32[]>
Specifies the sizes of data disks in GB.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DomainNameLabel <String>
The domain name label for the public Fully-Qualified domain name (FQDN) for this Scale Set. This is the first component of the domain name
that is automatically assiged to the Scale Set. Automatically assigned Domain names use the form
(<DomainNameLabel>.<Location>.cloudapp.azure.com). If no value is supplied, the default domain name label will be the concatenation of
<ScaleSetName> and <ResourceGroupName>.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-FrontendPoolName <String>
The name of the frontend address pool to usein the Scale Set locad balancer. If no value is supplied, a new Frontend Address Pool will be
created, with the same name as the scale set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ImageName <String>
The name of the image for VMs in this Scale Set. If no value is provided, the "Windows Server 2016 DataCenter" image will be used.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-InstanceCount <Int32>
The number of VM images in the Scale Set. If no value is provided, 2 instances will be created.
Required? false
Position? named
Default value 2
Accept pipeline input? False
Accept wildcard characters? false
-LoadBalancerName <String>
The name of the load balancer to use with this Scale Set. A new load balancer using the same name as the Scale Set will be created if no
value is specified.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Location <String>
The Azure location where this Scale Set will be created. If no value is specified, the location will be inferred from the location of other
resources referenced in the parameters.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NatBackendPort <Int32[]>
Backend port for inbound network address translation.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PublicIpAddressName <String>
The name of the public IP Address to use with this scale set. A new Public IPAddress with the same name as the Scale Set will be created if
no value is provided.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ResourceGroupName <String>
Specifies the name of the resource group of the VMSS. If no value is specified, a new ResourceGroup will be created using the same name as
the Scale Set.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-SecurityGroupName <String>
The name of the network security group to apply to this Scale Set. If no value is provided, a default network security group with the same
name as the Scale Set will be created and applied to the Scale Set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SubnetAddressPrefix <String>
The address prefix of the Subnet this ScaleSet will use. Default Subnet settings (192.168.1.0/24) will be applied if no value is provided.
Required? false
Position? named
Default value 192.168.1.0/24
Accept pipeline input? False
Accept wildcard characters? false
-SubnetName <String>
The name of the subnet to use with this Scale Set. A new Subnet will be created with the same name as the Scale Set if no value is provided.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-UpgradePolicyMode <UpgradeMode>
The upgrade policy mode for VM instances in this Scale Set. Upgrade policy could specify Automatic, Manual, or Rolling upgrades.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VirtualMachineScaleSet <PSVirtualMachineScaleSet>
Specifies the VirtualMachineScaleSet object that contains the properties of the VMSS that this cmdlet creates.
Required? true
Position? 3
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-VirtualNetworkName <String>
The name fo the Virtual Network to use with this scale set. If no value is supplied, a new virtual network with the same name as the Scale
Set will be created.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VMScaleSetName <String>
Specifies the name of the VMSS that this cmdlet creates.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VmSize <String>
The size of the VM instances in this scale set. A default size (Standard_DS1_v2) will be used if no Size is specified.
Required? false
Position? named
Default value Standard_DS1_v2
Accept pipeline input? False
Accept wildcard characters? false
-VnetAddressPrefix <String>
The address prefix for the virtual network used with this Scale Set. Default virtual network address prefix settings (192.168.0.0/16) will be
used if no value is supplied.
Required? false
Position? named
Default value 192.168.0.0/16
Accept pipeline input? False
Accept wildcard characters? false
-Zone <System.Collections.Generic.List`1[System.String]>
A list of availability zones denoting the IP allocated for the resource needs to come from.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
VirtualMachineScaleSet
Parameter 'VirtualMachineScaleSet' accepts value of type 'VirtualMachineScaleSet' from the pipeline
OUTPUTS
This cmdlet does not generate any output.
NOTES
Example 1: Create a VMSS
# Common
$LOC = "WestUs";
$RGName = "rgkyvms";
New-AzureRmResourceGroup -Name $RGName -Location $LOC -Force;
# SRP
$STOName = "STO" + $RGName;
$STOType = "Standard_GRS";
New-AzureRmStorageAccount -ResourceGroupName $RGName -Name $STOName -Location $LOC -Type $STOType;
$STOAccount = Get-AzureRmStorageAccount -ResourceGroupName $RGName -Name $STOName;
# NRP
$SubNet = New-AzureRmVirtualNetworkSubnetConfig -Name ("subnet" + $RGName) -AddressPrefix "10.0.0.0/24";
$VNet = New-AzureRmVirtualNetwork -Force -Name ("vnet" + $RGName) -ResourceGroupName $RGName -Location $LOC -AddressPrefix "10.0.0.0/16"
-DnsServer "10.1.1.1" -Subnet $SubNet;
$VNet = Get-AzureRmVirtualNetwork -Name ('vnet' + $RGName) -ResourceGroupName $RGName;
$SubNetId = $VNet.Subnets[0].Id;
$PubIP = New-AzureRmPublicIpAddress -Force -Name ("PubIP" + $RGName) -ResourceGroupName $RGName -Location $LOC -AllocationMethod Dynamic
-DomainNameLabel ("PubIP" + $RGName);
$PubIP = Get-AzureRmPublicIpAddress -Name ("PubIP" + $RGName) -ResourceGroupName $RGName;
# Create LoadBalancer
$FrontendName = "fe" + $RGName
$BackendAddressPoolName = "bepool" + $RGName
$ProbeName = "vmssprobe" + $RGName
$InboundNatPoolName = "innatpool" + $RGName
$LBRuleName = "lbrule" + $RGName
$LBName = "vmsslb" + $RGName
$Frontend = New-AzureRmLoadBalancerFrontendIpConfig -Name $FrontendName -PublicIpAddress $PubIP
$BackendAddressPool = New-AzureRmLoadBalancerBackendAddressPoolConfig -Name $BackendAddressPoolName
$Probe = New-AzureRmLoadBalancerProbeConfig -Name $ProbeName -RequestPath healthcheck.aspx -Protocol http -Port 80 -IntervalInSeconds 15
-ProbeCount 2
$InboundNatPool = New-AzureRmLoadBalancerInboundNatPoolConfig -Name $InboundNatPoolName -FrontendIPConfigurationId `
$Frontend.Id -Protocol Tcp -FrontendPortRangeStart 3360 -FrontendPortRangeEnd 3362 -BackendPort 3370;
$LBRule = New-AzureRmLoadBalancerRuleConfig -Name $LBRuleName `
-FrontendIPConfiguration $Frontend -BackendAddressPool $BackendAddressPool `
-Probe $Probe -Protocol Tcp -FrontendPort 80 -BackendPort 80 `
-IdleTimeoutInMinutes 15 -EnableFloatingIP -LoadDistribution SourceIP;
$ActualLb = New-AzureRmLoadBalancer -Name $LBName -ResourceGroupName $RGName -Location $LOC `
-FrontendIpConfiguration $Frontend -BackendAddressPool $BackendAddressPool `
-Probe $Probe -LoadBalancingRule $LBRule -InboundNatPool $InboundNatPool;
$ExpectedLb = Get-AzureRmLoadBalancer -Name $LBName -ResourceGroupName $RGName
# New VMSS Parameters
$VMSSName = "VMSS" + $RGName;
$AdminUsername = "Admin01";
$AdminPassword = "p4ssw0rd@123" + $RGName;
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$Sku = "2012-R2-Datacenter"
$Version = "latest"
$VHDContainer = "https://" + $STOName + ".blob.core.contoso.net/" + $VMSSName;
$ExtName = "CSETest";
$Publisher = "Microsoft.Compute";
$ExtType = "BGInfo";
$ExtVer = "2.1";
#IP Config for the NIC
$IPCfg = New-AzureRmVmssIPConfig -Name "Test" `
-LoadBalancerInboundNatPoolsId $ExpectedLb.InboundNatPools[0].Id `
-LoadBalancerBackendAddressPoolsId $ExpectedLb.BackendAddressPools[0].Id `
-SubnetId $SubNetId;
#VMSS Config
$VMSS = New-AzureRmVmssConfig -Location $LOC -SkuCapacity 2 -SkuName "Standard_A2" -UpgradePolicyMode "Automatic" `
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name "Test" -Primary $True -IPConfiguration $IPCfg `
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name "Test2" -IPConfiguration $IPCfg `
| Set-AzureRmVmssOSProfile -ComputerNamePrefix "Test" -AdminUsername $AdminUsername -AdminPassword $AdminPassword `
| Set-AzureRmVmssStorageProfile -Name "Test" -OsDiskCreateOption 'FromImage' -OsDiskCaching "None" `
-ImageReferenceOffer $Offer -ImageReferenceSku $Sku -ImageReferenceVersion $Version `
-ImageReferencePublisher $PublisherName -VhdContainer $VHDContainer `
| Add-AzureRmVmssExtension -Name $ExtName -Publisher $Publisher -Type $ExtType -TypeHandlerVersion $ExtVer -AutoUpgradeMinorVersion $True
#Create the VMSS
New-AzureRmVmss -ResourceGroupName $RGName -Name $VMSSName -VirtualMachineScaleSet $VMSS;
The following complex example creates a VMSS. The first command creates a resource group with the specified name and location. The second command
uses the New-AzureRmStorageAccount cmdlet to create a storage account. The third command then uses the Get-AzureRmStorageAccount cmdlet to get the
storage account created in the second command and stores the result in the $STOAccount variable. The fifth command uses the
New-AzureRmVirtualNetworkSubnetConfig cmdlet to create a subnet and stores the result in the variable named $SubNet. The sixth command uses the
New-AzureRmVirtualNetwork cmdlet to create a virtual network and stores the result in the variable named $VNet. The seventh command uses the
Get-AzureRmVirtualNetwork to get information about the virtual network created in the sixth command and stores the information in the variable
named $VNet. The eighth and ninth command uses the New-AzureRmPublicIpAddress and Get- AzureRmPublicIpAddress to create and get information from
that public IP address. The commands store the information in the variable named $PubIP. The tenth command uses the New-
AzureRmLoadBalancerFrontendIpConfig cmdlet to create a frontend load balancer and stores the result in the variable named $Frontend. The eleventh
command uses the New-AzureRmLoadBalancerBackendAddressPoolConfig to create a backend address pool configuration and stores the result in the
variable named $BackendAddressPool. The twelfth command uses the New-AzureRmLoadBalancerProbeConfig to create a probe and stores the probe
information in the variable named $Probe. The thirteenth command uses the New-AzureRmLoadBalancerInboundNatPoolConfig cmdlet to create a load
balancer inbound network address translation (NAT) pool configuration. The fourteenth command uses the New-AzureRmLoadBalancerRuleConfig to create
a load balancer rule configuration and stores the result in the variable named $LBRule. The fifteenth command uses the New-AzureRmLoadBalancer
cmdlet to create a load balancer and stores the result in the variable named $ActualLb. The sixteenth command uses the Get-AzureRmLoadBalancer to
get information about the load balancer that was created in the fifteenth command and stores the information in the variable named $ExpectedLb.
The seventeenth command uses the New-AzureRmVmssIPConfig cmdlet to create a VMSS IP configuration and stores the information in the variable named
$IPCfg. The eighteenth command uses the New-AzureRmVmssConfig cmdlet to create a VMSS configuration object and stores the result in the variable
named $VMSS. The nineteenth command uses the New-AzureRmVmss cmdlet to create the VMSS.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... zurermvmss
Get-AzureRmVmssDiskEncryption
Remove-AzureRmVmss
Restart-AzureRmVmss
Set-AzureRmVmss
Restart-AzureRmVmss
Stop-AzureRmVmss
Update-AzureRmVmss
SYNOPSIS
Creates a VMSS.
SYNTAX
New-AzureRmVmss [[-ResourceGroupName] <String>] [-VMScaleSetName] <String> [-AllocationMethod {Static | Dynamic}] [-AsJob] [-BackendPoolName
<String>] [-BackendPort <Int32[]>] -Credential <PSCredential> [-DataDiskSizeInGb <Int32[]>] [-DefaultProfile <IAzureContextContainer>]
[-DomainNameLabel <String>] [-FrontendPoolName <String>] [-ImageName <String>] [-InstanceCount <Int32>] [-LoadBalancerName <String>] [-Location
<String>] [-NatBackendPort <Int32[]>] [-PublicIpAddressName <String>] [-SecurityGroupName <String>] [-SubnetAddressPrefix <String>] [-SubnetName
<String>] [-UpgradePolicyMode {Automatic | Manual | Rolling}] [-VirtualNetworkName <String>] [-VmSize <String>] [-VnetAddressPrefix <String>]
[-Zone <System.Collections.Generic.List`1[System.String]>] [-Confirm] [-WhatIf] [<CommonParameters>]
New-AzureRmVmss [-ResourceGroupName] <String> [-VMScaleSetName] <String> [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet> [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-AzureRmVmss cmdlet creates a Virtual Machine Scale Set (VMSS) in Azure. This cmdlet takes a VirtualMachineScaleSet object as input.
PARAMETERS
-AllocationMethod <String>
Allocation method for the Public IP Address of the Scale Set (Static or Dynamic). If no value is supplied, allocation will be static.
Required? false
Position? named
Default value Static
Accept pipeline input? False
Accept wildcard characters? false
-AsJob [<SwitchParameter>]
Run cmdlet in the background and return a Job to track progress.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-BackendPoolName <String>
The name of the backend address pool to use in the load balancer for this Scale Set. If no value is provided, a new backend pool will be
created, with the same name as the Scale Set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-BackendPort <Int32[]>
Backend port numbers used by the Scale Set load balancer to communicate with VMs in the Scale Set. If no values are specified, ports 3389 and
5985 will be used for Windows VMS, and port 22 will be used for Linux VMs.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Credential <PSCredential>
The administrator credentials (username and password) for VMs in this Scale Set.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DataDiskSizeInGb <Int32[]>
Specifies the sizes of data disks in GB.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DomainNameLabel <String>
The domain name label for the public Fully-Qualified domain name (FQDN) for this Scale Set. This is the first component of the domain name
that is automatically assiged to the Scale Set. Automatically assigned Domain names use the form
(<DomainNameLabel>.<Location>.cloudapp.azure.com). If no value is supplied, the default domain name label will be the concatenation of
<ScaleSetName> and <ResourceGroupName>.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-FrontendPoolName <String>
The name of the frontend address pool to usein the Scale Set locad balancer. If no value is supplied, a new Frontend Address Pool will be
created, with the same name as the scale set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ImageName <String>
The name of the image for VMs in this Scale Set. If no value is provided, the "Windows Server 2016 DataCenter" image will be used.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-InstanceCount <Int32>
The number of VM images in the Scale Set. If no value is provided, 2 instances will be created.
Required? false
Position? named
Default value 2
Accept pipeline input? False
Accept wildcard characters? false
-LoadBalancerName <String>
The name of the load balancer to use with this Scale Set. A new load balancer using the same name as the Scale Set will be created if no
value is specified.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Location <String>
The Azure location where this Scale Set will be created. If no value is specified, the location will be inferred from the location of other
resources referenced in the parameters.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NatBackendPort <Int32[]>
Backend port for inbound network address translation.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PublicIpAddressName <String>
The name of the public IP Address to use with this scale set. A new Public IPAddress with the same name as the Scale Set will be created if
no value is provided.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ResourceGroupName <String>
Specifies the name of the resource group of the VMSS. If no value is specified, a new ResourceGroup will be created using the same name as
the Scale Set.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-SecurityGroupName <String>
The name of the network security group to apply to this Scale Set. If no value is provided, a default network security group with the same
name as the Scale Set will be created and applied to the Scale Set.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SubnetAddressPrefix <String>
The address prefix of the Subnet this ScaleSet will use. Default Subnet settings (192.168.1.0/24) will be applied if no value is provided.
Required? false
Position? named
Default value 192.168.1.0/24
Accept pipeline input? False
Accept wildcard characters? false
-SubnetName <String>
The name of the subnet to use with this Scale Set. A new Subnet will be created with the same name as the Scale Set if no value is provided.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-UpgradePolicyMode <UpgradeMode>
The upgrade policy mode for VM instances in this Scale Set. Upgrade policy could specify Automatic, Manual, or Rolling upgrades.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VirtualMachineScaleSet <PSVirtualMachineScaleSet>
Specifies the VirtualMachineScaleSet object that contains the properties of the VMSS that this cmdlet creates.
Required? true
Position? 3
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-VirtualNetworkName <String>
The name fo the Virtual Network to use with this scale set. If no value is supplied, a new virtual network with the same name as the Scale
Set will be created.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VMScaleSetName <String>
Specifies the name of the VMSS that this cmdlet creates.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VmSize <String>
The size of the VM instances in this scale set. A default size (Standard_DS1_v2) will be used if no Size is specified.
Required? false
Position? named
Default value Standard_DS1_v2
Accept pipeline input? False
Accept wildcard characters? false
-VnetAddressPrefix <String>
The address prefix for the virtual network used with this Scale Set. Default virtual network address prefix settings (192.168.0.0/16) will be
used if no value is supplied.
Required? false
Position? named
Default value 192.168.0.0/16
Accept pipeline input? False
Accept wildcard characters? false
-Zone <System.Collections.Generic.List`1[System.String]>
A list of availability zones denoting the IP allocated for the resource needs to come from.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
VirtualMachineScaleSet
Parameter 'VirtualMachineScaleSet' accepts value of type 'VirtualMachineScaleSet' from the pipeline
OUTPUTS
This cmdlet does not generate any output.
NOTES
Example 1: Create a VMSS
# Common
$LOC = "WestUs";
$RGName = "rgkyvms";
New-AzureRmResourceGroup -Name $RGName -Location $LOC -Force;
# SRP
$STOName = "STO" + $RGName;
$STOType = "Standard_GRS";
New-AzureRmStorageAccount -ResourceGroupName $RGName -Name $STOName -Location $LOC -Type $STOType;
$STOAccount = Get-AzureRmStorageAccount -ResourceGroupName $RGName -Name $STOName;
# NRP
$SubNet = New-AzureRmVirtualNetworkSubnetConfig -Name ("subnet" + $RGName) -AddressPrefix "10.0.0.0/24";
$VNet = New-AzureRmVirtualNetwork -Force -Name ("vnet" + $RGName) -ResourceGroupName $RGName -Location $LOC -AddressPrefix "10.0.0.0/16"
-DnsServer "10.1.1.1" -Subnet $SubNet;
$VNet = Get-AzureRmVirtualNetwork -Name ('vnet' + $RGName) -ResourceGroupName $RGName;
$SubNetId = $VNet.Subnets[0].Id;
$PubIP = New-AzureRmPublicIpAddress -Force -Name ("PubIP" + $RGName) -ResourceGroupName $RGName -Location $LOC -AllocationMethod Dynamic
-DomainNameLabel ("PubIP" + $RGName);
$PubIP = Get-AzureRmPublicIpAddress -Name ("PubIP" + $RGName) -ResourceGroupName $RGName;
# Create LoadBalancer
$FrontendName = "fe" + $RGName
$BackendAddressPoolName = "bepool" + $RGName
$ProbeName = "vmssprobe" + $RGName
$InboundNatPoolName = "innatpool" + $RGName
$LBRuleName = "lbrule" + $RGName
$LBName = "vmsslb" + $RGName
$Frontend = New-AzureRmLoadBalancerFrontendIpConfig -Name $FrontendName -PublicIpAddress $PubIP
$BackendAddressPool = New-AzureRmLoadBalancerBackendAddressPoolConfig -Name $BackendAddressPoolName
$Probe = New-AzureRmLoadBalancerProbeConfig -Name $ProbeName -RequestPath healthcheck.aspx -Protocol http -Port 80 -IntervalInSeconds 15
-ProbeCount 2
$InboundNatPool = New-AzureRmLoadBalancerInboundNatPoolConfig -Name $InboundNatPoolName -FrontendIPConfigurationId `
$Frontend.Id -Protocol Tcp -FrontendPortRangeStart 3360 -FrontendPortRangeEnd 3362 -BackendPort 3370;
$LBRule = New-AzureRmLoadBalancerRuleConfig -Name $LBRuleName `
-FrontendIPConfiguration $Frontend -BackendAddressPool $BackendAddressPool `
-Probe $Probe -Protocol Tcp -FrontendPort 80 -BackendPort 80 `
-IdleTimeoutInMinutes 15 -EnableFloatingIP -LoadDistribution SourceIP;
$ActualLb = New-AzureRmLoadBalancer -Name $LBName -ResourceGroupName $RGName -Location $LOC `
-FrontendIpConfiguration $Frontend -BackendAddressPool $BackendAddressPool `
-Probe $Probe -LoadBalancingRule $LBRule -InboundNatPool $InboundNatPool;
$ExpectedLb = Get-AzureRmLoadBalancer -Name $LBName -ResourceGroupName $RGName
# New VMSS Parameters
$VMSSName = "VMSS" + $RGName;
$AdminUsername = "Admin01";
$AdminPassword = "p4ssw0rd@123" + $RGName;
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$Sku = "2012-R2-Datacenter"
$Version = "latest"
$VHDContainer = "https://" + $STOName + ".blob.core.contoso.net/" + $VMSSName;
$ExtName = "CSETest";
$Publisher = "Microsoft.Compute";
$ExtType = "BGInfo";
$ExtVer = "2.1";
#IP Config for the NIC
$IPCfg = New-AzureRmVmssIPConfig -Name "Test" `
-LoadBalancerInboundNatPoolsId $ExpectedLb.InboundNatPools[0].Id `
-LoadBalancerBackendAddressPoolsId $ExpectedLb.BackendAddressPools[0].Id `
-SubnetId $SubNetId;
#VMSS Config
$VMSS = New-AzureRmVmssConfig -Location $LOC -SkuCapacity 2 -SkuName "Standard_A2" -UpgradePolicyMode "Automatic" `
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name "Test" -Primary $True -IPConfiguration $IPCfg `
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name "Test2" -IPConfiguration $IPCfg `
| Set-AzureRmVmssOSProfile -ComputerNamePrefix "Test" -AdminUsername $AdminUsername -AdminPassword $AdminPassword `
| Set-AzureRmVmssStorageProfile -Name "Test" -OsDiskCreateOption 'FromImage' -OsDiskCaching "None" `
-ImageReferenceOffer $Offer -ImageReferenceSku $Sku -ImageReferenceVersion $Version `
-ImageReferencePublisher $PublisherName -VhdContainer $VHDContainer `
| Add-AzureRmVmssExtension -Name $ExtName -Publisher $Publisher -Type $ExtType -TypeHandlerVersion $ExtVer -AutoUpgradeMinorVersion $True
#Create the VMSS
New-AzureRmVmss -ResourceGroupName $RGName -Name $VMSSName -VirtualMachineScaleSet $VMSS;
The following complex example creates a VMSS. The first command creates a resource group with the specified name and location. The second command
uses the New-AzureRmStorageAccount cmdlet to create a storage account. The third command then uses the Get-AzureRmStorageAccount cmdlet to get the
storage account created in the second command and stores the result in the $STOAccount variable. The fifth command uses the
New-AzureRmVirtualNetworkSubnetConfig cmdlet to create a subnet and stores the result in the variable named $SubNet. The sixth command uses the
New-AzureRmVirtualNetwork cmdlet to create a virtual network and stores the result in the variable named $VNet. The seventh command uses the
Get-AzureRmVirtualNetwork to get information about the virtual network created in the sixth command and stores the information in the variable
named $VNet. The eighth and ninth command uses the New-AzureRmPublicIpAddress and Get- AzureRmPublicIpAddress to create and get information from
that public IP address. The commands store the information in the variable named $PubIP. The tenth command uses the New-
AzureRmLoadBalancerFrontendIpConfig cmdlet to create a frontend load balancer and stores the result in the variable named $Frontend. The eleventh
command uses the New-AzureRmLoadBalancerBackendAddressPoolConfig to create a backend address pool configuration and stores the result in the
variable named $BackendAddressPool. The twelfth command uses the New-AzureRmLoadBalancerProbeConfig to create a probe and stores the probe
information in the variable named $Probe. The thirteenth command uses the New-AzureRmLoadBalancerInboundNatPoolConfig cmdlet to create a load
balancer inbound network address translation (NAT) pool configuration. The fourteenth command uses the New-AzureRmLoadBalancerRuleConfig to create
a load balancer rule configuration and stores the result in the variable named $LBRule. The fifteenth command uses the New-AzureRmLoadBalancer
cmdlet to create a load balancer and stores the result in the variable named $ActualLb. The sixteenth command uses the Get-AzureRmLoadBalancer to
get information about the load balancer that was created in the fifteenth command and stores the information in the variable named $ExpectedLb.
The seventeenth command uses the New-AzureRmVmssIPConfig cmdlet to create a VMSS IP configuration and stores the information in the variable named
$IPCfg. The eighteenth command uses the New-AzureRmVmssConfig cmdlet to create a VMSS configuration object and stores the result in the variable
named $VMSS. The nineteenth command uses the New-AzureRmVmss cmdlet to create the VMSS.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... zurermvmss
Get-AzureRmVmssDiskEncryption
Remove-AzureRmVmss
Restart-AzureRmVmss
Set-AzureRmVmss
Restart-AzureRmVmss
Stop-AzureRmVmss
Update-AzureRmVmss