Add-AzIotHubDeployment

Add an IoT Edge deployment in a target IoT Hub.

Syntax

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

Description

Edge deployments can be created with user defined metrics for on demand evaluation. See https://zcusa.951200.xyz/azure/iot-edge/module-deployment-monitoring for more information.

Examples

Example 1

Add-AzIotHubDeployment -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "deploy1"

Create an Edge deployment with default metadata.

Example 2

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

Create an Edge deployment with a priority of 3 that applies on condition when a device is tagged in building 9 and the environment is 'test'.

Example 2

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

Create an Edge deployment with user metrics.

Example 3

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

Create an Edge deployment with labels.

Example 4

$content = Get-Content "C:/Edge/modules.json" | ConvertFrom-Json -AsHashtable
Add-AzIotHubDeployment -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -Name "deploy1" -ModulesContent $content -TargetCondition "from devices.modules where tags.environment='test'"

Create an Edge deployment with content.

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

-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 deployment.

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

-Metric

Queries collection for IoT Edge deployment metrics definition.

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

-ModulesContent

Deployment content of modules for IoT Edge devices.

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

-Name

Identifier for the deployment.

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

-Priority

Weight of deployment 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 an Edge deployment 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

PSDeployment