New-AzVirtualHubVnetConnection
Met de cmdlet New-AzVirtualHubVnet Verbinding maken ion maakt u een HubVirtualNetwork Verbinding maken ion-resource die een virtueel netwerk koppelt aan de Virtuele Azure-hub.
Syntax
New-AzVirtualHubVnetConnection
-ResourceGroupName <String>
-ParentResourceName <String>
-Name <String>
-RemoteVirtualNetwork <PSVirtualNetwork>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualHubVnetConnection
-ResourceGroupName <String>
-ParentResourceName <String>
-Name <String>
-RemoteVirtualNetworkId <String>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualHubVnetConnection
-ParentObject <PSVirtualHub>
-Name <String>
-RemoteVirtualNetwork <PSVirtualNetwork>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualHubVnetConnection
-ParentObject <PSVirtualHub>
-Name <String>
-RemoteVirtualNetworkId <String>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualHubVnetConnection
-ParentResourceId <String>
-Name <String>
-RemoteVirtualNetwork <PSVirtualNetwork>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzVirtualHubVnetConnection
-ParentResourceId <String>
-Name <String>
-RemoteVirtualNetworkId <String>
[-EnableInternetSecurity]
[-EnableInternetSecurityFlag <Boolean>]
[-RoutingConfiguration <PSRoutingConfiguration>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Met de cmdlet New-AzVirtualHubVnet Verbinding maken ion maakt u een HubVirtualNetwork Verbinding maken ion-resource die een virtueel netwerk koppelt aan de Virtuele Azure-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
Name : testvnetconnection
Id : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualHubs/westushub/hubVirtualNetworkConnections/testvnetconnection
RemoteVirtualNetwork : /subscriptions/{subscriptionId}/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/MyVirtualNetwork
EnableInternetSecurity : False
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 virtual network Verbinding maken ion gemaakt, waarmee het virtuele netwerk wordt gekoppeld aan de virtuele hub.
Voorbeeld 2
Met de cmdlet New-AzVirtualHubVnet Verbinding maken ion maakt u een HubVirtualNetwork Verbinding maken ion-resource die een virtueel netwerk koppelt aan de Virtuele Azure-hub. (automatisch gegenereerd)
New-AzVirtualHubVnetConnection -EnableInternetSecurity -Name 'testvnetconnection' -ParentResourceName 'westushub' -RemoteVirtualNetwork <PSVirtualNetwork> -ResourceGroupName 'testRG'
Voorbeeld 3
$rgName = "testRg"
$virtualHubName = "testHub"
$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 $rgName -Location "West US" -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet
$rt1 = Get-AzVHubRouteTable -ResourceGroupName $rgName -VirtualHubName $virtualHubName -Name "defaultRouteTable"
$rt2 = Get-AzVHubRouteTable -ResourceGroupName $rgName -VirtualHubName $virtualHubName -Name "noneRouteTable"
$route1 = New-AzStaticRoute -Name "route1" -AddressPrefix @("10.20.0.0/16", "10.30.0.0/16")-NextHopIpAddress "10.90.0.5"
$routingconfig = New-AzRoutingConfiguration -AssociatedRouteTable $rt1.Id -Label @("testLabel") -Id @($rt2.Id) -StaticRoute @($route1)
AssociatedRouteTable : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/testHub/hubRouteTables/defaultRouteTable"
PropagatedRouteTables : {
"Labels": [
"testLabel"
],
"Ids": [
{
"Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/testHub/hubRouteTables/noneRouteTable"
}
]
}
VnetRoutes : {
"StaticRoutes": [
{
"Name": "route1",
"AddressPrefixes": [
"10.20.0.0/16",
"10.30.0.0/16"
],
"NextHopIpAddress": "10.90.0.5"
}
]
}
New-AzVirtualHubVnetConnection -ResourceGroupName $rgName -VirtualHubName $virtualHubName -Name "testvnetconnection" -RemoteVirtualNetwork $remoteVirtualNetwork -RoutingConfiguration $routingconfig
Met het bovenstaande maakt u een nieuwe routeringsconfiguratie en maakt u statische routes in de routeringsconfiguratie met de volgende hop als een opgegeven IP-adres. Deze routeringsconfiguratie kan vervolgens worden doorgegeven aan de opdracht New-AzVirtualHubVnet Verbinding maken ion als parameter -RoutingConfiguration.
Parameters
-AsJob
Cmdlet op de achtergrond uitvoeren
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Hiermee wordt u gevraagd om bevestiging voordat u de cmdlet uitvoert.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
De referenties, accounts, tenants en abonnementen die worden gebruikt voor communicatie met Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableInternetSecurity
Internetbeveiliging inschakelen voor deze verbinding
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableInternetSecurityFlag
Internetbeveiliging inschakelen voor deze verbinding
Type: | Nullable<T>[Boolean] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
De resourcenaam.
Type: | String |
Aliases: | ResourceName, HubVirtualNetworkConnectionName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ParentObject
De bovenliggende resource.
Type: | PSVirtualHub |
Aliases: | VirtualHub, ParentVirtualHub |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ParentResourceId
De bovenliggende resource.
Type: | String |
Aliases: | VirtualHubId, ParentVirtualHubId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ParentResourceName
De naam van de resourcegroep.
Type: | String |
Aliases: | VirtualHubName, ParentVirtualHubName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RemoteVirtualNetwork
Het externe virtuele netwerk waarmee deze virtuele hubverbinding is verbonden.
Type: | PSVirtualNetwork |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RemoteVirtualNetworkId
Het externe virtuele netwerk waarmee deze virtuele hubverbinding is verbonden.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
De naam van de resourcegroep.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RoutingConfiguration
Routeringsconfiguratie voor deze verbinding
Type: | PSRoutingConfiguration |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Hiermee wordt weergegeven wat er zou gebeuren als u de cmdlet uitvoert. De cmdlet wordt niet uitgevoerd.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |