We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages an IotHub Enrichment
NOTE: Enrichment can be defined either directly on the
azure.iot.IoTHubresource, or using theazure.iot.Enrichmentresources - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleAccount = new Azure.Storage.Account("exampleAccount", new Azure.Storage.AccountArgs
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
AccountTier = "Standard",
AccountReplicationType = "LRS",
});
var exampleContainer = new Azure.Storage.Container("exampleContainer", new Azure.Storage.ContainerArgs
{
StorageAccountName = exampleAccount.Name,
ContainerAccessType = "private",
});
var exampleIoTHub = new Azure.Iot.IoTHub("exampleIoTHub", new Azure.Iot.IoTHubArgs
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
{
Name = "S1",
Capacity = 1,
},
Tags =
{
{ "purpose", "testing" },
},
});
var exampleEndpointStorageContainer = new Azure.Iot.EndpointStorageContainer("exampleEndpointStorageContainer", new Azure.Iot.EndpointStorageContainerArgs
{
ResourceGroupName = exampleResourceGroup.Name,
IothubId = exampleIoTHub.Id,
ConnectionString = exampleAccount.PrimaryBlobConnectionString,
BatchFrequencyInSeconds = 60,
MaxChunkSizeInBytes = 10485760,
ContainerName = exampleContainer.Name,
Encoding = "Avro",
FileNameFormat = "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
});
var exampleRoute = new Azure.Iot.Route("exampleRoute", new Azure.Iot.RouteArgs
{
ResourceGroupName = exampleResourceGroup.Name,
IothubName = exampleIoTHub.Name,
Source = "DeviceMessages",
Condition = "true",
EndpointNames =
{
exampleEndpointStorageContainer.Name,
},
Enabled = true,
});
var exampleEnrichment = new Azure.Iot.Enrichment("exampleEnrichment", new Azure.Iot.EnrichmentArgs
{
ResourceGroupName = exampleResourceGroup.Name,
IothubName = exampleIoTHub.Name,
Key = "example",
Value = "my value",
EndpointNames =
{
exampleEndpointStorageContainer.Name,
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/iot"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
AccountTier: pulumi.String("Standard"),
AccountReplicationType: pulumi.String("LRS"),
})
if err != nil {
return err
}
exampleContainer, err := storage.NewContainer(ctx, "exampleContainer", &storage.ContainerArgs{
StorageAccountName: exampleAccount.Name,
ContainerAccessType: pulumi.String("private"),
})
if err != nil {
return err
}
exampleIoTHub, err := iot.NewIoTHub(ctx, "exampleIoTHub", &iot.IoTHubArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
Sku: &iot.IoTHubSkuArgs{
Name: pulumi.String("S1"),
Capacity: pulumi.Int(1),
},
Tags: pulumi.StringMap{
"purpose": pulumi.String("testing"),
},
})
if err != nil {
return err
}
exampleEndpointStorageContainer, err := iot.NewEndpointStorageContainer(ctx, "exampleEndpointStorageContainer", &iot.EndpointStorageContainerArgs{
ResourceGroupName: exampleResourceGroup.Name,
IothubId: exampleIoTHub.ID(),
ConnectionString: exampleAccount.PrimaryBlobConnectionString,
BatchFrequencyInSeconds: pulumi.Int(60),
MaxChunkSizeInBytes: pulumi.Int(10485760),
ContainerName: exampleContainer.Name,
Encoding: pulumi.String("Avro"),
FileNameFormat: pulumi.String("{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"),
})
if err != nil {
return err
}
_, err = iot.NewRoute(ctx, "exampleRoute", &iot.RouteArgs{
ResourceGroupName: exampleResourceGroup.Name,
IothubName: exampleIoTHub.Name,
Source: pulumi.String("DeviceMessages"),
Condition: pulumi.String("true"),
EndpointNames: pulumi.String{
exampleEndpointStorageContainer.Name,
},
Enabled: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = iot.NewEnrichment(ctx, "exampleEnrichment", &iot.EnrichmentArgs{
ResourceGroupName: exampleResourceGroup.Name,
IothubName: exampleIoTHub.Name,
Key: pulumi.String("example"),
Value: pulumi.String("my value"),
EndpointNames: pulumi.StringArray{
exampleEndpointStorageContainer.Name,
},
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleAccount = new azure.storage.Account("exampleAccount", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
accountTier: "Standard",
accountReplicationType: "LRS",
});
const exampleContainer = new azure.storage.Container("exampleContainer", {
storageAccountName: exampleAccount.name,
containerAccessType: "private",
});
const exampleIoTHub = new azure.iot.IoTHub("exampleIoTHub", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
sku: {
name: "S1",
capacity: "1",
},
tags: {
purpose: "testing",
},
});
const exampleEndpointStorageContainer = new azure.iot.EndpointStorageContainer("exampleEndpointStorageContainer", {
resourceGroupName: exampleResourceGroup.name,
iothubId: exampleIoTHub.id,
connectionString: exampleAccount.primaryBlobConnectionString,
batchFrequencyInSeconds: 60,
maxChunkSizeInBytes: 10485760,
containerName: exampleContainer.name,
encoding: "Avro",
fileNameFormat: "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
});
const exampleRoute = new azure.iot.Route("exampleRoute", {
resourceGroupName: exampleResourceGroup.name,
iothubName: exampleIoTHub.name,
source: "DeviceMessages",
condition: "true",
endpointNames: [exampleEndpointStorageContainer.name],
enabled: true,
});
const exampleEnrichment = new azure.iot.Enrichment("exampleEnrichment", {
resourceGroupName: exampleResourceGroup.name,
iothubName: exampleIoTHub.name,
key: "example",
value: "my value",
endpointNames: [exampleEndpointStorageContainer.name],
});
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
account_tier="Standard",
account_replication_type="LRS")
example_container = azure.storage.Container("exampleContainer",
storage_account_name=example_account.name,
container_access_type="private")
example_io_t_hub = azure.iot.IoTHub("exampleIoTHub",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
sku=azure.iot.IoTHubSkuArgs(
name="S1",
capacity=1,
),
tags={
"purpose": "testing",
})
example_endpoint_storage_container = azure.iot.EndpointStorageContainer("exampleEndpointStorageContainer",
resource_group_name=example_resource_group.name,
iothub_id=example_io_t_hub.id,
connection_string=example_account.primary_blob_connection_string,
batch_frequency_in_seconds=60,
max_chunk_size_in_bytes=10485760,
container_name=example_container.name,
encoding="Avro",
file_name_format="{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}")
example_route = azure.iot.Route("exampleRoute",
resource_group_name=example_resource_group.name,
iothub_name=example_io_t_hub.name,
source="DeviceMessages",
condition="true",
endpoint_names=[example_endpoint_storage_container.name],
enabled=True)
example_enrichment = azure.iot.Enrichment("exampleEnrichment",
resource_group_name=example_resource_group.name,
iothub_name=example_io_t_hub.name,
key="example",
value="my value",
endpoint_names=[example_endpoint_storage_container.name])
Example coming soon!
Create Enrichment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Enrichment(name: string, args: EnrichmentArgs, opts?: CustomResourceOptions);@overload
def Enrichment(resource_name: str,
args: EnrichmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Enrichment(resource_name: str,
opts: Optional[ResourceOptions] = None,
endpoint_names: Optional[Sequence[str]] = None,
iothub_name: Optional[str] = None,
key: Optional[str] = None,
resource_group_name: Optional[str] = None,
value: Optional[str] = None)func NewEnrichment(ctx *Context, name string, args EnrichmentArgs, opts ...ResourceOption) (*Enrichment, error)public Enrichment(string name, EnrichmentArgs args, CustomResourceOptions? opts = null)
public Enrichment(String name, EnrichmentArgs args)
public Enrichment(String name, EnrichmentArgs args, CustomResourceOptions options)
type: azure:iot:Enrichment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args EnrichmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args EnrichmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args EnrichmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EnrichmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EnrichmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var enrichmentResource = new Azure.Iot.Enrichment("enrichmentResource", new()
{
EndpointNames = new[]
{
"string",
},
IothubName = "string",
Key = "string",
ResourceGroupName = "string",
Value = "string",
});
example, err := iot.NewEnrichment(ctx, "enrichmentResource", &iot.EnrichmentArgs{
EndpointNames: pulumi.StringArray{
pulumi.String("string"),
},
IothubName: pulumi.String("string"),
Key: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
Value: pulumi.String("string"),
})
var enrichmentResource = new Enrichment("enrichmentResource", EnrichmentArgs.builder()
.endpointNames("string")
.iothubName("string")
.key("string")
.resourceGroupName("string")
.value("string")
.build());
enrichment_resource = azure.iot.Enrichment("enrichmentResource",
endpoint_names=["string"],
iothub_name="string",
key="string",
resource_group_name="string",
value="string")
const enrichmentResource = new azure.iot.Enrichment("enrichmentResource", {
endpointNames: ["string"],
iothubName: "string",
key: "string",
resourceGroupName: "string",
value: "string",
});
type: azure:iot:Enrichment
properties:
endpointNames:
- string
iothubName: string
key: string
resourceGroupName: string
value: string
Enrichment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Enrichment resource accepts the following input properties:
- Endpoint
Names List<string> - The list of endpoints which will be enriched.
- Iothub
Name string - Key string
- The key of the enrichment.
- Resource
Group stringName - Value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- Endpoint
Names []string - The list of endpoints which will be enriched.
- Iothub
Name string - Key string
- The key of the enrichment.
- Resource
Group stringName - Value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names List<String> - The list of endpoints which will be enriched.
- iothub
Name String - key String
- The key of the enrichment.
- resource
Group StringName - value String
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names string[] - The list of endpoints which will be enriched.
- iothub
Name string - key string
- The key of the enrichment.
- resource
Group stringName - value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint_
names Sequence[str] - The list of endpoints which will be enriched.
- iothub_
name str - key str
- The key of the enrichment.
- resource_
group_ strname - value str
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names List<String> - The list of endpoints which will be enriched.
- iothub
Name String - key String
- The key of the enrichment.
- resource
Group StringName - value String
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
Outputs
All input properties are implicitly available as output properties. Additionally, the Enrichment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Enrichment Resource
Get an existing Enrichment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: EnrichmentState, opts?: CustomResourceOptions): Enrichment@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
endpoint_names: Optional[Sequence[str]] = None,
iothub_name: Optional[str] = None,
key: Optional[str] = None,
resource_group_name: Optional[str] = None,
value: Optional[str] = None) -> Enrichmentfunc GetEnrichment(ctx *Context, name string, id IDInput, state *EnrichmentState, opts ...ResourceOption) (*Enrichment, error)public static Enrichment Get(string name, Input<string> id, EnrichmentState? state, CustomResourceOptions? opts = null)public static Enrichment get(String name, Output<String> id, EnrichmentState state, CustomResourceOptions options)resources: _: type: azure:iot:Enrichment get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Endpoint
Names List<string> - The list of endpoints which will be enriched.
- Iothub
Name string - Key string
- The key of the enrichment.
- Resource
Group stringName - Value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- Endpoint
Names []string - The list of endpoints which will be enriched.
- Iothub
Name string - Key string
- The key of the enrichment.
- Resource
Group stringName - Value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names List<String> - The list of endpoints which will be enriched.
- iothub
Name String - key String
- The key of the enrichment.
- resource
Group StringName - value String
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names string[] - The list of endpoints which will be enriched.
- iothub
Name string - key string
- The key of the enrichment.
- resource
Group stringName - value string
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint_
names Sequence[str] - The list of endpoints which will be enriched.
- iothub_
name str - key str
- The key of the enrichment.
- resource_
group_ strname - value str
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
- endpoint
Names List<String> - The list of endpoints which will be enriched.
- iothub
Name String - key String
- The key of the enrichment.
- resource
Group StringName - value String
- The value of the enrichment. Value can be any static string, the name of the IoT hub sending the message (use
$iothubname) or information from the device twin (ex:$twin.tags.latitude)
Import
IoTHub Enrichment can be imported using the resource id, e.g.
$ pulumi import azure:iot/enrichment:Enrichment enrichment1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/IotHubs/hub1/Enrichments/enrichment1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
