Sync-AzVirtualNetworkPeering

Command to sync the address space on the peering link if the remote virtual network has a new address space.

Syntax

Sync-AzVirtualNetworkPeering
    -VirtualNetworkName <String>
    -ResourceGroupName <String>
    -Name <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Sync-AzVirtualNetworkPeering
    -VirtualNetworkPeering <PSVirtualNetworkPeering>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

Updating the address space on peered virtual networks is now supported. However, to sync the latest address space on the peering link, this commandlet needs to be called on the (peered) remote virtual network. When invoked, it would sync the address space on the peering link with the latest address space of the (peered) remote virtual network.

Examples

Example 1

PS C:\> Sync-AzVirtualNetworkPeering -Name 'peering2' -VirtualNetworkName 'vnet1' -ResourceGroupName 'rg1'

Syncs the address space on the peering, peering2 in the virtual network, vnet1 within the resource group, rg1.

Example 2

PS C:\> $s1h1 = Get-AzVirtualNetworkPeering -Name 'spoke1-hub1' -VirtualNetworkName 'spoke1' -ResourceGroupName 'HUB1-RG'
PS C:\> $s1h1 | Sync-AzVirtualNetworkPeering

The first commandlet gets the virtual network peering. The second piped commandlet applies the sync operation on the peering.

Parameters

-DefaultProfile

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

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

The virtual network peering name.

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

The resource group name.

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

The virtual network name.

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

The virtual network peering

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

Inputs

String

PSVirtualNetworkPeering

Outputs

PSVirtualNetworkPeering