Set-AzVirtualNetworkGatewayConnection
Configura uma conexão de gateway de rede virtual.
Sintaxe
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>]
Description
O cmdlet Set-AzVirtualNetworkGatewayConnection configura uma conexão de gateway de rede virtual.
Exemplos
Exemplo 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 : []
Exemplo 2: adicionar/atualizar marcas a um VirtualNetworkGatewayConnection existente
$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 : []
Exemplo 3: Adicionar/Remover natRules a um VirtualNetworkGatewayConnection existente
$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"
}
]
O primeiro comando obtém uma conexão de gateway de rede virtual chamada 1 que pertence ao myRG do grupo de recursos e a armazena na variável chamada $conn. O segundo comando obtém o natRule de gateway de rede virtual chamado natRule1 e o armazena na variável chamada $egressNatrule. O terceiro comando define a conexão de gateway de rede virtual com todos os IngressNatRules removidos e adiciona egressNatrule a EgressNatRules.
Exemplo 3: Adicionar/Remover GatewayCustomBgpIpAddress a um VirtualNetworkGatewayConnection existente
$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"
}
]
Isso criará um novo AzGatewayCustomBgpIpConfigurationObjects e atualizará a conexão de gateway com esses GatewayCustomBgpIpAddress.
Exemplo 4: Remover GatewayCustomBgpIpAddress para um VirtualNetworkGatewayConnection existente
$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 : []
Isso atualizará a conexão de gateway com a remoção desses GatewayCustomBgpIpAddress.
Parâmetros
-AsJob
Executar cmdlet em segundo plano
Tipo: | SwitchParameter |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-Confirm
Solicita a confirmação antes de executar o cmdlet.
Tipo: | SwitchParameter |
Aliases: | cf |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-ConnectionMode
Modo de Conexão do Gateway de Rede Virtual.
Tipo: | String |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-DefaultProfile
As credenciais, a conta, o locatário e a assinatura usados para comunicação com o Azure.
Tipo: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-DpdTimeoutInSeconds
Tempo limite de detecção de pares mortos da conexão em segundos.
Tipo: | Nullable<T>[Int32] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-EgressNatRule
A lista de regras NAT de saída associadas a essa Conexão.
Tipo: | PSResourceId[] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-EnableBgp
Se deve usar uma sessão BGP em um túnel VPN S2S
Tipo: | Nullable<T>[Boolean] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-Force
Não peça confirmação se você deseja substituir um recurso
Tipo: | SwitchParameter |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-GatewayCustomBgpIpAddress
O GatewayCustomBgpIpAddress do gateway de rede virtual usado nessa conexão.
Tipo: | PSGatewayCustomBgpIpConfiguration[] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-IngressNatRule
A lista de regras NAT de entrada associadas a essa Conexão.
Tipo: | PSResourceId[] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-IpsecPolicies
Uma lista de políticas IPSec.
Tipo: | PSIpsecPolicy[] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-Tag
Um hashtable que representa marcas de recurso.
Tipo: | Hashtable |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | True |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-TrafficSelectorPolicy
Uma lista de políticas de seletor de tráfego.
Tipo: | PSTrafficSelectorPolicy[] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-UseLocalAzureIpAddress
Se deve usar o PrivateIP para uma conexão S2S
Tipo: | Nullable<T>[Boolean] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-UsePolicyBasedTrafficSelectors
Se deve usar seletores de tráfego baseados em política para uma conexão S2S
Tipo: | Nullable<T>[Boolean] |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
-VirtualNetworkGatewayConnection
O VirtualNetworkGatewayConnection
Tipo: | PSVirtualNetworkGatewayConnection |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | True |
Aceitar a entrada de pipeline: | True |
Aceitar caracteres curinga: | False |
-WhatIf
Mostra o que aconteceria se o cmdlet fosse executado. O cmdlet não é executado.
Tipo: | SwitchParameter |
Aliases: | wi |
Cargo: | Named |
Valor padrão: | None |
Obrigatório: | False |
Aceitar a entrada de pipeline: | False |
Aceitar caracteres curinga: | False |
Entradas
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[]
Saídas
PSVirtualNetworkGatewayConnection
Links Relacionados
Azure PowerShell