New-WAPackVMSubnet

Creates a virtual machine subnet.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

New-WAPackVMSubnet
   -VNet <VMNetwork>
   -Name <String>
   -Subnet <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The New-WAPackVMSubnet cmdlet creates a virtual machine subnet.

Examples

Example 1: Create a virtual machine subnet

PS C:\> $VNet = Get-WAPackVNet -Name "ContosoVNet01"
PS C:\> New-WAPackVMSubnet -VNet $VNet -Name "ContosoVMSubnet01" -Subnet "192.168.1.0/24"

The first command first retrieves the virtual machine network to which we want to add a new virtual machine subnet. This virtual machine network is named ContosoVNet01.

The second command creates a virtual machine subnet using the previously retrieve virtual machine network, a name ContosoVMSubnet01 and a subnet 192.168.1.0/24.

Parameters

-Name

Specifies a name for the virtual machine subnet.

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

-Subnet

Specifies a subnet for the virtual machine subnet.

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

-VNet

Specifies a VNet associated with the virtual machine subnet.

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