Edit

Share via


New-WAPackVM

Creates a virtual machine.

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

CreateVMFromTemplate (Default)

New-WAPackVM
    -Name <String>
    -Template <VMTemplate>
    -VMCredential <PSCredential>
    [-VNet <VMNetwork>]
    [-ProductKey <String>]
    [-Windows]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

CreateLinuxVMFromTemplate

New-WAPackVM
    -Name <String>
    -Template <VMTemplate>
    -VMCredential <PSCredential>
    [-VNet <VMNetwork>]
    [-Linux]
    [-AdministratorSSHKey <String>]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

CreateVMFromOSDisk

New-WAPackVM
    -Name <String>
    -OSDisk <VirtualHardDisk>
    -VMSizeProfile <HardwareProfile>
    [-VNet <VMNetwork>]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

These topics are deprecated and will be removed in the future. This topic describes the cmdlet in the 0.8.1 version of the Microsoft Azure PowerShell module. To find out the version of the module you're using, from the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The New-WAPackVM cmdlet creates a virtual machine.

Examples

Example 1: Create a virtual machine for the Windows operating system by using a template

PS C:\> $Credentials = Get-Credential PS C:\> $Template = Get-WAPackVMTemplate -Name "ContosoTemplate04"PS C:\> New-WAPackVM -Name "ContosoV023" -Template $Template -VMCredential $Credentials -Windows

The first command creates a PSCredential object, and then stores it in the $Credentials variable. The cmdlet prompts you for an account and password. For more information, type Get-Help Get-Credential.

The second command gets the virtual machine template named ContosoTemplate04 by using the Get-WAPackVMTemplate cmdlet, and then stores it in the $Template variable.

The final command creates a virtual machine named ContosoV023, based on the template stored in the $Template variable. The command specifies the Windows parameter, and, therefore, the virtual machine must run a version of the Windows operating system.

Example 2: Create a virtual machine for the Linux operating system by using a template

PS C:\> $Credentials = Get-Credential
PS C:\> $Template = Get-WAPackVMTemplate -Name "ContosoTemplate19"
PS C:\> New-WAPackVM -Linux -Name "ContosoV028" -Template $Template -VMCredential $Credentials

The first command creates a PSCredential object, and then stores it in the $Credentials variable.

The second command gets the virtual machine template named ContosoTemplate19 by using the Get-WAPackVMTemplate cmdlet, and then stores it in the $Template variable.

The final command creates a virtual machine named ContosoV028, based on the template stored in the $Template variable. The command specifies the Linux parameter, and, therefore, the virtual machine must run a version of the Linux operating system.

Example 3: Create a virtual machine from an operating system disk and size profile

PS C:\> $OSDisk = Get-WAPackVMOSDisk -Name "ContosoDiskOS"
PS C:\> $SizeProfile = Get-WAPackVMSizeProfile -Name "MediumSizeVM"
PS C:\> New-WAPackVM -Name "ContosoV073" -OSDisk $OSDisk -VMSizeProfile $SizeProfile

The first command gets an operating system disk named ContosoDiskOS by using the Get-WAPackVMOSDisk cmdlet, and then stores it in the $OSDisk variable.

The second command gets the size profile named MediumSizeVM by using the Get-WAPackVMSizeProfile cmdlet, and then stores it in the $SizeProfile variable.

The final command creates a virtual machine named ContosoV073 from the operating system disk stored in $OSDisk and the size profile stored in $SizeProfile.

Parameters

-AdministratorSSHKey

Specifies the Secure Shell (SSH) key for the Administrator account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateLinuxVMFromTemplate
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Linux

Indicates that the cmdlet creates a virtual machine to run the Linux operating system.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateLinuxVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies a name for the virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-OSDisk

Specifies an operating system disk as a VirtualHardDisk object. To obtain an operating system disk, use the Get-WAPackVMOSDisk cmdlet.

Parameter properties

Type:VirtualHardDisk
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromOSDisk
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ProductKey

Specifies a product key. The product key is a 25 digit number that identifies the product license. Use a product key for an operating system that you plan to install on a virtual machine or host.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromTemplate
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Template

Specifies a template. The cmdlet creates a virtual machine based on the template that you specify. To obtain a template object, use the Get-WAPackVMTemplate cmdlet.

Parameter properties

Type:VMTemplate
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
CreateLinuxVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VMCredential

Specifies the credential for the local Administrator account. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
CreateLinuxVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VMSizeProfile

Specifies a size profile for a virtual machine as a HardwareProfile object. To obtain a size profile, use the Get-WAPackVMSizeProfile cmdlet.

Parameter properties

Type:HardwareProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromOSDisk
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VNet

Specifies a virtual network. The cmdlet connects the virtual machine to the virtual network that you specify. To obtain a virtual network, use the Get-WAPackVNet cmdlet.

Parameter properties

Type:VMNetwork
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Windows

Indicates that the cmdlet creates a virtual machine to run the Windows operating system.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CreateVMFromTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

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.