New-AzureVMConfig

Creates an Azure virtual machine configuration object.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

New-AzureVMConfig
   [-Name] <String>
   [-InstanceSize] <String>
   [[-HostCaching] <String>]
   [[-AvailabilitySetName] <String>]
   [[-Label] <String>]
   [-ImageName] <String>
   [[-MediaLocation] <String>]
   [[-DiskLabel] <String>]
   [-DisableBootDiagnostics]
   [-LicenseType <String>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
New-AzureVMConfig
   [-Name] <String>
   [-InstanceSize] <String>
   [[-HostCaching] <String>]
   [[-AvailabilitySetName] <String>]
   [[-Label] <String>]
   [-DiskName] <String>
   [-DisableBootDiagnostics]
   [-LicenseType <String>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The New-AzureVMConfig cmdlet creates an Azure virtual machine configuration object. You can use this object to perform a new deployment and add a new virtual machine to an existing deployment.

Examples

Example 1: Create a Windows virtual machine configuration

PS C:\> $Image = (Get-AzureVMImage)[4].ImageName 
C:\PS> New-AzureVMConfig -Name "MyVM1" -InstanceSize ExtraSmall -ImageName $Image | Add-AzureProvisioningConfig -Windows -Password $AdminPassword | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel "Datadisk1" -LUN 0 | New-AzureVM -ServiceName "MySvc1"

This command creates a Windows virtual machine configuration with operating system disk, data disk and provisioning configuration. This configuration is then used to create a new virtual machine.

Example 2: Create a Linux virtual machine configuration

PS C:\> $Image = (Get-AzureVMImage)[7].ImageName
C:\PS> New-AzureVMConfig -Name "MyVM1" -InstanceSize ExtraSmall -ImageName $Image | Add-AzureProvisioningConfig -Linux -LinuxUser $LinuxUser -Password $AdminPassword | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel "Datadisk1" -LUN 0 | New-AzureVM -ServiceName "MySvc1"

This command creates a new Linux virtual machine configuration with operating system disk, data disk and provisioning configuration. This configuration is then used to create a new virtual machine.

Parameters

-AvailabilitySetName

Specifies the name of the availability set.

Type:String
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableBootDiagnostics

Indicates that the configuration disables boot diagnostics. By default, boot diagnostics are enabled on the virtual machine.

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

-DiskLabel

Specifies a label for the operating system disk.

Type:String
Position:7
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DiskName

Specifies a name for the operating system disk.

Type:String
Position:5
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-HostCaching

Specifies the host caching mode for the operating system disk.

Valid values are:

  • ReadOnly
  • ReadWrite
Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ImageName

Specifies the name of the virtual machine image to use for the operating system disk.

Type:String
Position:5
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceSize

Specifies the size of the instance.

The acceptable values for this parameter are:

  • ExtraSmall
  • Small
  • Medium
  • Large
  • ExtraLarge
  • A5
  • A6
  • A7
  • A8
  • A9
  • Basic_A0
  • Basic_A1
  • Basic_A2
  • Basic_A3
  • Basic_A4
  • Standard_D1
  • Standard_D2
  • Standard_D3
  • Standard_D4
  • Standard_D11
  • Standard_D12
  • Standard_D13
  • Standard_D14
Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Label

Specifies a label to assign to the virtual machine.

Type:String
Position:4
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-LicenseType

Specifies the type of license for an image or disk that is licensed on-premises. The acceptable values for this parameter are:

  • Windows_Client
  • Windows_Server

Specify this parameter only for images that contain the Windows Server operating system.

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

-MediaLocation

Specifies the Azure storage location for the new virtual machine disk.

Type:String
Position:6
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the virtual machine.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

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