< Back

Add-AzureRmVirtualNetworkSubnetConfig

Tue Jan 29, 2019 9:53 pm

NAME Add-AzureRmVirtualNetworkSubnetConfig



SYNOPSIS

Adds a subnet configuration to a virtual network.





SYNTAX

Add-AzureRmVirtualNetworkSubnetConfig -AddressPrefix <String> [-DefaultProfile <IAzureContextContainer>] -Name <String> [-NetworkSecurityGroup

<PSNetworkSecurityGroup>] [-RouteTable <PSRouteTable>] [-ServiceEndpoint <System.Collections.Generic.List`1[System.String]>] -VirtualNetwork

<PSVirtualNetwork> [<CommonParameters>]



Add-AzureRmVirtualNetworkSubnetConfig -AddressPrefix <String> [-DefaultProfile <IAzureContextContainer>] -Name <String> [-NetworkSecurityGroupId

<String>] [-RouteTableId <String>] [-ServiceEndpoint <System.Collections.Generic.List`1[System.String]>] -VirtualNetwork <PSVirtualNetwork>

[<CommonParameters>]





DESCRIPTION

The Add-AzureRmVirtualNetworkSubnetConfig cmdlet adds a subnet configuration to an existing Azure virtual network.





PARAMETERS

-AddressPrefix <String>

Specifies a range of IP addresses for a subnet configuration.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the name of the subnet configuration to add.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-NetworkSecurityGroup <PSNetworkSecurityGroup>

Specifies a NetworkSecurityGroup object. This cmdlet adds a virtual network subnet configuration to the object that this parameter specifies.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-NetworkSecurityGroupId <String>

Specifies the ID of a network security group.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RouteTable <PSRouteTable>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-RouteTableId <String>





Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServiceEndpoint <System.Collections.Generic.List`1[System.String]>

Service Endpoint Value



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VirtualNetwork <PSVirtualNetwork>

Specifies the VirtualNetwork object in which to add a subnet configuration.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

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 (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PSVirtualNetwork

Parameter 'VirtualNetwork' accepts value of type 'PSVirtualNetwork' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork







NOTES









1: Add a subnet to an existing virtual network



New-AzureRmResourceGroup -Name TestResourceGroup -Location centralus

$frontendSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "10.0.1.0/24"

$virtualNetwork = New-AzureRmVirtualNetwork -Name MyVirtualNetwork -ResourceGroupName TestResourceGroup -Location centralus -AddressPrefix

"10.0.0.0/16" -Subnet $frontendSubnet

Add-AzureRmVirtualNetworkSubnetConfig -Name backendSubnet -VirtualNetwork $virtualNetwork -AddressPrefix "10.0.2.0/24"

$virtualNetwork | Set-AzureRmVirtualNetwork



This example first creates a resource group as a container of the resources to be created. It then creates a subnet configuration and uses it to

create a virtual network. The Add-AzureRmVirtualNetworkSubnetConfig is then used to add a subnet to the in-memory representation of the

virtual network. The Set-AzureRmVirtualNetwork command updates the existing virtual network with the new subnet.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... bnetconfig

Get-AzureRmVirtualNetworkSubnetConfig

New-AzureRmVirtualNetworkSubnetConfig

Remove-AzureRmVirtualNetworkSubnetConfig

Set-AzureRmVirtualNetworkSubnetConfig