Freigeben über


Add-AzIotHubConfiguration

Fügen Sie eine automatische IoT-Geräteverwaltungskonfiguration in einem IoT-Ziel-IoT-Hub hinzu.

Syntax

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

Beschreibung

Der Konfigurationsinhalt ist json und geringfügig variiert je nach Geräte- oder Modulabsicht. Gerätekonfigurationen befinden sich in Form von {"deviceContent":{...}} Modulkonfigurationen befinden sich in Form von {"moduleContent":{...}} Konfigurationen können mit vom Benutzer bereitgestellten Metriken für die Bedarfsauswertung definiert werden. Benutzermetriken sind json und in Form von {"queries":{...}} oder {"metrics":{"queries":{...}}}.or {"metrics":{"queries":{...}}}.

Hinweis: Die Zielbedingung für Module muss mit "von devices.modules where" beginnen. Weitere Informationen finden Sie unter https://learn.microsoft.com/azure/iot-hub/iot-hub-automatic-device-management.

Beispiele

Beispiel 1

Add-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1"

Erstellen Sie eine Gerätekonfiguration mit Standardmetadaten.

Beispiel 2

Add-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1" -Priority 3 -TargetCondition "tags.building=9 and tags.environment='test'"

Erstellen Sie eine Gerätekonfiguration mit einer Priorität von 3, die für die Bedingung gilt, wenn ein Gerät in Gebäude 9 markiert ist und die Umgebung "test" ist.

Beispiel 3

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

Erstellen Sie eine Gerätekonfiguration mit Benutzermetriken.

Beispiel 4

$labels = @{}
$labels.add("key0","value0")
$labels.add("key1","value1")
Add-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1" -Label $labels

Erstellen Sie eine Gerätekonfiguration mit Bezeichnungen.

Beispiel 5

$prop = @{}
$prop.add("Location", "US")
$content = @{}
$content.add("properties.desired.Region", $prop)
Add-AzIotHubConfiguration -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "config1" -DeviceContent $content

Erstellen Sie eine Gerätekonfiguration mit Inhalt.

Parameter

-Confirm

Hiermit werden Sie vor der Ausführung des Cmdlets zur Bestätigung aufgefordert.

Typ:SwitchParameter
Aliases:cf
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

Anmeldeinformationen, Konto, Mandant und Abonnement für die Kommunikation mit Azure

Typ:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-DeviceContent

Konfiguration für IotHub-Geräte.

Typ:Hashtable
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

IotHub-Objekt

Typ:PSIotHub
Position:0
Standardwert:None
Erforderlich:True
Accept pipeline input:True
Accept wildcard characters:False

-IotHubName

Name des Iot Hub

Typ:String
Position:1
Standardwert:None
Erforderlich:True
Accept pipeline input:False
Accept wildcard characters:False

-Label

Zuordnung der Bezeichnungen, die auf die Zielkonfiguration angewendet werden sollen.

Typ:Hashtable
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-Metric

Abfrageauflistung für die Definition von Konfigurationsmetriken.

Typ:Hashtable
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Bezeichner für die Konfiguration.

Typ:String
Position:Named
Standardwert:None
Erforderlich:True
Accept pipeline input:False
Accept wildcard characters:False

-Priority

Gewichtung der Gerätekonfiguration bei konkurrierenden Regeln (höchste Gewinne).

Typ:Int32
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Name der Ressourcengruppe

Typ:String
Position:0
Standardwert:None
Erforderlich:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceId

IotHub-Ressourcen-ID

Typ:String
Position:0
Standardwert:None
Erforderlich:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetCondition

Zielbedingung, für die eine Gerätekonfiguration gilt.

Typ:String
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Zeigt, was geschieht, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Typ:SwitchParameter
Aliases:wi
Position:Named
Standardwert:None
Erforderlich:False
Accept pipeline input:False
Accept wildcard characters:False

Eingaben

PSIotHub

String

Ausgaben

PSConfiguration