question

GotoNanami-5636 avatar image
0 Votes"
GotoNanami-5636 asked GitaraniSharmaMSFT-4262 edited

Get-AzVirtualNetworkPeering のオプション Remotegatewaysが取る値について

PowerShellからvNetのピアリングを設定しています。
ゲートウェイ転送ができるように設定したいのですが、Get-AzVirtualNetworkPeeringを実行したときに表示される、オプション:RemoteGatewaysの設定値が分かりません。どなたか教えていただけないでしょうか。


$peering = @{
VirtualNetworkName = "vNet1"
ResourceGroupName = "RG1"
Name = "peer10"
}

$peer = Get-AzVirtualNetworkPeering @peering

$peer.AllowGatewayTransit = $True
$peer.AllowForwardedTraffic = $True
$peer.RemoteGateways =


Set-AzVirtualNetworkPeering -VirtualNetworkPeering $peer

azure-virtual-network
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

GitaraniSharmaMSFT-4262 avatar image
0 Votes"
GitaraniSharmaMSFT-4262 answered GitaraniSharmaMSFT-4262 edited

Hello @GotoNanami-5636 ,

Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

The Set-AzVirtualNetworkPeering cmdlet is used to configure a virtual network peering.
Reference : https://docs.microsoft.com/en-us/powershell/module/az.network/set-azvirtualnetworkpeering?view=azps-6.2.1

Get the virtual network peering you want to update information for :
$myVnet1TomyVnet2 = Get-AzVirtualNetworkPeering -VirtualNetworkName "myVnet1" -ResourceGroupName "myResourceGroup" -Name "myVnet1TomyVnet2"

Change value of AllowForwardedTraffic property :
$myVnet1ToMyVnet2.AllowForwardedTraffic = $True

Change AllowGatewayTransit property :
$myVnet1TomyVnet2.AllowGatewayTransit = $True

Change the UseRemoteGateways property :
$myVnet1TomyVnet2.UseRemoteGateways = $True

NOTE : By changing this property to $True, your peer's VNet gateway can be used. However, the peer VNet must have a gateway configured and AllowGatewayTransit must have a value of $True. This property cannot be used if a gateway has already been configured.

Update the peering with changes made :
Set-AzVirtualNetworkPeering -VirtualNetworkPeering $myVnet1ToMyVnet2

Kindly let us know if the above helps or you need further assistance on this issue.


Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.