< Back

Set-AzureRmVirtualNetwork

Tue Jan 29, 2019 9:58 pm

NAME Set-AzureRmVirtualNetwork



SYNOPSIS

Sets the goal state for a virtual network.





SYNTAX

Set-AzureRmVirtualNetwork [-AsJob] [-DefaultProfile <IAzureContextContainer>] -VirtualNetwork <PSVirtualNetwork> [<CommonParameters>]





DESCRIPTION

The Set-AzureRmVirtualNetwork cmdlet sets the goal state for an Azure virtual network.





PARAMETERS

-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

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



-VirtualNetwork <PSVirtualNetwork>

Specifies a VirtualNetwork object that represents the goal state.



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: Creates a virtual network and removes one of its subnets



New-AzureRmResourceGroup -Name TestResourceGroup -Location centralus

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



$backendSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name backendSubnet -AddressPrefix "10.0.2.0/24"



$virtualNetwork = New-AzureRmVirtualNetwork -Name MyVirtualNetwork -ResourceGroupName

TestResourceGroup -Location centralus -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet



Remove-AzureRmVirtualNetworkSubnetConfig -Name backendSubnet -VirtualNetwork $virtualNetwork



$virtualNetwork | Set-AzureRmVirtualNetwork



This example creates a virtual network with two subnets. Then it removes one subnet from the in-memory representation of the virtual network.

The Set-AzureRmVirtualNetwork cmdlet is then used to write the modified virtual network state on the service side.







RELATED LINKS

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

Get-AzureRmVirtualNetwork

Get-AzureRmVirtualNetwork

New-AzureRmVirtualNetwork

Remove-AzureRmVirtualNetwork