New-AzureRmVMConfig

Creates a configurable virtual machine object.

Syntax

New-AzureRmVMConfig
   [-VMName] <String>
   [-VMSize] <String>
   [[-AvailabilitySetId] <String>]
   [[-LicenseType] <String>]
   [[-IdentityType] <ResourceIdentityType>]
   [-AssignIdentity]
   [-Zone <String[]>]
   [-Tags <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzureRmVMConfig cmdlet creates a configurable local virtual machine object for Azure. Other cmdlets can be used to configure a virtual machine object, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, Add-AzureRmVMNetworkInterface, and Set-AzureRmVMOSDisk.

Examples

Example 1: Create a virtual machine object

PS C:\> $AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03"
PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id

The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable.

The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet.

Required Parameters

-VMName

Specifies a name for the virtual machine.

Type:String
Aliases:ResourceName, Name
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VMSize

Specifies the size for the virtual machine.

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

Optional Parameters

-AssignIdentity

Specify the system assigned identity for the virtual machine.

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-AvailabilitySetId

Specifies the ID of an availability set. To obtain an availability set object, use the Get-AzureRmAvailabilitySet cmdlet. The availability set object contains an ID property.

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

The credentials, account, tenant, and subscription used for communication with azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IdentityType

The identity of the virtual machine, if configured.

Type:System.Nullable`1[Microsoft.Azure.Management.Compute.Models.ResourceIdentityType]
Parameter Sets:SystemAssigned
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-LicenseType

The license type, which is for bringing your own license scenario.

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

The tags attached to the resource.

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Zone

Specifies the zone list for the virtual machine.

Type:System.String[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False