Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

New-WAPackVM

New-WAPackVM

microsoft.windowsazure.commands.dll

Synopsis

Creates a virtual machine.

Syntax

New-WAPackVM [-ProductKey] [-VNet] [-Name] [-Template] [-VMCredential] [-Windows] [<CommonParameters>]

New-WAPackVM [-AdministratorSSHKey] [-VNet] [-Linux] [-Name] [-Template] [-VMCredential] [<CommonParameters>]

New-WAPackVM [-VNet] [-Name] [-OSDisk] [-VMSizeProfile] [<CommonParameters>]

Detailed Description

The New-WAPackVM cmdlet creates a virtual machine.

Parameters

-AdministratorSSHKey <String>

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

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Linux <SwitchParameter>

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

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Name <String>

Specifies a name for the virtual machine.

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-OSDisk <VirtualHardDisk>

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

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-ProductKey <String>

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.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Template <VMTemplate>

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.

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-VMCredential <PSCredential>

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.

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-VMSizeProfile <HardwareProfile>

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

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-VNet <VMNetwork>

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.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Windows <SwitchParameter>

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

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

Input Type


Return Type


Notes

None

Examples

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

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.

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

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

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.

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

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

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.

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

Get-WAPackVM
Remove-WAPackVM
Restart-WAPackVM
Resume-WAPackVM
Set-WAPackVM
Start-WAPackVM
Stop-WAPackVM
Suspend-WAPackVM
Get-WAPackVMSizeProfile
Get-WAPackVMTemplate
Get-WAPackVMOSDisk
Get-WAPackVNet