Bagikan melalui


Set-AzVirtualNetworkPeering

Mengonfigurasi peering jaringan virtual.

Sintaks

Set-AzVirtualNetworkPeering
   -VirtualNetworkPeering <PSVirtualNetworkPeering>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Deskripsi

Cmdlet Set-AzVirtualNetworkPeering mengonfigurasi peering jaringan virtual.

Contoh

Contoh 1: Mengubah konfigurasi lalu lintas yang diteruskan dari peering jaringan virtual

# Get the virtual network peering you want to update information for
$myVnet1ToMyVnet2 = Get-AzVirtualNetworkPeering -VirtualNetworkName "myVnet1" -ResourceGroupName "ResourceGroup" -Name "myVnet1ToMyVnet2"

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

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

Contoh 2: Mengubah akses jaringan virtual dari peering jaringan virtual

# Get the virtual network peering
$myVnet1TomyVnet2 = Get-AzVirtualNetworkPeering -VirtualNetworkName "myVnet1" -ResourceGroupName "myResourceGroup" -Name "myVnet1TomyVnet2"

# Change AllowVirtualNetworkAccess property
$myVnet1TomyVnet2.AllowVirtualNetworkAccess = $False

# Update virtual network peering
Set-AzVirtualNetworkPeering -VirtualNetworkPeering $myVnet1TomyVnet2

Contoh 3: Mengubah konfigurasi properti transit gateway dari peering jaringan virtual

# Get the virtual network peering
$myVnet1TomyVnet2 = Get-AzVirtualNetworkPeering -VirtualNetworkName "myVnet1" -ResourceGroupName "myResourceGroup" -Name "myVnet1TomyVnet2"

# Change AllowGatewayTransit property
$myVnet1TomyVnet2.AllowGatewayTransit = $True

# Update the virtual network peering
Set-AzVirtualNetworkPeering -VirtualNetworkPeering $myVnet1TomyVnet2

Contoh 4: Menggunakan gateway jarak jauh dalam peering jaringan virtual

# Get the virtual network peering 
$myVnet1TomyVnet2 = Get-AzVirtualNetworkPeering -VirtualNetworkName "myVnet1" -ResourceGroupName "ResourceGroup001" -Name "myVnet1TomyVnet2"

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

# Update the virtual network peering
Set-AzVirtualNetworkPeering -VirtualNetworkPeering $myVnet1TomyVnet2

Dengan mengubah properti ini menjadi $True, gateway VNet serekan Anda dapat digunakan. Namun, VNet serekan harus memiliki gateway yang dikonfigurasi dan AllowGatewayTransit harus memiliki nilai $True. Properti ini tidak dapat digunakan jika gateway telah dikonfigurasi.

Parameter

-AsJob

Jalankan cmdlet di latar belakang

Jenis:SwitchParameter
Position:Named
Nilai default:None
Diperlukan:False
Terima input alur:False
Terima karakter wildcard:False

-DefaultProfile

Kredensial, akun, penyewa, dan langganan yang digunakan untuk komunikasi dengan azure.

Jenis:IAzureContextContainer
Alias:AzContext, AzureRmContext, AzureCredential
Position:Named
Nilai default:None
Diperlukan:False
Terima input alur:False
Terima karakter wildcard:False

-VirtualNetworkPeering

Menentukan peering jaringan virtual.

Jenis:PSVirtualNetworkPeering
Position:Named
Nilai default:None
Diperlukan:True
Terima input alur:True
Terima karakter wildcard:False

Input

PSVirtualNetworkPeering

Output

PSVirtualNetworkPeering