New-AzStackHCIVMVirtualMachine
The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.
Syntax
New-AzStackHCIVMVirtualMachine
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-Location <String>
-CustomLocationId <String>
-OsType <String>
-ImageId <String>
[-DynamicMemoryMaximumMemoryInMb <Int64>]
[-DynamicMemoryMinimumMemoryInMb <Int64>]
[-DynamicMemoryTargetBuffer <Int32>]
[-VmMemoryInMB <Int64>]
[-VmProcessor <Int32>]
[-VmSize <String>]
[-IdentityType <String>]
[-DisablePasswordAuthentication]
[-ProvisionVMAgent]
[-ProvisionVMConfigAgent]
[-NicId <String[]>]
[-NicName <String[]>]
[-NicResourceGroup <String>]
[-DataDiskId <String[]>]
[-DataDiskName <String[]>]
[-DataDiskResourceGroup <String>]
[-AdminPassword <String>]
[-AdminUsername <String>]
[-ComputerName <String>]
[-EnableTpm]
[-SshPublicKey <String[]>]
[-StoragePathId <String>]
[-StoragePathName <String>]
[-StoragePathResourceGroup <String>]
[-SecureBootEnabled]
[-EnableAutomaticUpdate]
[-TimeZone <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzStackHCIVMVirtualMachine
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-Location <String>
-CustomLocationId <String>
-OsType <String>
[-DynamicMemoryMaximumMemoryInMb <Int64>]
[-DynamicMemoryMinimumMemoryInMb <Int64>]
[-DynamicMemoryTargetBuffer <Int32>]
[-VmMemoryInMB <Int64>]
[-VmProcessor <Int32>]
[-VmSize <String>]
[-IdentityType <String>]
[-DisablePasswordAuthentication]
[-ProvisionVMAgent]
[-ProvisionVMConfigAgent]
[-NicId <String[]>]
[-NicName <String[]>]
[-NicResourceGroup <String>]
[-DataDiskId <String[]>]
[-DataDiskName <String[]>]
[-DataDiskResourceGroup <String>]
[-AdminPassword <String>]
[-AdminUsername <String>]
[-ComputerName <String>]
[-EnableTpm]
[-SshPublicKey <String[]>]
[-StoragePathId <String>]
[-StoragePathName <String>]
[-StoragePathResourceGroup <String>]
[-SecureBootEnabled]
[-EnableAutomaticUpdate]
[-TimeZone <String>]
-ImageName <String>
[-ImageResourceGroup <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzStackHCIVMVirtualMachine
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-Location <String>
-CustomLocationId <String>
-OsType <String>
[-DynamicMemoryMaximumMemoryInMb <Int64>]
[-DynamicMemoryMinimumMemoryInMb <Int64>]
[-DynamicMemoryTargetBuffer <Int32>]
[-VmMemoryInMB <Int64>]
[-VmProcessor <Int32>]
[-VmSize <String>]
[-IdentityType <String>]
[-DisablePasswordAuthentication]
[-ProvisionVMAgent]
[-ProvisionVMConfigAgent]
[-NicId <String[]>]
[-NicName <String[]>]
[-NicResourceGroup <String>]
[-DataDiskId <String[]>]
[-DataDiskName <String[]>]
[-DataDiskResourceGroup <String>]
[-AdminPassword <String>]
[-AdminUsername <String>]
[-ComputerName <String>]
[-EnableTpm]
[-SshPublicKey <String[]>]
[-StoragePathId <String>]
[-StoragePathName <String>]
[-StoragePathResourceGroup <String>]
[-SecureBootEnabled]
[-EnableAutomaticUpdate]
[-TimeZone <String>]
-OSDiskId <String>
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzStackHCIVMVirtualMachine
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-Location <String>
-CustomLocationId <String>
-OsType <String>
[-DynamicMemoryMaximumMemoryInMb <Int64>]
[-DynamicMemoryMinimumMemoryInMb <Int64>]
[-DynamicMemoryTargetBuffer <Int32>]
[-VmMemoryInMB <Int64>]
[-VmProcessor <Int32>]
[-VmSize <String>]
[-IdentityType <String>]
[-DisablePasswordAuthentication]
[-ProvisionVMAgent]
[-ProvisionVMConfigAgent]
[-NicId <String[]>]
[-NicName <String[]>]
[-NicResourceGroup <String>]
[-DataDiskId <String[]>]
[-DataDiskName <String[]>]
[-DataDiskResourceGroup <String>]
[-AdminPassword <String>]
[-AdminUsername <String>]
[-ComputerName <String>]
[-EnableTpm]
[-SshPublicKey <String[]>]
[-StoragePathId <String>]
[-StoragePathName <String>]
[-StoragePathResourceGroup <String>]
[-SecureBootEnabled]
[-EnableAutomaticUpdate]
[-TimeZone <String>]
-OSDiskName <String>
[-OSDiskResourceGroup <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.
Examples
Example 1: Create a Virtual Machine with an Image.
New-AzStackHCIVMVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus"
Name ResourceGroupName
---- -----------------
testVm test-rg
This command creates a virtual machine from a gallery image.
Example 2: Create a Virtual Machine with a Disk.
New-AzStackHCIVMVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus"
Name ResourceGroupName
---- -----------------
testVm test-rg
This command creates a virtual machine from a disk.
Parameters
-AdminPassword
AdminPassword - admin password
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AdminUsername
AdminUsername - admin username
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AsJob
Run the command as a job
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ComputerName
ComputerName - name of the computer
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CustomLocationId
The name of the extended location.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DataDiskId
Data Disks - List of data disks to be attached to the virtual machine in id format.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DataDiskName
Data Disks - List of data disks to be attached to the virtual machine in name format .
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DataDiskResourceGroup
Data Disks - Resource Group of Data Disks.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | PSObject |
Aliases: | AzureRMContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisablePasswordAuthentication
DisablePasswordAuthentication - whether password authentication should be disabled
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DynamicMemoryMaximumMemoryInMb
Maximum Dynamic Memory
Type: | Int64 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DynamicMemoryMinimumMemoryInMb
Minimum Dynamic Memory
Type: | Int64 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DynamicMemoryTargetBuffer
Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableAutomaticUpdate
Specifies Whether to EnableAutomaticUpdates on the machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableTpm
Used to indicate whether or not to enable TPM
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IdentityType
The identity type.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ImageId
Resource ID of the image to create the VM with.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ImageName
Name of the image to create the VM with.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ImageResourceGroup
Resource group of the image to create the VM from.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
The geo-location where the resource lives
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Name of the virtual machine
Type: | String |
Aliases: | VirtualMachineName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NicId
NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NicName
NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NicResourceGroup
NetworkInterfaces - Resource Group of Network Interfaces.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoWait
Run the command asynchronously
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OSDiskId
Resource ID of the OS disk
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OSDiskName
Name of the OS disk
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OSDiskResourceGroup
Resource Group of the OS disk
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OsType
OsType - string specifying whether the OS is Linux or Windows
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ProvisionVMAgent
Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. VM Agent is provsioned by default. Please pass -ProvisionVMAgent:$false to disable.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ProvisionVMConfigAgent
Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. When this property is not specified, default behavior is to set it to true. VM Config Agent is provisioned by default. Please pass -ProvisionVMConfigAgent:$false to disable.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
The name of the resource group. The name is case insensitive.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SecureBootEnabled
Specifies whether secure boot should be enabled on the virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SshPublicKey
PublicKeys - The list of SSH public keys used to authenticate with VMs
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StoragePathId
Id of the storage container that hosts the VM configuration file
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StoragePathName
Name of the storage container that hosts the VM configuration file
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StoragePathResourceGroup
Storage Container resource group. The resource group of the virtual machine will be used if this value is not provided.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SubscriptionId
The ID of the target subscription.
Type: | String |
Position: | Named |
Default value: | (Get-AzContext).Subscription.Id |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TimeZone
TimeZone for the virtual machine
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VmMemoryInMB
RAM in MB for the virtual machine
Type: | Int64 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VmProcessor
Number of processors for the virtual machine
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VmSize
Size of the VM. Can be a Predefined size or Custom. Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |