共用方式為


Test-AzIotHubRoute

在 IoT 中樞 中測試路由

Syntax

Test-AzIotHubRoute
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-InputObject] <PSIotHub>
    [-RouteName] <String>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-ShowError]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-InputObject] <PSIotHub>
    [-Source] <PSRoutingSource>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-RouteName] <String>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-ShowError]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-Source] <PSRoutingSource>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-ResourceId] <String>
    [-RouteName] <String>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-ShowError]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzIotHubRoute
    [-ResourceId] <String>
    [-Source] <PSRoutingSource>
    [-Body <String>]
    [-AppProperty <Hashtable>]
    [-SystemProperty <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

測試特定路由。

範例

範例 1

Test-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -Source DeviceMessages

RouteName DataSource     EndpointNames IsEnabled
--------- ----------     ------------- ---------
R1        DeviceMessages events        True
R5        DeviceMessages E1            True

使用來源 「DeviceMessages」 測試所有路由。

範例 2

Test-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1

Result : true

測試特定路由。

範例 3

Test-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1 -ShowError

ErrorMessage  Severity LocationStartLine LocationStartColumn LocationEndLine LocationEndColumn
------------  -------- ----------------- ------------------- --------------- -----------------
Syntax error. error    1                 29                  1               30

測試特定路由,並顯示失敗的原因。

範例 4

$ap = @{}
$ap.add("key0","value0")
$sp = @{}
$sp.add("key1", "value1")
Test-AzIotHubRoute -ResourceGroupName "myresourcegroup" -Name "myiothub" -RouteName R1 -AppProperty $ap -SystemProperty $sp

Result : true

使用 AppProperty 和 SystemProperty 測試特定路由。

參數

-AppProperty

路由訊息的應用程式屬性

類型:Hashtable
Position:Named
預設值:None
必要:False
Accept pipeline input:False
Accept wildcard characters:False

-Body

路由訊息的本文

類型:String
Position:Named
預設值:None
必要:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

類型:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

IotHub 物件

類型:PSIotHub
Position:0
預設值:None
必要:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

IoT 中樞的名稱

類型:String
Position:1
預設值:None
必要:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

資源群組的名稱

類型:String
Position:0
預設值:None
必要:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

IotHub 資源標識碼

類型:String
Position:0
預設值:None
必要:True
Accept pipeline input:True
Accept wildcard characters:False

-RouteName

路由的名稱

類型:String
Position:1
預設值:None
必要:True
Accept pipeline input:False
Accept wildcard characters:False

-ShowError

如果存在,則顯示詳細的錯誤

類型:SwitchParameter
Position:Named
預設值:None
必要:False
Accept pipeline input:False
Accept wildcard characters:False

-Source

路由的來源

類型:PSRoutingSource
接受的值:Invalid, DeviceMessages, TwinChangeEvents, DeviceLifecycleEvents, DeviceJobLifecycleEvents, DigitalTwinChangeEvents
Position:1
預設值:None
必要:True
Accept pipeline input:False
Accept wildcard characters:False

-SystemProperty

路由訊息的系統屬性

類型:Hashtable
Position:Named
預設值:None
必要:False
Accept pipeline input:False
Accept wildcard characters:False

輸入

PSIotHub

String

輸出

PSTestRouteResult

PSRouteCompilationError

PSRouteProperties[]