New-AzureVM

Creates an Azure virtual machine.

Syntax

New-AzureVM
   [-AffinityGroup <String>]
   [-DeploymentLabel <String>]
   [-DeploymentName <String>]
   [-DnsSettings <DnsServer[]>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-InternalLoadBalancerConfig <InternalLoadBalancerConfig>]
   [-Location <String>]
   [-Profile <AzureSMProfile>]
   [-ReservedIPName <String>]
   [-ReverseDnsFqdn <String>]
   [-ServiceDescription <String>]
   [-ServiceLabel <String>]
   -ServiceName <String>
   -VMs <PersistentVM[]>
   [-VNetName <String>]
   [-WaitForBoot]
   [<CommonParameters>]

Description

The New-AzureVM cmdlet adds a new virtual machine to an existing Azure service, or creates a virtual machine and service in the current subscription if either the Location or AffinityGroup is specified.

Examples

Example 1: Create a virtual machine for a Windows configuration

PS C:\> New-AzureVMConfig -Name "VirtualMachine07" -InstanceSize ExtraSmall -ImageName (Get-AzureVMImage)[4].ImageName | Add-AzureProvisioningConfig -Windows -Password $adminPassword -AdminUsername PsTestAdmin | New-AzureVM -ServiceName "ContosoService" -AffinityGroup "Contoso" -WaitForBoot

This command creates a provisioning configuration based on a virtual machine configuration for the Windows operating system, and uses it to create a virtual machine in a specified affinity group.

Example 2: Create a virtual machine for a Linux configuration

PS C:\> New-AzureVMConfig -Name "SUSEVM02" -InstanceSize ExtraSmall -ImageName (Get-AzureVMImage)[7].ImageName | Add-AzureProvisioningConfig -Linux -LinuxUser "RootMain" -Password "password" -AdminUsername PsTestAdmin | New-AzureVM

This command creates a provisioning configuration based on a virtual machine configuration for Linux, and uses it to create a virtual machine in a specified affinity group.

Example 3: Create a virtual machine and add a data disk

PS C:\> $Images = Get-AzureVMImage
PS C:\> $Image = $Images[4]
PS C:\> $VirtualMachine02 = New-AzureVMConfig -Name "VirtualMachine02" -InstanceSize ExtraSmall -ImageName $myImage.ImageName | Add-AzureProvisioningConfig -Windows -Password "password" | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel "DataDisk50" -LUN 0

The first two commands get available images by using the Get-AzureVMImage cmdlet, and stores one of them in the $Image variable.

This command creates a provisioning configuration based on a virtual machine configuration for the Windows operating system, and uses it to create a virtual machine with an Azure data disk.

Example 4: Create a virtual machine with a reserved IP address

PS C:\> New-AzureVMConfig -Name "VirtualMachine06" -InstanceSize ExtraSmall -ImageName (Get-AzureVMImage)[4].ImageName | Add-AzureProvisioningConfig -Windows -Password $adminPassword -AdminUsername "AdminMain" | New-AzureVM -ServiceName "ContosoService02" -AffinityGroup "Contoso" -ReservedIPName $ipName

This command creates a provisioning configuration based on a virtual machine configuration for the Windows operating system, and uses it to create a virtual machine with a reserved IP address.

Required Parameters

-ServiceName

Specifies the new or existing service name.

If the service does not exist, this cmdlet creates it for you. Use the Location or AffinityGroup parameter to specify where to create the service.

If the service exists, the Location or AffinityGroup parameter is not needed.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VMs

Specifies a list of virtual machine objects to create.

Type:PersistentVM[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False

Optional Parameters

-AffinityGroup

Specifies the Azure affinity group in which the cloud service resides. This parameter is required only when this cmdlet creates a cloud service.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DeploymentLabel

Specifies a label for the deployment.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DeploymentName

Specifies a deployment name. If not specified, this cmdlet uses the service name as the deployment name.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DnsSettings

Specifies a DNS Server object that defines the DNS settings for the new deployment.

Type:DnsServer[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
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
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

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

Specifies an internal load balancer. This parameter is not used.

Type:InternalLoadBalancerConfig
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-Location

Specifies the location that hosts the new service. If the service already exists, do not specify this parameter.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:False
Accept wildcard characters:False
-ReservedIPName

Specifies the name of the reserved IP address.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ReverseDnsFqdn

Specifies the fully-qualified domain name for reverse DNS.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceDescription

Specifies a description for the new service.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceLabel

Specifies a label for the new service.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VNetName

Specifies the virtual network name where this cmdlet deploys the virtual machine.

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

Specifies that this cmdlet waits for the virtual machine to reach the ReadyRole state. This cmdlet fails if the virtual machine falls in one of the following states while waiting: FailedStartingVM, ProvisioningFailed, ProvisioningTimeout.

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