The New-AzVMConfig cmdlet creates a configurable local virtual machine object for Azure.
Specify exactly one of VMSize or PreferredVMSize in either parameter set.
VMSize selects a fixed size. PreferredVMSize sets FlexProfile.PreferredVMSize and leaves HardwareProfile.VmSize unset.
With FlexProfile, Azure may deploy the preferred size or a compatible alternative based on capacity and placement.
Pass the completed configuration to New-AzVM -VM to forward its FlexProfile.
FlexProfile is a preview feature that requires registration of the Microsoft.Compute/FlexProfileEnabled subscription feature and availability in the target region.
Supported VM families vary by region. Azure validates unsupported placements and empty preferred-size strings.
The following cmdlets are used to set different properties of the virtual machine object:
This example creates a VM using a VMConfig object for the TrustedLaunch Security Type and validates flags VtpmEnabled and SecureBootEnabled are true by default.
This example creates a Spot Plus VM configuration object and deploys it. Spot Plus is the next generation of Azure Spot and provides higher reliability and longer running time than 'Spot' at a discounted price.
'-EvictionPolicy' and '-MaxPrice' behave the same way as they do for 'Spot'.
Using 'SpotPlus' requires the 'Microsoft.Compute/SpotPlus' subscription feature to be registered and a region where the feature is enabled.
Example 6: Create a virtual machine configuration object that opts out of capacity reservation
This example creates a virtual machine configuration object which is explicitly opted out from any capacity reservation assignment, so the virtual machine consumes publicly available capacity instead of implicitly or explicitly consuming a capacity reservation.
Example 7: Configure and deploy a VM with a preferred size
This example uses an existing, unattached network interface in a region enabled for the registered FlexProfile preview.
It supplies PreferredVMSize instead of VMSize. New-AzVM -VM forwards the configured FlexProfile without a separate preferred-size parameter.
Parameters
-AlignRegionalDisksToVMZone
Specifies whether the regional disks should be aligned/moved to the VM zone. This is applicable only for VMs with placement property set. Please note that this change is irreversible.
Specifies the ID of an availability set.
To obtain an availability set object, use the Get-AzAvailabilitySet cmdlet.
The availability set object contains an ID property.
Virtual machines specified in the same availability set are allocated to different nodes to maximize availability.
For more information about availability sets, see Manage the availability of virtual machines.
For more information on Azure planned maintenance, see Planned maintenance for virtual machines in Azure
Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set.
This property cannot exist along with a non-null properties.virtualMachineScaleSet reference.
Specifies that the virtual machine is explicitly opted out from any capacity reservation assignment.
When set, the virtual machine will not be implicitly or explicitly associated with any capacity reservation and will consume publicly available capacity instead.
Enables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM.
Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine only if this property is enabled.
EncryptionAtHost property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual machine scale set.
This 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.
This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set to 'Any', availability zone selected by the system must not be present in the list of availability zones passed with 'excludeZones'. If 'excludeZones' is not provided, all availability zones in region will be considered for selection.
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}'
This property supplements the 'zonePlacementPolicy' property. If 'zonePlacementPolicy' is set to 'Any', availability zone selected by the system must be present in the list of availability zones passed with 'includeZones'. If 'includeZones' is not provided, all availability zones in region will be considered for selection.
Specifies a license type, which indicates that the image or disk for the virtual machine was licensed on-premises.
Possible values for Windows Server are:
Windows_Client
Windows_Server
Possible values for Linux Server operating system are:
Specifies the maximum price you are willing to pay for a low priority VM/VMSS. This price is in US Dollars. This price will be compared with the current low priority price for the VM size. Also, the prices are compared at the time of create/update of low priority VM/VMSS and the operation will only succeed if the maxPrice is greater than the current low priority price. The maxPrice will also be used for evicting a low priority VM/VMSS if the current low priority 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 low priority VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.
Specifies the preferred VM size for the preview FlexProfile, for example Standard_D4s_v5.
Azure may choose a compatible alternative based on capacity and placement.
Specify exactly one of PreferredVMSize or VMSize.
This parameter sets FlexProfile.PreferredVMSize and leaves HardwareProfile.VmSize unset.
It requires preview feature registration and regional availability. Azure validates unsupported placements and empty strings.
The priority for the virtual machine. Only supported values are 'Regular', 'Spot', 'SpotPlus' and 'Low'.
'Regular' is for regular virtual machine.
'Spot' is for spot virtual machine.
'SpotPlus' is the next generation of spot virtual machine, which offers higher reliability and longer running time than 'Spot'.
'Low' is also for spot virtual machine but is replaced by 'Spot'. Please use 'Spot' instead of 'Low'.
Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. By default, UefiSettings will not be enabled unless this property is set.
Specifies the number of vCPUs available for the VM. When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available for that VM size exposed in api response of List all available virtual machine sizes in a region.
Specifies the vCPU to physical core ratio. When this property is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the VM Size exposed in api response of List all available virtual machine sizes in a region. Setting this property to 1 also means that hyper-threading is disabled.
Specifies the fixed size for the virtual machine. Get-AzComputeResourceSku can be used to find out available sizes for your subscription and region.
Although optional in parameter metadata, exactly one of VMSize or PreferredVMSize must be supplied.
Do not combine this parameter with PreferredVMSize.
Specifies the availability zone for the virtual machine. Although it takes in an array of zones, virtual machines do not support multiple availability zones.
The allowed value depends on the capabilities of the region. Allowed value will normally be 1, 2, or 3. More information on Azure availability zones.
Specifies the policy for virtual machine's placement in availability zone. Possible values are: Any - An availability zone will be automatically picked by system as part of virtual machine creation.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.