Delen via


Get-AzVirtualHubVnetConnection

Hiermee haalt u een virtuele netwerkverbinding op in een virtuele hub of vermeldt u alle virtuele netwerkverbindingen in een virtuele hub.

Syntaxis

Get-AzVirtualHubVnetConnection
   -ResourceGroupName <String>
   -ParentResourceName <String>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVirtualHubVnetConnection
   -ParentObject <PSVirtualHub>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVirtualHubVnetConnection
   -ParentResourceId <String>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Hiermee haalt u een virtuele netwerkverbinding op in een virtuele hub of vermeldt u alle virtuele netwerkverbindingen in een virtuele hub.

Voorbeelden

Voorbeeld 1

New-AzResourceGroup -Location "West US" -Name "testRG"
$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "10.0.1.0/24"
$backendSubnet  = New-AzVirtualNetworkSubnetConfig -Name backendSubnet  -AddressPrefix "10.0.2.0/24"
$remoteVirtualNetwork = New-AzVirtualNetwork -Name "MyVirtualNetwork" -ResourceGroupName "testRG" -Location "West US" -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet

$virtualWan = New-AzVirtualWan -ResourceGroupName "testRG" -Name "myVirtualWAN" -Location "West US"
New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.1.0/24"
New-AzVirtualHubVnetConnection -ResourceGroupName "testRG" -VirtualHubName "westushub" -Name "testvnetconnection" -RemoteVirtualNetwork $remoteVirtualNetwork

Get-AzVirtualHubVnetConnection -ResourceGroupName testRG -VirtualHubName westushub -Name testvnetconnection

Name                 : testvnetconnection
Id                   : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
ProvisioningState    : Succeeded
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": []
                            }
                        }

Met het bovenstaande maakt u een resourcegroep, Virtual WAN, Virtual Network, Virtual Hub in VS - centraal in die resourcegroep in Azure. Hierna wordt een virtuele netwerkverbinding gemaakt die het virtuele netwerk koppelt aan de virtuele hub.

Nadat de hubverbinding voor het virtuele netwerk is gemaakt, wordt de virtuele netwerkverbinding van de hub verkregen met behulp van de naam van de resourcegroep, de naam van de hub en de naam van de verbinding.

Voorbeeld 2

New-AzResourceGroup -Location "West US" -Name "testRG"
$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "10.0.1.0/24"
$backendSubnet  = New-AzVirtualNetworkSubnetConfig -Name backendSubnet  -AddressPrefix "10.0.2.0/24"
$remoteVirtualNetwork = New-AzVirtualNetwork -Name "MyVirtualNetwork" -ResourceGroupName "testRG" -Location "West US" -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet
$virtualWan = New-AzVirtualWan -ResourceGroupName "testRG" -Name "myVirtualWAN" -Location "West US"
New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.1.0/24"
New-AzVirtualHubVnetConnection -ResourceGroupName "testRG" -VirtualHubName "westushub" -Name "testvnetconnection" -RemoteVirtualNetwork $remoteVirtualNetwork
Get-AzVirtualHubVnetConnection -ResourceGroupName testRG -VirtualHubName westushub

Name                 : testvnetconnection
Id                   : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
ProvisioningState    : Succeeded
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": []
                            }
                        }

Met het bovenstaande maakt u een resourcegroep, Virtual WAN, Virtual Network, Virtual Hub in VS - centraal in die resourcegroep in Azure. Hierna wordt een virtuele netwerkverbinding gemaakt die het virtuele netwerk koppelt aan de virtuele hub.

Nadat de hubverbinding voor het virtuele netwerk is gemaakt, worden alle virtuele hubnetwerkverbindingen weergegeven met behulp van de naam van de resourcegroep en de naam van de hub.

Voorbeeld 3

Get-AzVirtualHubVnetConnection -ResourceGroupName testRG -VirtualHubName westushub -Name test*

Name                 : testvnetconnection1
Id                   : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection1
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
ProvisioningState    : Succeeded
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": []
                            }
                        }

Name                 : testvnetconnection2
Id                   : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection2
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
ProvisioningState    : Succeeded
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": []
                            }
                        }

Met deze cmdlet worden alle virtuele hubnetwerkverbindingen vermeld die beginnen met 'testen' met behulp van de naam van de resourcegroep en de naam van de hub.

Parameters

-DefaultProfile

De referenties, accounts, tenants en abonnementen die worden gebruikt voor communicatie met Azure.

Type:IAzureContextContainer
Aliassen:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Vereist:False
Pijplijninvoer accepteren:False
Jokertekens accepteren:False

-Name

De resourcenaam.

Type:String
Aliassen:ResourceName, HubVirtualNetworkConnectionName
Position:Named
Default value:None
Vereist:False
Pijplijninvoer accepteren:False
Jokertekens accepteren:True

-ParentObject

De bovenliggende resource.

Type:PSVirtualHub
Aliassen:VirtualHub, ParentVirtualHub
Position:Named
Default value:None
Vereist:True
Pijplijninvoer accepteren:True
Jokertekens accepteren:False

-ParentResourceId

De bovenliggende resource-id.

Type:String
Aliassen:VirtualHubId, ParentVirtualHubId
Position:Named
Default value:None
Vereist:True
Pijplijninvoer accepteren:True
Jokertekens accepteren:False

-ParentResourceName

De naam van de bovenliggende resource.

Type:String
Aliassen:VirtualHubName, ParentVirtualHubName
Position:Named
Default value:None
Vereist:True
Pijplijninvoer accepteren:False
Jokertekens accepteren:False

-ResourceGroupName

De naam van de resourcegroep.

Type:String
Position:Named
Default value:None
Vereist:True
Pijplijninvoer accepteren:False
Jokertekens accepteren:False

Invoerwaarden

PSVirtualHub

String

Uitvoerwaarden

PSHubVirtualNetworkConnection