Add-AzIotHubMessageEnrichment

Creates a message enrichment for chosen endpoints in your IoT Hub.

Syntax

Add-AzIotHubMessageEnrichment
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-Key] <String>
   -Value <String>
   -Endpoint <String[]>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubMessageEnrichment
   [-InputObject] <PSIotHub>
   [-Key] <String>
   -Value <String>
   -Endpoint <String[]>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIotHubMessageEnrichment
   [-ResourceId] <String>
   [-Key] <String>
   -Value <String>
   -Endpoint <String[]>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Add up to 10 message enrichments per IoT Hub. These are added as application properties to messages sent to chosen endpoint(s). To know more, see https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-message-enrichments-overview

Examples

Example 1

PS C:\> Add-AzIotHubMessageEnrichment -ResourceGroupName "myresourcegroup" -Name "myiothub" -Key "newKey" -Value "newValue" -Endpoint endpoint1,endpoint2

Key          : newKey
Value        : newValue
Endpoint(s)  : { endpoint1, endpoint2 }

Add a new enrichment with key "newKey" and value "newValue". This new enrichment is applied to "endpoint1" and "endpoint2" endpoints.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Endpoint

Endpoint(s) to apply enrichments to.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

IotHub object

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

The enrichment's key.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Name of the Iot Hub

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Name of the Resource Group

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

IotHub Resource Id

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

The enrichment's value.

Type:String
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSIotHub

String

Outputs

Microsoft.Azure.Commands.Management.IotHub.Models.PSEnrichmentMetadata