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

Set-AzIotHubConfiguration

Update the mutable fields of the configuration registration.

Syntax

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

Update specified properties of an IoT automatic device management configuration. Note: Configuration content is immutable. Configuration properties that can be updated are 'labels', 'metrics', 'priority' and 'targetCondition'. See https://learn.microsoft.com/azure/iot-hub/iot-hub-automatic-device-management for more information.

Examples

Example 1

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

Alter the priority of a device configuration and update its target condition

Example 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

Update the metrics and labels of a device configuration

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Allows configuration object to be replaced even if it was updated since it was retrieved last time.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

IotHub object

Type:PSIotHub
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-IotHubName

Name of the Iot Hub

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Label

Map of labels to be applied to target configuration.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Metric

Queries collection for configuration metrics definition.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Identifier for the configuration.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Priority

Weight of the device configuration in case of competing rules (highest wins).

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Name of the Resource Group

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

IotHub Resource Id

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetCondition

Target condition in which a device configuration applies to.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSIotHub

String

Outputs

PSConfiguration