New-AzureRmVMConfig

Creates a configurable virtual machine object.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmVMConfig
   [-VMName] <String>
   [-VMSize] <String>
   [[-AvailabilitySetId] <String>]
   [[-LicenseType] <String>]
   [-Zone <String[]>]
   [-Tags <Hashtable>]
   [-EnableUltraSSD]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzureRmVMConfig
   [-VMName] <String>
   [-VMSize] <String>
   [[-AvailabilitySetId] <String>]
   [[-LicenseType] <String>]
   [-IdentityType] <ResourceIdentityType>
   [-IdentityId <String[]>]
   [-Zone <String[]>]
   [-Tags <Hashtable>]
   [-EnableUltraSSD]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
New-AzureRmVMConfig
   [-VMName] <String>
   [-VMSize] <String>
   [[-AvailabilitySetId] <String>]
   [[-LicenseType] <String>]
   [-AssignIdentity]
   [-Zone <String[]>]
   [-Tags <Hashtable>]
   [-EnableUltraSSD]
   [-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.

Parameters

-AssignIdentity

Specify the system assigned identity for the virtual machine.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableUltraSSD

Enables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine only if this property is enabled.

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

-IdentityId

Specifies the list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IdentityType

The identity of the virtual machine, if configured.

Type:Nullable<T>[ResourceIdentityType]
Accepted values:SystemAssigned, UserAssigned, SystemAssignedUserAssigned, None
Position:4
Default value:None
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tags

The tags attached to the resource.

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VMName

Specifies a name for the virtual machine.

Type:String
Aliases:ResourceName, Name
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMSize

Specifies the size for the virtual machine.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Zone

Specifies the zone list for the virtual machine.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

String[]

Hashtable

Outputs

PSVirtualMachine