共用方式為


Set-AzIotHubConfiguration

更新組態註冊的可變欄位。

語法

Set-AzIotHubConfiguration
   [-ResourceGroupName] <String>
   [-IotHubName] <String>
   [-Name] <String>
   [-Priority <Int32>]
   [-TargetCondition <String>]
   [-Metric <Hashtable>]
   [-Label <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzIotHubConfiguration
   [-InputObject] <PSIotHub>
   [-Name] <String>
   [-Priority <Int32>]
   [-TargetCondition <String>]
   [-Metric <Hashtable>]
   [-Label <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzIotHubConfiguration
   [-ResourceId] <String>
   [-Name] <String>
   [-Priority <Int32>]
   [-TargetCondition <String>]
   [-Metric <Hashtable>]
   [-Label <Hashtable>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

更新IoT自動裝置管理設定的指定屬性。 注意:設定內容是不可變的。 可更新的組態屬性為 'labels'、'metrics'、'priority' 和 'targetCondition'。 如需相關資訊,請參閱 https://learn.microsoft.com/azure/iot-hub/iot-hub-automatic-device-management

範例

範例 1

Set-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1" -Priority 7 -TargetCondition "tags.building=3 and tags.environment='dev'"

改變裝置設定的優先順序,並更新其目標條件

範例 2

$labels = @{}
$labels.add("key0","value0")
$metrics = @{}
$metrics.add("query1", "select deviceId from devices where tags.location='US'")
Set-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1" -Label $labels -Metric $metrics

更新裝置組態的計量和標籤

參數

-Confirm

執行 Cmdlet 之前先提示您確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

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

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Force

允許取代組態物件,即使上次擷取后已更新。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InputObject

IotHub 物件

類型:PSIotHub
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-IotHubName

IoT 中樞的名稱

類型:String
Position:1
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Label

要套用至目標組態的標籤對應。

類型:Hashtable
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Metric

查詢組態計量定義的集合。

類型:Hashtable
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Name

組態的標識碼。

類型:String
Position:1
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Priority

在競爭規則(最高獲勝)的情況下,裝置組態的權數。

類型:Int32
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ResourceGroupName

資源群組的名稱

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ResourceId

IotHub 資源標識碼

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-TargetCondition

裝置組態套用的目標條件。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

PSIotHub

String

輸出

PSConfiguration