Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
- Latest
- 2025-08-01-preview
- 2023-06-30
- 2023-06-30-preview
- 2022-11-15-preview
- 2022-04-30-preview
- 2021-07-02
- 2021-07-02-preview
- 2021-07-01
- 2021-07-01-preview
- 2021-03-31
- 2021-03-03-preview
- 2021-02-01-preview
- 2020-08-31
- 2020-08-31-preview
- 2020-08-01
- 2020-07-10-preview
- 2020-06-15
- 2020-04-01
- 2020-03-01
- 2019-11-04
- 2019-07-01-preview
- 2019-03-22
- 2019-03-22-preview
- 2018-12-01-preview
- 2018-04-01
- 2018-01-22
- 2017-07-01
- 2017-01-19
- 2016-02-03
Bicep resource definition
The IotHubs resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Devices/IotHubs resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Devices/IotHubs@2016-02-03' = {
scope: resourceSymbolicName or scope
etag: 'string'
location: 'string'
name: 'string'
properties: {
authorizationPolicies: [
{
keyName: 'string'
primaryKey: 'string'
rights: 'string'
secondaryKey: 'string'
}
]
cloudToDevice: {
defaultTtlAsIso8601: 'string'
feedback: {
lockDurationAsIso8601: 'string'
maxDeliveryCount: int
ttlAsIso8601: 'string'
}
maxDeliveryCount: int
}
comments: 'string'
enableFileUploadNotifications: bool
eventHubEndpoints: {
{customized property}: {
partitionCount: int
retentionTimeInDays: int
}
}
features: 'string'
ipFilterRules: [
{
action: 'string'
filterName: 'string'
ipMask: 'string'
}
]
messagingEndpoints: {
{customized property}: {
lockDurationAsIso8601: 'string'
maxDeliveryCount: int
ttlAsIso8601: 'string'
}
}
operationsMonitoringProperties: {
events: {
{customized property}: 'string'
}
}
storageEndpoints: {
{customized property}: {
connectionString: 'string'
containerName: 'string'
sasTtlAsIso8601: 'string'
}
}
}
resourcegroup: 'string'
sku: {
capacity: int
name: 'string'
}
subscriptionid: 'string'
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.Devices/IotHubs
| Name | Description | Value |
|---|---|---|
| etag | The Etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. | string |
| location | The resource location. | string (required) |
| name | The resource name | string (required) |
| properties | The properties of an IoT hub. | IotHubProperties |
| resourcegroup | The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription. | string (required) |
| scope | Use when creating a resource at a scope that is different than the deployment scope. | Set this property to the symbolic name of a resource to apply the extension resource. |
| sku | Information about the SKU of the IoT hub. | IotHubSkuInfo (required) |
| subscriptionid | The subscription identifier. | string (required) |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
CloudToDeviceProperties
| Name | Description | Value |
|---|---|---|
| defaultTtlAsIso8601 | The default time to live for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| feedback | The properties of the feedback queue for cloud-to-device messages. | FeedbackProperties |
| maxDeliveryCount | The max delivery count for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
EventHubProperties
| Name | Description | Value |
|---|---|---|
| partitionCount | The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. | int |
| retentionTimeInDays | The retention time for device-to-cloud messages in days. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages | int |
FeedbackProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration for the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message on the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
IotHubProperties
| Name | Description | Value |
|---|---|---|
| authorizationPolicies | The shared access policies you can use to secure a connection to the IoT hub. | SharedAccessSignatureAuthorizationRule[] |
| cloudToDevice | The IoT hub cloud-to-device messaging properties. | CloudToDeviceProperties |
| comments | Comments. | string |
| enableFileUploadNotifications | If True, file upload notifications are enabled. | bool |
| eventHubEndpoints | The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. | IotHubPropertiesEventHubEndpoints |
| features | The capabilities and features enabled for the IoT hub. | 'DeviceManagement' 'None' |
| ipFilterRules | The IP filter rules. | IpFilterRule[] |
| messagingEndpoints | The messaging endpoint properties for the file upload notification queue. | IotHubPropertiesMessagingEndpoints |
| operationsMonitoringProperties | The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. | OperationsMonitoringProperties |
| storageEndpoints | The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. | IotHubPropertiesStorageEndpoints |
IotHubPropertiesEventHubEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesMessagingEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesStorageEndpoints
| Name | Description | Value |
|---|
IotHubSkuInfo
| Name | Description | Value |
|---|---|---|
| capacity | The number of provisioned IoT Hub units. See: /azure/azure-subscription-service-limits#iot-hub-limits. | int (required) |
| name | The name of the SKU. | 'F1' 'S1' 'S2' 'S3' (required) |
IpFilterRule
| Name | Description | Value |
|---|---|---|
| action | The desired action for requests captured by this rule. | 'Accept' 'Reject' (required) |
| filterName | The name of the IP filter rule. | string (required) |
| ipMask | A string that contains the IP address range in CIDR notation for the rule. | string (required) |
MessagingEndpointProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message. See: /azure/iot-hub/iot-hub-devguide-file-upload. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
OperationsMonitoringProperties
| Name | Description | Value |
|---|---|---|
| events | Dictionary of <OperationMonitoringLevel> | OperationsMonitoringPropertiesEvents |
OperationsMonitoringPropertiesEvents
| Name | Description | Value |
|---|
ResourceTags
| Name | Description | Value |
|---|
SharedAccessSignatureAuthorizationRule
| Name | Description | Value |
|---|---|---|
| keyName | The name of the shared access policy. | string (required) |
| primaryKey | The primary key. | string |
| rights | The permissions assigned to the shared access policy. | 'DeviceConnect' 'RegistryRead' 'RegistryRead, DeviceConnect' 'RegistryRead, RegistryWrite' 'RegistryRead, RegistryWrite, DeviceConnect' 'RegistryRead, RegistryWrite, ServiceConnect' 'RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect' 'RegistryRead, ServiceConnect' 'RegistryRead, ServiceConnect, DeviceConnect' 'RegistryWrite' 'RegistryWrite, DeviceConnect' 'RegistryWrite, ServiceConnect' 'RegistryWrite, ServiceConnect, DeviceConnect' 'ServiceConnect' 'ServiceConnect, DeviceConnect' (required) |
| secondaryKey | The secondary key. | string |
StorageEndpointProperties
| Name | Description | Value |
|---|---|---|
| connectionString | The connection string for the Azure Storage account to which files are uploaded. | string (required) |
| containerName | The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. | string (required) |
| sasTtlAsIso8601 | The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: /azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. | string |
Usage Examples
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
| Bicep File | Description |
|---|---|
| Create an IoT Hub and a Device to Cloud Consumer Group | This template enables you to deploy an IoT Hub instance with device to cloud and cloud to device messaging configurations and a device to cloud consumer group. |
| Create an IoT Hub Device Provisioning Service | This template enables you to create an IoT hub and an IoT Hub Device Provisioning Service, and link the two services together. |
| Create Device Update for IoT Hub account, instance, IoT Hub | This template creates an account, and an instance and a hub to link the instance with. It configures the hub with the necessary access polices, routes, and consumer group. |
| Deploy the MedTech service including an Azure IoT Hub | The MedTech service is one of the Azure Health Data Services designed to ingest device data from multiple devices, transform the device data into FHIR Observations, which are then persisted in the Azure Health Data Services FHIR service. |
| Use ARM template to create IoT Hub, route and view messages | Use this template to deploy an IoT Hub and a storage account. Run an app to send messages to the hub that are routed to storage, then view the results. |
ARM template resource definition
The IotHubs resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Devices/IotHubs resource, add the following JSON to your template.
{
"type": "Microsoft.Devices/IotHubs",
"apiVersion": "2016-02-03",
"name": "string",
"etag": "string",
"location": "string",
"properties": {
"authorizationPolicies": [
{
"keyName": "string",
"primaryKey": "string",
"rights": "string",
"secondaryKey": "string"
}
],
"cloudToDevice": {
"defaultTtlAsIso8601": "string",
"feedback": {
"lockDurationAsIso8601": "string",
"maxDeliveryCount": "int",
"ttlAsIso8601": "string"
},
"maxDeliveryCount": "int"
},
"comments": "string",
"enableFileUploadNotifications": "bool",
"eventHubEndpoints": {
"{customized property}": {
"partitionCount": "int",
"retentionTimeInDays": "int"
}
},
"features": "string",
"ipFilterRules": [
{
"action": "string",
"filterName": "string",
"ipMask": "string"
}
],
"messagingEndpoints": {
"{customized property}": {
"lockDurationAsIso8601": "string",
"maxDeliveryCount": "int",
"ttlAsIso8601": "string"
}
},
"operationsMonitoringProperties": {
"events": {
"{customized property}": "string"
}
},
"storageEndpoints": {
"{customized property}": {
"connectionString": "string",
"containerName": "string",
"sasTtlAsIso8601": "string"
}
}
},
"resourcegroup": "string",
"sku": {
"capacity": "int",
"name": "string"
},
"subscriptionid": "string",
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.Devices/IotHubs
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2016-02-03' |
| etag | The Etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. | string |
| location | The resource location. | string (required) |
| name | The resource name | string (required) |
| properties | The properties of an IoT hub. | IotHubProperties |
| resourcegroup | The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription. | string (required) |
| sku | Information about the SKU of the IoT hub. | IotHubSkuInfo (required) |
| subscriptionid | The subscription identifier. | string (required) |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
| type | The resource type | 'Microsoft.Devices/IotHubs' |
CloudToDeviceProperties
| Name | Description | Value |
|---|---|---|
| defaultTtlAsIso8601 | The default time to live for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| feedback | The properties of the feedback queue for cloud-to-device messages. | FeedbackProperties |
| maxDeliveryCount | The max delivery count for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
EventHubProperties
| Name | Description | Value |
|---|---|---|
| partitionCount | The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. | int |
| retentionTimeInDays | The retention time for device-to-cloud messages in days. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages | int |
FeedbackProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration for the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message on the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
IotHubProperties
| Name | Description | Value |
|---|---|---|
| authorizationPolicies | The shared access policies you can use to secure a connection to the IoT hub. | SharedAccessSignatureAuthorizationRule[] |
| cloudToDevice | The IoT hub cloud-to-device messaging properties. | CloudToDeviceProperties |
| comments | Comments. | string |
| enableFileUploadNotifications | If True, file upload notifications are enabled. | bool |
| eventHubEndpoints | The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. | IotHubPropertiesEventHubEndpoints |
| features | The capabilities and features enabled for the IoT hub. | 'DeviceManagement' 'None' |
| ipFilterRules | The IP filter rules. | IpFilterRule[] |
| messagingEndpoints | The messaging endpoint properties for the file upload notification queue. | IotHubPropertiesMessagingEndpoints |
| operationsMonitoringProperties | The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. | OperationsMonitoringProperties |
| storageEndpoints | The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. | IotHubPropertiesStorageEndpoints |
IotHubPropertiesEventHubEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesMessagingEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesStorageEndpoints
| Name | Description | Value |
|---|
IotHubSkuInfo
| Name | Description | Value |
|---|---|---|
| capacity | The number of provisioned IoT Hub units. See: /azure/azure-subscription-service-limits#iot-hub-limits. | int (required) |
| name | The name of the SKU. | 'F1' 'S1' 'S2' 'S3' (required) |
IpFilterRule
| Name | Description | Value |
|---|---|---|
| action | The desired action for requests captured by this rule. | 'Accept' 'Reject' (required) |
| filterName | The name of the IP filter rule. | string (required) |
| ipMask | A string that contains the IP address range in CIDR notation for the rule. | string (required) |
MessagingEndpointProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message. See: /azure/iot-hub/iot-hub-devguide-file-upload. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
OperationsMonitoringProperties
| Name | Description | Value |
|---|---|---|
| events | Dictionary of <OperationMonitoringLevel> | OperationsMonitoringPropertiesEvents |
OperationsMonitoringPropertiesEvents
| Name | Description | Value |
|---|
ResourceTags
| Name | Description | Value |
|---|
SharedAccessSignatureAuthorizationRule
| Name | Description | Value |
|---|---|---|
| keyName | The name of the shared access policy. | string (required) |
| primaryKey | The primary key. | string |
| rights | The permissions assigned to the shared access policy. | 'DeviceConnect' 'RegistryRead' 'RegistryRead, DeviceConnect' 'RegistryRead, RegistryWrite' 'RegistryRead, RegistryWrite, DeviceConnect' 'RegistryRead, RegistryWrite, ServiceConnect' 'RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect' 'RegistryRead, ServiceConnect' 'RegistryRead, ServiceConnect, DeviceConnect' 'RegistryWrite' 'RegistryWrite, DeviceConnect' 'RegistryWrite, ServiceConnect' 'RegistryWrite, ServiceConnect, DeviceConnect' 'ServiceConnect' 'ServiceConnect, DeviceConnect' (required) |
| secondaryKey | The secondary key. | string |
StorageEndpointProperties
| Name | Description | Value |
|---|---|---|
| connectionString | The connection string for the Azure Storage account to which files are uploaded. | string (required) |
| containerName | The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. | string (required) |
| sasTtlAsIso8601 | The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: /azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. | string |
Usage Examples
Azure Quickstart Templates
The following Azure Quickstart templates deploy this resource type.
| Template | Description |
|---|---|
| Create a Pay As You Go (PAYG) Environment with an IoT Hub |
This template enables you to deploy a Pay As You Go (PAYG) Time Series Insights environment that is configured to consume events from an IoT Hub. |
| Create an IoT Hub and a Device to Cloud Consumer Group |
This template enables you to deploy an IoT Hub instance with device to cloud and cloud to device messaging configurations and a device to cloud consumer group. |
| Create an IOT Hub and Ubuntu edge simulator |
This template creates an IOT Hub and Virtual Machine Ubuntu edge simulator. |
| Create an IoT Hub Device Provisioning Service |
This template enables you to create an IoT hub and an IoT Hub Device Provisioning Service, and link the two services together. |
| Create Device Update for IoT Hub account, instance, IoT Hub |
This template creates an account, and an instance and a hub to link the instance with. It configures the hub with the necessary access polices, routes, and consumer group. |
| Deploy the MedTech service including an Azure IoT Hub |
The MedTech service is one of the Azure Health Data Services designed to ingest device data from multiple devices, transform the device data into FHIR Observations, which are then persisted in the Azure Health Data Services FHIR service. |
| Use ARM template to create IoT Hub, route and view messages |
Use this template to deploy an IoT Hub and a storage account. Run an app to send messages to the hub that are routed to storage, then view the results. |
Terraform (AzAPI provider) resource definition
The IotHubs resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Devices/IotHubs resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Devices/IotHubs@2016-02-03"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
etag = "string"
properties = {
authorizationPolicies = [
{
keyName = "string"
primaryKey = "string"
rights = "string"
secondaryKey = "string"
}
]
cloudToDevice = {
defaultTtlAsIso8601 = "string"
feedback = {
lockDurationAsIso8601 = "string"
maxDeliveryCount = int
ttlAsIso8601 = "string"
}
maxDeliveryCount = int
}
comments = "string"
enableFileUploadNotifications = bool
eventHubEndpoints = {
{customized property} = {
partitionCount = int
retentionTimeInDays = int
}
}
features = "string"
ipFilterRules = [
{
action = "string"
filterName = "string"
ipMask = "string"
}
]
messagingEndpoints = {
{customized property} = {
lockDurationAsIso8601 = "string"
maxDeliveryCount = int
ttlAsIso8601 = "string"
}
}
operationsMonitoringProperties = {
events = {
{customized property} = "string"
}
}
storageEndpoints = {
{customized property} = {
connectionString = "string"
containerName = "string"
sasTtlAsIso8601 = "string"
}
}
}
resourcegroup = "string"
sku = {
capacity = int
name = "string"
}
subscriptionid = "string"
}
}
Property Values
Microsoft.Devices/IotHubs
| Name | Description | Value |
|---|---|---|
| etag | The Etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. | string |
| location | The resource location. | string (required) |
| name | The resource name | string (required) |
| parent_id | The ID of the resource to apply this extension resource to. | string (required) |
| properties | The properties of an IoT hub. | IotHubProperties |
| resourcegroup | The name of the resource group that contains the IoT hub. A resource group name uniquely identifies the resource group within the subscription. | string (required) |
| sku | Information about the SKU of the IoT hub. | IotHubSkuInfo (required) |
| subscriptionid | The subscription identifier. | string (required) |
| tags | Resource tags | Dictionary of tag names and values. |
| type | The resource type | "Microsoft.Devices/IotHubs@2016-02-03" |
CloudToDeviceProperties
| Name | Description | Value |
|---|---|---|
| defaultTtlAsIso8601 | The default time to live for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| feedback | The properties of the feedback queue for cloud-to-device messages. | FeedbackProperties |
| maxDeliveryCount | The max delivery count for cloud-to-device messages in the device queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
EventHubProperties
| Name | Description | Value |
|---|---|---|
| partitionCount | The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. | int |
| retentionTimeInDays | The retention time for device-to-cloud messages in days. See: /azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages | int |
FeedbackProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration for the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message on the feedback queue. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. | string |
IotHubProperties
| Name | Description | Value |
|---|---|---|
| authorizationPolicies | The shared access policies you can use to secure a connection to the IoT hub. | SharedAccessSignatureAuthorizationRule[] |
| cloudToDevice | The IoT hub cloud-to-device messaging properties. | CloudToDeviceProperties |
| comments | Comments. | string |
| enableFileUploadNotifications | If True, file upload notifications are enabled. | bool |
| eventHubEndpoints | The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. | IotHubPropertiesEventHubEndpoints |
| features | The capabilities and features enabled for the IoT hub. | 'DeviceManagement' 'None' |
| ipFilterRules | The IP filter rules. | IpFilterRule[] |
| messagingEndpoints | The messaging endpoint properties for the file upload notification queue. | IotHubPropertiesMessagingEndpoints |
| operationsMonitoringProperties | The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. | OperationsMonitoringProperties |
| storageEndpoints | The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. | IotHubPropertiesStorageEndpoints |
IotHubPropertiesEventHubEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesMessagingEndpoints
| Name | Description | Value |
|---|
IotHubPropertiesStorageEndpoints
| Name | Description | Value |
|---|
IotHubSkuInfo
| Name | Description | Value |
|---|---|---|
| capacity | The number of provisioned IoT Hub units. See: /azure/azure-subscription-service-limits#iot-hub-limits. | int (required) |
| name | The name of the SKU. | 'F1' 'S1' 'S2' 'S3' (required) |
IpFilterRule
| Name | Description | Value |
|---|---|---|
| action | The desired action for requests captured by this rule. | 'Accept' 'Reject' (required) |
| filterName | The name of the IP filter rule. | string (required) |
| ipMask | A string that contains the IP address range in CIDR notation for the rule. | string (required) |
MessagingEndpointProperties
| Name | Description | Value |
|---|---|---|
| lockDurationAsIso8601 | The lock duration. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
| maxDeliveryCount | The number of times the IoT hub attempts to deliver a message. See: /azure/iot-hub/iot-hub-devguide-file-upload. | int Constraints: Min value = 1 Max value = 100 |
| ttlAsIso8601 | The period of time for which a message is available to consume before it is expired by the IoT hub. See: /azure/iot-hub/iot-hub-devguide-file-upload. | string |
OperationsMonitoringProperties
| Name | Description | Value |
|---|---|---|
| events | Dictionary of <OperationMonitoringLevel> | OperationsMonitoringPropertiesEvents |
OperationsMonitoringPropertiesEvents
| Name | Description | Value |
|---|
ResourceTags
| Name | Description | Value |
|---|
SharedAccessSignatureAuthorizationRule
| Name | Description | Value |
|---|---|---|
| keyName | The name of the shared access policy. | string (required) |
| primaryKey | The primary key. | string |
| rights | The permissions assigned to the shared access policy. | 'DeviceConnect' 'RegistryRead' 'RegistryRead, DeviceConnect' 'RegistryRead, RegistryWrite' 'RegistryRead, RegistryWrite, DeviceConnect' 'RegistryRead, RegistryWrite, ServiceConnect' 'RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect' 'RegistryRead, ServiceConnect' 'RegistryRead, ServiceConnect, DeviceConnect' 'RegistryWrite' 'RegistryWrite, DeviceConnect' 'RegistryWrite, ServiceConnect' 'RegistryWrite, ServiceConnect, DeviceConnect' 'ServiceConnect' 'ServiceConnect, DeviceConnect' (required) |
| secondaryKey | The secondary key. | string |
StorageEndpointProperties
| Name | Description | Value |
|---|---|---|
| connectionString | The connection string for the Azure Storage account to which files are uploaded. | string (required) |
| containerName | The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. | string (required) |
| sasTtlAsIso8601 | The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: /azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. | string |
Usage Examples
Terraform Samples
A basic example of deploying IotHub.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "IotHub" {
type = "Microsoft.Devices/IotHubs@2022-04-30-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
cloudToDevice = {
}
enableFileUploadNotifications = false
messagingEndpoints = {
}
routing = {
fallbackRoute = {
condition = "true"
endpointNames = [
"events",
]
isEnabled = true
source = "DeviceMessages"
}
}
storageEndpoints = {
}
}
sku = {
capacity = 1
name = "S1"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}