Get-AzVpnConnection
Obtém uma conexão vpn por nome ou lista todas as conexões vpn conectadas a um VpnGateway.
Nota
Este comando Powershell destina-se apenas a clientes que utilizam o Virtual WAN Site-to-site VPN Gateway.
Sintaxe
Get-AzVpnConnection
-ResourceGroupName <String>
-ParentResourceName <String>
[-Name <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVpnConnection
-ParentObject <PSVpnGateway>
[-Name <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVpnConnection
-ParentResourceId <String>
[-Name <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Obtém uma conexão vpn por nome ou lista todas as conexões vpn conectadas a um VpnGateway.
Exemplos
Exemplo 1
New-AzResourceGroup -Location "West US" -Name "testRG"
$virtualWan = New-AzVirtualWan -ResourceGroupName testRG -Name myVirtualWAN -Location "West US"
$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24"
New-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw" -VirtualHubId $virtualHub.Id -VpnGatewayScaleUnit 2
$vpnGateway = Get-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw"
$vpnSiteAddressSpaces = New-Object string[] 2
$vpnSiteAddressSpaces[0] = "192.168.2.0/24"
$vpnSiteAddressSpaces[1] = "192.168.3.0/24"
$vpnSite = New-AzVpnSite -ResourceGroupName "testRG" -Name "testVpnSite" -Location "West US" -VirtualWan $virtualWan -IpAddress "1.2.3.4" -AddressSpace $vpnSiteAddressSpaces -DeviceModel "SomeDevice" -DeviceVendor "SomeDeviceVendor" -LinkSpeedInMbps "10"
New-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection" -VpnSite $vpnSite
Get-AzVpnConnection -ResourceGroupName $vpnGateway.ResourceGroupName -ParentResourceName $vpnGateway.Name -Name "testConnection"
RemoteVpnSite : Microsoft.Azure.Commands.Network.Models.PSResourceId
SharedKey :
VpnConnectionProtocolType : IKEv2
ConnectionStatus :
EgressBytesTransferred : 0
IngressBytesTransferred : 0
IpsecPolicies : {}
ConnectionBandwidth : 20
EnableBgp : False
ProvisioningState : testConnection
Name : ps9709
Etag : W/"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Id : /subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/vpnGateways/testvpngw/vpnConnections/testConnection
RoutingConfiguration : {
"AssociatedRouteTable": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
"PropagatedRouteTables": {
"Labels": [],
"Ids": [
{
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
]
},
"VnetRoutes": {
"StaticRoutes": []
}
}
O acima criará um grupo de recursos, WAN Virtual, Rede Virtual, Hub Virtual e um VpnSite no oeste dos EUA no grupo de recursos "testRG" no Azure. Um gateway VPN será criado posteriormente no Hub Virtual com 2 unidades de escala.
Uma vez que o gateway tenha sido criado, ele é conectado ao VpnSite usando o comando New-AzVpnConnection.
Em seguida, ele obtém a conexão usando o nome da conexão.
Exemplo 2
Get-AzVpnConnection -ResourceGroupName ps9361 -ParentResourceName testvpngw -Name test*
RemoteVpnSite : Microsoft.Azure.Commands.Network.Models.PSResourceId
SharedKey :
VpnConnectionProtocolType : IKEv2
ConnectionStatus :
EgressBytesTransferred : 0
IngressBytesTransferred : 0
IpsecPolicies : {}
ConnectionBandwidth : 20
EnableBgp : False
ProvisioningState : testConnection
Name : ps9709
Etag : W/"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Id : /subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/vpnGateways/testvpngw/vpnConnections/testConnection1
RoutingConfiguration : {
"AssociatedRouteTable": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
"PropagatedRouteTables": {
"Labels": [],
"Ids": [
{
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
]
},
"VnetRoutes": {
"StaticRoutes": []
}
}
RemoteVpnSite : Microsoft.Azure.Commands.Network.Models.PSResourceId
SharedKey :
VpnConnectionProtocolType : IKEv2
ConnectionStatus :
EgressBytesTransferred : 0
IngressBytesTransferred : 0
IpsecPolicies : {}
ConnectionBandwidth : 20
EnableBgp : False
ProvisioningState : testConnection
Name : ps9709
Etag : W/"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Id : /subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/vpnGateways/testvpngw/vpnConnections/testConnection2
RoutingConfiguration : {
"AssociatedRouteTable": {
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
"PropagatedRouteTables": {
"Labels": [],
"Ids": [
{
"Id": "/subscriptions/{subscriptionId}/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/westushub/hubRouteTables/defaultRouteTable"
}
]
},
"VnetRoutes": {
"StaticRoutes": []
}
}
Este cmdlet obtém todas as conexões que começam com "test".
Parâmetros
-DefaultProfile
As credenciais, a conta, o locatário e a assinatura usados para comunicação com o Azure.
Tipo: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Necessário: | False |
Aceitar entrada de pipeline: | False |
Aceitar carateres universais: | False |
-Name
O nome do recurso.
Tipo: | String |
Aliases: | ResourceName, VpnConnectionName |
Position: | Named |
Default value: | None |
Necessário: | False |
Aceitar entrada de pipeline: | False |
Aceitar carateres universais: | True |
-ParentObject
O VpnGateway pai para esta conexão.
Tipo: | PSVpnGateway |
Aliases: | ParentVpnGateway, VpnGateway |
Position: | Named |
Default value: | None |
Necessário: | True |
Aceitar entrada de pipeline: | True |
Aceitar carateres universais: | False |
-ParentResourceId
A ID de recurso do VpnGateway pai para esta conexão.
Tipo: | String |
Aliases: | ParentVpnGatewayId, VpnGatewayId |
Position: | Named |
Default value: | None |
Necessário: | True |
Aceitar entrada de pipeline: | True |
Aceitar carateres universais: | False |
-ParentResourceName
O nome do recurso pai.
Tipo: | String |
Aliases: | ParentVpnGatewayName, VpnGatewayName |
Position: | Named |
Default value: | None |
Necessário: | True |
Aceitar entrada de pipeline: | False |
Aceitar carateres universais: | False |
-ResourceGroupName
O nome do grupo de recursos.
Tipo: | String |
Position: | Named |
Default value: | None |
Necessário: | True |
Aceitar entrada de pipeline: | False |
Aceitar carateres universais: | False |