New-AzVMConfig
Creates a configurable virtual machine object.
Syntax
New-AzVMConfig
[-VMName] <String>
[-VMSize] <String>
[[-AvailabilitySetId] <String>]
[[-LicenseType] <String>]
[-Zone <String[]>]
[-Tags <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzVMConfig
[-VMName] <String>
[-VMSize] <String>
[[-AvailabilitySetId] <String>]
[[-LicenseType] <String>]
[-IdentityType] <ResourceIdentityType>
[-IdentityId <String[]>]
[-Zone <String[]>]
[-Tags <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzVMConfig
[-VMName] <String>
[-VMSize] <String>
[[-AvailabilitySetId] <String>]
[[-LicenseType] <String>]
[-AssignIdentity]
[-Zone <String[]>]
[-Tags <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzVMConfig cmdlet creates a configurable local virtual machine object for Azure. Other cmdlets can be used to configure a virtual machine object, such as Set-AzVMOperatingSystem, Set-AzVMSourceImage, Add-AzVMNetworkInterface, and Set-AzVMOSDisk.
Examples
Example 1: Create a virtual machine object
PS C:\> $AvailabilitySet = Get-AzAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03"
PS C:\> $VirtualMachine = New-AzVMConfig -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-AzAvailabilitySet 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 |
-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: | 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
None
This cmdlet does not accept any input.