Azure IoT Hub DPS

This page shows how to write Terraform and Azure Resource Manager for IoT Hub DPS and write them securely.

azurerm_iothub_dps (Terraform)

The DPS in IoT Hub can be configured in Terraform with the resource name azurerm_iothub_dps. The following sections describe 9 examples of how to use the resource and its parameters.

Example Usage from GitHub

azure-iot-dps.tf#L2
resource "azurerm_iothub_dps" "raspberry_pi_temp" {
  name                = "raspberrypitemp"
  resource_group_name = azurerm_resource_group.azure_iot_resource_group.name
  location            = var.location
  #allocation_policy   = "Hashed"

main.tf#L44
resource "azurerm_iothub_dps" "b59dps" {
    name                = "b59dps"
    resource_group_name = azurerm_resource_group.b59.name
    location            = azurerm_resource_group.b59.location

    sku {
IotDps.tf#L5
resource "azurerm_iothub_dps" "iotdps" {
  name                = "__var.resourceiotdps__"
  resource_group_name = data.azurerm_resource_group.resourcegroupiotdps.name
  location            = data.azurerm_resource_group.resourcegroupiotdps.location

  sku {
main.tf#L42
resource "azurerm_iothub_dps" "primary" {
    name                = local.iot_hub_dps_name
    resource_group_name = azurerm_resource_group.primary.name
    location            = azurerm_resource_group.primary.location

    sku {
main.tf#L7
resource "azurerm_iothub_dps" "this" {
  location            = var.location
  name                = var.name
  resource_group_name = var.resource_group_name
  tags                = var.tags

main.tf#L7
resource "azurerm_iothub_dps" "this" {
  location            = var.location
  name                = var.name
  resource_group_name = var.resource_group_name
  tags                = var.tags

main.tf#L65
resource "azurerm_iothub_dps" "primary" {
    name                = local.iot_hub_dps_name
    resource_group_name = azurerm_resource_group.primary.name
    location            = azurerm_resource_group.primary.location

    sku {
main.tf#L107
resource "azurerm_iothub_dps" "iot_hub_paessler" {
  name                = "sigfoxpaessler"
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location
  allocation_policy   = "Hashed"

main.tf#L93
resource "azurerm_iothub_dps" "airq-iot-hub-dps" {
  name                = "airq-iot-hub-dps"
  resource_group_name = azurerm_resource_group.airq-rg.name
  location            = azurerm_resource_group.airq-rg.location

  sku {

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an IotHub Device Provisioning Service.

Microsoft.Devices/provisioningServices (Azure Resource Manager)

The provisioningServices in Microsoft.Devices can be configured in Azure Resource Manager with the resource name Microsoft.Devices/provisioningServices. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

template.json#L13
            "type": "Microsoft.Devices/provisioningServices",
            "apiVersion": "2020-03-01",
            "name": "[parameters('provisioningServices_P4_DPS_name')]",
            "location": "westeurope",
            "sku": {
                "name": "S1",
Microsoft.Devices.tests.json#L8
          "type": "Microsoft.Devices/provisioningServices",
          "apiVersion": "2017-11-15",
          "location": "West US",
          "sku": {
            "name": "S1",
            "tier": "standard",
Microsoft.Devices.tests.json#L8
          "type": "Microsoft.Devices/provisioningServices",
          "apiVersion": "2017-08-21-preview",
          "location": "West US",
          "sku": {
            "name": "S1",
            "tier": "standard",
dps.json#L9
            "type": "Microsoft.Devices/provisioningServices",
            "apiVersion": "2020-01-01",
            "name": "{0}",
            "location": "{1}",
            "sku": {{
                "name": "S1",
dps-template.json#L21
            "type": "Microsoft.Devices/provisioningServices",
            "apiVersion": "2020-01-01",
            "name": "[parameters('dpsName')]",
            "location": "[parameters('location')]",
            "sku": "[parameters('sku')]",
            "properties": {
test-list-expected.json#L5
    "type": "Microsoft.Devices/provisioningServices"
  }
]

Frequently asked questions

What is Azure IoT Hub DPS?

Azure IoT Hub DPS is a resource for IoT Hub of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure IoT Hub DPS?

For Terraform, the LucasBurgessDev/PortfolioAWSTerraform, mysticrenji/terraform-azure and osmodies/github-move source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the Skarlyne/iotamazonia, Azure/azure-resource-manager-schemas and Azure/azure-resource-manager-schemas source code examples are useful. See the Azure Resource Manager Example section for further details.