你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Get-AzRoutingIntent

检索与 VirtualHub 关联的路由意向资源。

语法

Get-AzRoutingIntent
   -ResourceGroupName <String>
   -HubName <String>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRoutingIntent
   -VirtualHub <PSVirtualHub>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRoutingIntent
   -ParentResourceId <String>
   [-Name <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

说明

获取与指定虚拟中心关联的指定路由意向。

示例

示例 1

New-AzVirtualWan -ResourceGroupName "testRg" -Name "testWan" -Location "westcentralus" -VirtualWANType "Standard" -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic
$virtualWan = Get-AzVirtualWan -ResourceGroupName "testRg" -Name "testWan"

New-AzVirtualHub -ResourceGroupName "testRg" -Name "testHub" -Location "westcentralus" -AddressPrefix "10.0.0.0/16" -VirtualWan $virtualWan
$virtualHub = Get-AzVirtualHub -ResourceGroupName "testRg" -Name "testHub"

$fwIp = New-AzFirewallHubPublicIpAddress -Count 1
$hubIpAddresses = New-AzFirewallHubIpAddress -PublicIP $fwIp

New-AzFirewall -Name "testFirewall" -ResourceGroupName "testRg" -Location "westcentralus" -Sku AZFW_Hub -VirtualHubId $virtualHub.Id -HubIPAddress $hubIpAddresses
$firewall = Get-AzFirewall -Name "testFirewall" -ResourceGroupName "testRg"

$policy1 = New-AzRoutingPolicy -Name "PrivateTraffic" -Destination @("PrivateTraffic") -NextHop $firewall.Id
$policy2 = New-AzRoutingPolicy -Name "PublicTraffic" -Destination @("Internet") -NextHop $firewall.Id

New-AzRoutingIntent -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "testRoutingIntent" -RoutingPolicy @($policy1, $policy2)
Get-AzRoutingIntent -ResourceGroupName "testRg" -VirtualHubName "testHub" -Name "testRoutingIntent"

ProvisioningState   : Succeeded
RoutingPolicies     : {PrivateTraffic, PublicTraffic}
RoutingPoliciesText : [
                        {
                          "Name": "PrivateTraffic",
                          "DestinationType": "TrafficType",
                          "Destinations": [
                            "PrivateTraffic"
                          ],
                          "NextHopType": "ResourceId",
                          "NextHop": "/subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/azureFirewalls/testFirewall"
                        },
                        {
                          "Name": "PublicTraffic",
                          "DestinationType": "TrafficType",
                          "Destinations": [
                            "Internet"
                          ],
                          "NextHopType": "ResourceId",
                          "NextHop": "/subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/azureFirewalls/testFirewall"
                        }
                      ]
Name                : testRoutingIntent
Etag                : W/"etag"
Id                  : /subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/testHub/routingIntent/testRoutingIntent

此命令获取虚拟中心的路由意向。

示例 2

$rgName = "testRg"
$virtualHubName = "testHub"
Get-AzRoutingIntent -Name $riName -VirtualHub $virtualHub

ProvisioningState   : Succeeded
RoutingPolicies     : {PrivateTraffic, PublicTraffic}
RoutingPoliciesText : [
                        {
                          "Name": "PrivateTraffic",
                          "DestinationType": "TrafficType",
                          "Destinations": [
                            "PrivateTraffic"
                          ],
                          "NextHopType": "ResourceId",
                          "NextHop": "/subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/azureFirewalls/testFirewall"
                        },
                        {
                          "Name": "PublicTraffic",
                          "DestinationType": "TrafficType",
                          "Destinations": [
                            "Internet"
                          ],
                          "NextHopType": "ResourceId",
                          "NextHop": "/subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/azureFirewalls/testFirewall"
                        }
                      ]
Name                : testRoutingIntent
Etag                : W/"etag"
Id                  : /subscriptions/testSub/resourceGroups/testRg/providers/Microsoft.Network/virtualHubs/testHub/routingIntent/testRoutingIntent

此命令获取指定 VirtualHub 中的路由意向。

参数

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

类型:IAzureContextContainer
别名:AzContext, AzureRmContext, AzureCredential
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-HubName

父资源名称。

类型:String
别名:VirtualHubName, ParentVirtualHubName, ParentResourceName
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-Name

资源名称。

类型:String
别名:ResourceName, RoutingIntentName
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:True

-ParentResourceId

父资源 ID。

类型:String
别名:VirtualHubId, ParentVirtualHubId
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-ResourceGroupName

资源组名称。

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-VirtualHub

父资源。

类型:PSVirtualHub
别名:ParentObject, ParentVirtualHub
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

输入

PSVirtualHub

String

输出

PSRoutingIntent