Set-AzVirtualNetworkGatewayConnection
Configura una connessione gateway di rete virtuale.
Sintassi
Set-AzVirtualNetworkGatewayConnection
-VirtualNetworkGatewayConnection <PSVirtualNetworkGatewayConnection>
[-EnableBgp <Boolean>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-UseLocalAzureIpAddress <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
[-GatewayCustomBgpIpAddress <PSGatewayCustomBgpIpConfiguration[]>]
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzVirtualNetworkGatewayConnection
-VirtualNetworkGatewayConnection <PSVirtualNetworkGatewayConnection>
[-EnableBgp <Boolean>]
[-DpdTimeoutInSeconds <Int32>]
[-ConnectionMode <String>]
[-UsePolicyBasedTrafficSelectors <Boolean>]
[-UseLocalAzureIpAddress <Boolean>]
[-IpsecPolicies <PSIpsecPolicy[]>]
[-TrafficSelectorPolicy <PSTrafficSelectorPolicy[]>]
[-IngressNatRule <PSResourceId[]>]
[-EgressNatRule <PSResourceId[]>]
[-GatewayCustomBgpIpAddress <PSGatewayCustomBgpIpConfiguration[]>]
-Tag <Hashtable>
[-Force]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Descrizione
Il cmdlet Set-AzVirtualNetworkGatewayConnection configura una connessione gateway di rete virtuale.
Esempio
Esempio 1:
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
Esempio 2: Aggiungere/aggiornare tag a un virtualNetworkGatewayConnection esistente
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -Tag @{ testtagKey="SomeTagKey"; testtagValue="SomeKeyValue" }
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
Name Value
============ ============
testtagValue SomeKeyValue
testtagKey SomeTagKey
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
Esempio 3: Aggiungere/rimuovere natRules a un virtualNetworkGatewayConnection esistente
$conn = Get-AzVirtualNetworkGatewayConnection -Name 1 -ResourceGroupName myRG
$egressNatrule = Get-AzVirtualNetworkGatewayNatRule -ResourceGroupName myRG -Name "natRule1" -ParentResourceName "gw1"
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -IngressNatRule @() -EgressNatRule $egressNatrule
Confirm
Are you sure you want to overwrite resource '1'
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Name : 1
ResourceGroupName : myRG
Location : westus
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Mi
crosoft.Network/connections/1
Etag : W/"00000000-0000-0000-0000-000000000000"
ResourceGuid : 00000000-0000-0000-0000-000000000000
ProvisioningState : Succeeded
Tags :
Name Value
============ ============
testtagValue SomeKeyValue
testtagKey SomeTagKey
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/M
icrosoft.Network/virtualNetworkGateways/myGateway"
VirtualNetworkGateway2 : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S2SVnetConn/providers/Mic
rosoft.Network/virtualNetworkGateways/S2SConnGW"
LocalNetworkGateway2 :
Peer :
RoutingWeight : 0
SharedKey :
ConnectionStatus : Connected
EgressBytesTransferred : 91334484
IngressBytesTransferred : 100386089
TunnelConnectionStatus : []
IngressNatRules : []
EgressNatRules : [
{
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworkGateways/gw1/natRules/natRule1"
}
]
Il primo comando ottiene una connessione gateway di rete virtuale denominata 1 che appartiene al gruppo di risorse myRG e la archivia alla variabile denominata $conn. Il secondo comando ottiene il gateway di rete virtuale natRule denominato natRule1 e lo archivia nella variabile denominata $egressNatrule. Il terzo comando imposta la connessione del gateway di rete virtuale con tutte le proprietà IngressNatRules e aggiunge egressNatrule in EgressNatRules.
Esempio 3: Aggiungere/rimuovere gatewayCustomBgpIpAddress a un virtualNetworkGatewayConnection esistente
$address1 = New-AzGatewayCustomBgpIpConfigurationObject -IpConfigurationId "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw/ipConfigurations/default" -CustomBgpIpAddress "169.254.21.1"
$address2 = New-AzGatewayCustomBgpIpConfigurationObject -IpConfigurationId "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw/ipConfigurations/ActiveActive" -CustomBgpIpAddress "169.254.21.3"
$conn = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName PS_testing -ResourceName Conn
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -GatewayCustomBgpIpAddress $address1,$address2
Name : Conn
ResourceGroupName : PS_testing
Location : eastus
Id : /subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/connections/Conn
Etag : W/"e867e7bb-fa2e-436e-8822-70c556ec0f03"
ResourceGuid : 9c33f4f7-b09c-4080-932e-a44405a8c252
ProvisioningState : Succeeded
Tags :
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw"
VirtualNetworkGateway2 :
LocalNetworkGateway2 : "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/localNetworkGateways/testLng"
Peer :
RoutingWeight : 3
SharedKey : abc
ExpressRouteGatewayBypass : False
EnablePrivateLinkFastPath : False
ConnectionStatus : Unknown
EgressBytesTransferred : 0
IngressBytesTransferred : 0
TunnelConnectionStatus : []
IngressNatRules : []
EgressNatRules : []
GatewayCustomBgpIpAddresses : [
{
"IpconfigurationId":
"/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw/ipConfigurations/default",
"CustomBgpIpAddress": "169.254.21.1"
},
{
"IpconfigurationId":
"/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw/ipConfigurations/ActiveActive",
"CustomBgpIpAddress": "169.254.21.3"
}
]
Verrà creata una nuova connessione azGatewayCustomBgpIpConfigurationObjects e verrà aggiornata la connessione gateway con gatewayCustomBgpIpAddress.
Esempio 4: Rimuovere GatewayCustomBgpIpAddress a una connessione VirtualNetworkGatewayConnection esistente
$conn = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName PS_testing -ResourceName Conn
Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $conn -GatewayCustomBgpIpAddress @()
Name : Conn
ResourceGroupName : PS_testing
Location : eastus
Id : /subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/connections/Conn
Etag : W/"863d9b89-a030-42ba-9f71-58d5bc3336a9"
ResourceGuid : 9c33f4f7-b09c-4080-932e-a44405a8c252
ProvisioningState : Succeeded
Tags :
AuthorizationKey :
VirtualNetworkGateway1 : "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/virtualNetworkGateways/testGw"
VirtualNetworkGateway2 :
LocalNetworkGateway2 : "/subscriptions/83704d68-d560-4c67-b1c7-12404db89dc3/resourceGroups/PS_testing/providers/Microsoft.Network/localNetworkGateways/testLng"
Peer :
RoutingWeight : 3
SharedKey : abc
ExpressRouteGatewayBypass : False
EnablePrivateLinkFastPath : False
ConnectionStatus : NotConnected
EgressBytesTransferred : 0
IngressBytesTransferred : 0
TunnelConnectionStatus : []
IngressNatRules : []
EgressNatRules : []
GatewayCustomBgpIpAddresses : []
Verrà aggiornata la connessione gateway con la rimozione di questi gatewayCustomBgpIpAddress.
Parametri
-AsJob
Eseguire il cmdlet in background
Tipo: | SwitchParameter |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-Confirm
Richiede conferma prima di eseguire il cmdlet.
Tipo: | SwitchParameter |
Alias: | cf |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-ConnectionMode
Rete virtuale modalità di connessione gateway.
Tipo: | String |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-DefaultProfile
Le credenziali, l’account, il tenant e la sottoscrizione usati per comunicare con Azure.
Tipo: | IAzureContextContainer |
Alias: | AzContext, AzureRmContext, AzureCredential |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-DpdTimeoutInSeconds
Timeout rilevamento peer non recapitabili della connessione in secondi.
Tipo: | Nullable<T>[Int32] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-EgressNatRule
Elenco delle regole NAT in uscita associate a questa connessione.
Tipo: | PSResourceId[] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-EnableBgp
Indica se usare una sessione BGP tramite un tunnel VPN da sito a sito
Tipo: | Nullable<T>[Boolean] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-Force
Non chiedere conferma se si desidera sovrascrivere una risorsa
Tipo: | SwitchParameter |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-GatewayCustomBgpIpAddress
GatewayCustomBgpIpAddress del gateway di rete virtuale usato in questa connessione.
Tipo: | PSGatewayCustomBgpIpConfiguration[] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-IngressNatRule
Elenco di regole NAT in ingresso associate a questa connessione.
Tipo: | PSResourceId[] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-IpsecPolicies
Elenco dei criteri IPSec.
Tipo: | PSIpsecPolicy[] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-Tag
Tabella hash che rappresenta i tag delle risorse.
Tipo: | Hashtable |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | True |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-TrafficSelectorPolicy
Elenco dei criteri del selettore di traffico.
Tipo: | PSTrafficSelectorPolicy[] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-UseLocalAzureIpAddress
Indica se usare PrivateIP per una connessione da sito a sito
Tipo: | Nullable<T>[Boolean] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-UsePolicyBasedTrafficSelectors
Indica se usare selettori di traffico basati su criteri per una connessione da sito a sito
Tipo: | Nullable<T>[Boolean] |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
-VirtualNetworkGatewayConnection
The VirtualNetworkGatewayConnection
Tipo: | PSVirtualNetworkGatewayConnection |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | True |
Accettare l'input della pipeline: | True |
Accettare caratteri jolly: | False |
-WhatIf
Mostra gli effetti dell'esecuzione del cmdlet. Il cmdlet non viene eseguito.
Tipo: | SwitchParameter |
Alias: | wi |
Posizione: | Named |
Valore predefinito: | None |
Necessario: | False |
Accettare l'input della pipeline: | False |
Accettare caratteri jolly: | False |
Input
PSVirtualNetworkGatewayConnection
Nullable<T>[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Nullable<T>[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
PSGatewayCustomBgpIpConfiguration[]
Output
PSVirtualNetworkGatewayConnection