Share via

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

Goto, Nanami/後藤 七海 1 Reputation point
2021-08-03T11:16:32.093+00:00

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
Azure Virtual Network

An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.

0 comments No comments

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 50,197 Reputation points Microsoft Employee Moderator
    2021-08-03T13:01:34.483+00:00

    Hello @Goto, Nanami/後藤 七海 ,

    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://learn.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.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.