< Back

New-AzureVM

Wed Jan 30, 2019 5:49 pm

NAME New-AzureVM



SYNOPSIS

Creates an Azure virtual machine.





SYNTAX

New-AzureVM -ServiceName <String> [-DeploymentLabel <String>] [-DeploymentName <String>] [-VNetName <String>] [-DnsSettings <DnsServer[]>]

[-InternalLoadBalancerConfig <InternalLoadBalancerConfig>] -VMs <PersistentVM[]> [-WaitForBoot] [-ReservedIPName <String>] [-Profile <AzureSMProfile>]

[-InformationAction <ActionPreference>] [-InformationVariable <String>] [-Location <String>] [-AffinityGroup <String>] [-ServiceLabel <String>]

[-ReverseDnsFqdn <String>] [-ServiceDescription <String>] [<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.





PARAMETERS

-ServiceName <String>

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.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DeploymentLabel <String>

Specifies a label for the deployment.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DeploymentName <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VNetName <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DnsSettings <DnsServer[]>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-InternalLoadBalancerConfig <InternalLoadBalancerConfig>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-VMs <PersistentVM[]>

Specifies a list of virtual machine objects to create.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-WaitForBoot [<SwitchParameter>]

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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ReservedIPName <String>

Specifies the name of the reserved IP address.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Profile <AzureSMProfile>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationAction <ActionPreference>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Location <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-AffinityGroup <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServiceLabel <String>

Specifies a label for the new service.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ReverseDnsFqdn <String>

Specifies the fully-qualified domain name for reverse DNS.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServiceDescription <String>

Specifies a description for the new service.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- 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.

-------------------------- 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.



RELATED LINKS

Add-AzureDataDisk

Add-AzureProvisioningConfig

Get-AzureVMImage

New-AzureVMConfig