New-AzVmssConfig

Creates a VMSS configuration object.

Syntax

New-AzVmssConfig
   [[-Overprovision] <Boolean>]
   [[-Location] <String>]
   [-EdgeZone <String>]
   [[-Tag] <Hashtable>]
   [[-SkuName] <String>]
   [[-SkuTier] <String>]
   [[-SkuCapacity] <Int32>]
   [[-UpgradePolicyMode] <UpgradeMode>]
   [[-OsProfile] <VirtualMachineScaleSetOSProfile>]
   [[-StorageProfile] <VirtualMachineScaleSetStorageProfile>]
   [[-NetworkInterfaceConfiguration] <VirtualMachineScaleSetNetworkConfiguration[]>]
   [[-Extension] <PSVirtualMachineScaleSetExtension[]>]
   [-SkipExtensionsOnOverprovisionedVMs]
   [-SinglePlacementGroup <Boolean>]
   [-ZoneBalance]
   [-PlatformFaultDomainCount <Int32>]
   [-Zone <String[]>]
   [-PlanName <String>]
   [-PlanPublisher <String>]
   [-PlanProduct <String>]
   [-PlanPromotionCode <String>]
   [-RollingUpgradePolicy <RollingUpgradePolicy>]
   [-EnableAutomaticRepair]
   [-AutomaticRepairGracePeriod <String>]
   [-AutoOSUpgrade]
   [-DisableAutoRollback <Boolean>]
   [-EnableUltraSSD]
   [-HealthProbeId <String>]
   [-BootDiagnostic <BootDiagnostics>]
   [-LicenseType <String>]
   [-Priority <String>]
   [-EvictionPolicy <String>]
   [-MaxPrice <Double>]
   [-TerminateScheduledEvents]
   [-TerminateScheduledEventNotBeforeTimeoutInMinutes <Int32>]
   [-ProximityPlacementGroupId <String>]
   [-ScaleInPolicy <String[]>]
   [-EncryptionAtHost]
   [-OrchestrationMode <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzVmssConfig
   [[-Overprovision] <Boolean>]
   [[-Location] <String>]
   [-EdgeZone <String>]
   [[-Tag] <Hashtable>]
   [[-SkuName] <String>]
   [[-SkuTier] <String>]
   [[-SkuCapacity] <Int32>]
   [[-UpgradePolicyMode] <UpgradeMode>]
   [[-OsProfile] <VirtualMachineScaleSetOSProfile>]
   [[-StorageProfile] <VirtualMachineScaleSetStorageProfile>]
   [[-NetworkInterfaceConfiguration] <VirtualMachineScaleSetNetworkConfiguration[]>]
   [[-Extension] <PSVirtualMachineScaleSetExtension[]>]
   [-SkipExtensionsOnOverprovisionedVMs]
   [-SinglePlacementGroup <Boolean>]
   [-ZoneBalance]
   [-PlatformFaultDomainCount <Int32>]
   [-Zone <String[]>]
   [-PlanName <String>]
   [-PlanPublisher <String>]
   [-PlanProduct <String>]
   [-PlanPromotionCode <String>]
   [-RollingUpgradePolicy <RollingUpgradePolicy>]
   [-EnableAutomaticRepair]
   [-AutomaticRepairGracePeriod <String>]
   [-AutoOSUpgrade]
   [-DisableAutoRollback <Boolean>]
   [-EnableUltraSSD]
   [-HealthProbeId <String>]
   [-BootDiagnostic <BootDiagnostics>]
   [-LicenseType <String>]
   [-Priority <String>]
   [-EvictionPolicy <String>]
   [-MaxPrice <Double>]
   [-TerminateScheduledEvents]
   [-TerminateScheduledEventNotBeforeTimeoutInMinutes <Int32>]
   [-ProximityPlacementGroupId <String>]
   [-ScaleInPolicy <String[]>]
   -IdentityType <ResourceIdentityType>
   [-IdentityId <String[]>]
   [-EncryptionAtHost]
   [-OrchestrationMode <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzVmssConfig cmdlet creates a configurable local Virtual Manager Scale Set (VMSS) object. Other cmdlets are needed to configure the VMSS object. These cmdlets are:

  • Set-AzVmssOsProfile
  • Set-AzVmssStorageProfile
  • Add-AzVmssNetworkInterfaceConfiguration
  • Add-AzVmssExtension

Examples

Example 1: Create a VMSS configuration object

PS C:\> $VMSS = New-AzVmssConfig -Location $Loc -SkuCapacity 2 -SkuName "Standard_A0" -UpgradePolicyMode "Automatic" -NetworkInterfaceConfiguration $NetCfg `
            | Add-AzVmssNetworkInterfaceConfiguration -Name "Test" -Primary $True -IPConfiguration $IPCfg `
            | Set-AzVmssOSProfile -ComputerNamePrefix "Test" -AdminUsername $adminUsername -AdminPassword $AdminPassword `
            | Set-AzVmssStorageProfile -Name "Test" -OsDiskCreateOption "FromImage" -OsDiskCaching "None" `
            -ImageReferenceOffer $ImgRef.Offer -ImageReferenceSku $ImgRef.Skus -ImageReferenceVersion $ImgRef.Version `
            -ImageReferencePublisher $ImgRef.PublisherName -VhdContainer $VHDContainer `
            | Add-AzVmssAdditionalUnattendContent -ComponentName  $AUCComponentName -Content  $AUCContent -PassName  $AUCPassName -SettingName  $AUCSetting `
            | Remove-AzVmssAdditionalUnattendContent -ComponentName  $AUCComponentName;

New-AzVmss -ResourceGroupName $RGName -Name $VMSSName -VirtualMachineScaleSet $VMSS;

This example creates a VMSS configuration object. The first command uses the New-AzVmssConfig cmdlet to create a VMSS configuration object and stores the result in the variable named $VMSS. The second command uses the New-AzVmss cmdlet to create a VMSS that uses the VMSS configuration object created in the first command.

Example 2

Creates a VMSS configuration object. (autogenerated)

<!-- Aladdin Generated Example --> 
New-AzVmssConfig -Location <String> -Overprovision $false -SkuCapacity 2 -SkuName 'Standard_A0' -Tag 'Sql' -UpgradePolicyMode Automatic

Parameters

-AutomaticRepairGracePeriod

The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 30 minutes (PT30M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M).

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-AutoOSUpgrade

Sets whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-BootDiagnostic

Specifies the virtual machine scale set boot diagnostics profile.

Type:BootDiagnostics
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisableAutoRollback

Disable Auto Rollback for Auto OS Upgrade Policy

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EdgeZone

Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-EnableAutomaticRepair

Enables automatic repairs on the virtual machine scale set.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-EnableUltraSSD

Enables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the virtual machine scale set. Managed disks with storage account type UltraSSD_LRS can be added to a VMSS only if this property is enabled.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-EncryptionAtHost

This parameter will enable the encryption for all the disks including Resource/Temp disk at host itself. Default: The Encryption at host will be disabled unless this property is set to true for the resource.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-EvictionPolicy

Specifies the eviction policy for the virtual machines in the scale set.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Extension

Specifies the extension information object for the VMSS. You can use the Add-AzVmssExtension cmdlet to add this object.

Type:Microsoft.Azure.Commands.Compute.Automation.Models.PSVirtualMachineScaleSetExtension[]
Position:10
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-HealthProbeId

Specifies the ID of a load balancer probe used to determine the health of an instance in the virtual machine scale set. HealthProbeId is in the form of '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-IdentityId

Specifies the list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-IdentityType

Specifies the type of identity used for the virtual machine scale set. The type 'SystemAssignedUserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine scale set. The acceptable values for this parameter are:

  • SystemAssigned
  • UserAssigned
  • SystemAssignedUserAssigned
  • None
Type:Nullable<T>[ResourceIdentityType]
Accepted values:SystemAssigned, UserAssigned, SystemAssignedUserAssigned, None
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-LicenseType

Specify the license type, which is for bringing your own license scenario.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Location

Specifies the Azure location where the VMSS is created.

Type:String
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-MaxPrice

Specifies the maximum price you are willing to pay for a Spot VM/VMSS. This price is in US Dollars. This price will be compared with the current Spot price for the VM size. Also, the prices are compared at the time of create/update of Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Spot price. The maxPrice will also be used for evicting a Spot VM/VMSS if the current Spot price goes beyond the maxPrice after creation of VM/VMSS. Possible values are: any decimal value greater than zero. Example: 0.01538. -1 indicates that the Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.

Type:Double
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-NetworkInterfaceConfiguration

Specifies the network profile object that contains the networking properties for the VMSS configuration. You can use the Add-AzVmssNetworkInterfaceConfiguration cmdlet to add this object.

Type:VirtualMachineScaleSetNetworkConfiguration[]
Position:9
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-OrchestrationMode

Specifies the orchestration mode for the virtual machine scale set. Possible values: Uniform, Flexible

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-OsProfile

Specifies the operating system profile object that contains the operating system properties for the VMSS configuration. You can use the Set-AzVmssOsProfile cmdlet to set this object.

Type:VirtualMachineScaleSetOSProfile
Position:7
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Overprovision

Indicates whether the cmdlet overprovisions the VMSS.

Type:Nullable<T>[Boolean]
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PlanName

Specifies the plan name.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PlanProduct

Specifies the plan product.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PlanPromotionCode

Specifies the plan promotion code.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PlanPublisher

Specifies the plan publisher.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PlatformFaultDomainCount

Fault Domain count for each placement group.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Priority

The priority for the virtual machien in the scale set. Only supported values are 'Regular', 'Spot' and 'Low'. 'Regular' is for regular virtual machine. 'Spot' is for spot virtual machine. 'Low' is also for spot virtual machine but is replaced by 'Spot'. Please use 'Spot' instead of 'Low'.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ProximityPlacementGroupId

The resource id of the Proximity Placement Group to use with this scale set.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-RollingUpgradePolicy

Specifies the rolling upgrade policy.

Type:RollingUpgradePolicy
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ScaleInPolicy

The rules to be followed when scaling-in a virtual machine scale set. Possible values are: 'Default', 'OldestVM' and 'NewestVM'. 'Default' when a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. 'OldestVM' when a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. 'NewestVM' when a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SinglePlacementGroup

Specifies the single placement group.

Type:Nullable<T>[Boolean]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SkipExtensionsOnOverprovisionedVMs

Specifies that the extensions do not run on the extra overprovisioned VMs.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SkuCapacity

Specifies the number of instances in the VMSS.

Type:Int32
Position:5
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SkuName

Specifies the size of all the instances of VMSS.

Type:String
Aliases:AccountType
Position:3
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SkuTier

Specifies the tier of VMSS. The acceptable values for this parameter are:

  • Standard
  • Basic
Type:String
Position:4
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-StorageProfile

Specifies the storage profile object that contains the disk properties for the VMSS configuration. You can use the Set-AzVmssStorageProfile cmdlet to set this object.

Type:VirtualMachineScaleSetStorageProfile
Position:8
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Tag

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Type:Hashtable
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-TerminateScheduledEventNotBeforeTimeoutInMinutes

Configurable length of time (in minutes) a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event before the event is auto approved (timed out).

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-TerminateScheduledEvents

Enable the Terminate Scheduled events

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-UpgradePolicyMode

Specified the mode of an upgrade to virtual machines in the scale set. The acceptable values for this parameter are:

  • Automatic
  • Manual
Type:Nullable<T>[UpgradeMode]
Accepted values:Automatic, Manual, Rolling
Position:6
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Zone

Specifies the zone list for the virtual machine scale set.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ZoneBalance

Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

String

Hashtable

Int32

Nullable<T>[[Microsoft.Azure.Management.Compute.Models.UpgradeMode, Microsoft.Azure.Management.Compute, Version=23.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

VirtualMachineScaleSetOSProfile

VirtualMachineScaleSetStorageProfile

VirtualMachineScaleSetNetworkConfiguration[]

VirtualMachineScaleSetExtension[]

String[]

RollingUpgradePolicy

SwitchParameter

BootDiagnostics

Nullable<T>[[Microsoft.Azure.Management.Compute.Models.ResourceIdentityType, Microsoft.Azure.Management.Compute, Version=23.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

Outputs

PSVirtualMachineScaleSet