This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
The enrichments support enables you to add up to 20 custom key-value properties to your messages before they're sent to the Event Grid custom topic. These enrichments enable you to:
The enrichment key is a string that needs to comply with these requirements:
specversion,id,time,type,source,subject,datacontenttype,dataschema,data, ordata_base64.azsp.The enrichment value could be a static string for static enrichments or one of the supported values that represent the client attributes or the MQTT message properties for dynamic enrichment. Enrichment values must not be more than 128 characters. The following list includes the supported values:
Use the following steps to configure routing enrichments:

For more information about the routing configuration, go toRouting Azure portal configuration.
Use the command and payload during namespace creation/update to configure routing enrichments:
az resource create --resource-type Microsoft.EventGrid/namespaces --id /subscriptions/<Subscription ID>/resourceGroups/<Resource Group>/providers/Microsoft.EventGrid/namespaces/<Namespace Name> --is-full-object --api-version 2023-06-01-preview --properties @./resources/NS.jsonNS.json
{ "properties": { "topicSpacesConfiguration": { "state": "Enabled", "routeTopicResourceId": "/subscriptions/<Subscription ID>/resourceGroups/<Resource Group>/providers/Microsoft.EventGrid/topics/<Event Grid Topic name>", "routingEnrichments": { "static": [ { "key": "namespaceid", "value": "123", "valueType": "string" } ], "dynamic": [ { "key": "clientname", "value": "${client.authenticationName}" }, { "key": "clienttype", "value": "${client.attributes.type}" }, { "key": "address", "value": "${mqtt.message.userProperties['client.address']}" }, { "key": "region", "value": "${mqtt.message.userProperties.location}" }, { "key": "mqtttopic", "value": "${mqtt.message.topicName}" }, { "key": "mqttresponsetopic", "value": "${mqtt.message.responseTopic}" }, { "key": "mqttcorrelationdata", "value": "${mqtt.message.correlationData}" }, { "key": "mqttpfi", "value": "${mqtt.message.pfi}" } ] } }},"location": "eastus2euap","tags": {},}For more information about the routing configuration, go toRouting Azure CLI configuration.
The following CloudEvent is a sample output of a MQTTv5 message with PFI=0 after applying the previous enrichment configuration:
{ "specversion": "1.0","id": "9aeb0fdf-c01e-0131-0922-9eb54906e20", // unique id stamped by the service"time": "2019-11-18T15:13:39.4589254Z", // timestamp when messages was received by the service"type": "MQTT.EventPublished", // set type for all MQTT messages enveloped by the service"source": "testnamespace", // namespace name"subject": "campus/buildings/building17", // topic of the MQTT publish request"namespaceid": "123", // static enrichment"clientname": "client1", // dynamic enrichment of the name of the publishing client"clienttype": "operator", // dynamic enrichment of an attribute of the publishing client"address": "1 Microsoft Way, Redmond, WA 98052", // dynamic enrichment of a user property in the MQTT publish request"region": "North America", // dynamic enrichment of another user property in the MQTT publish request"mqtttopic": "campus/buildings/building17", // dynamic enrichment of the topic of the MQTT publish request"mqttresponsetopic": "campus/buildings/building17/response", // dynamic enrichment of the response topic of the MQTT publish request"mqttcorrelationdata": "cmVxdWVzdDE=", // dynamic enrichment of the correlation data of the MQTT publish request encoded in base64"mqttpfi": 0, // dynamic enrichment of the payload format indicator of the MQTT publish request"datacontenttype": "application/octet-stream", //content type of the MQTT publish request"data_base64": { IlRlbXAiOiAiNzAiLAoiaHVtaWRpdHkiOiAiNDAiCg==}}emptyproperty: "".array:value1,value2,value3. Another example: if the same MQTT publish request has the following user properties > "userproperty1": "value1", "userproperty1": "value2", resulting enriched property will beuserproperty1:value1,value2.Use the following articles to learn more about routing:
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?