Azure IoT Documentation

Azure IoT Device Provisioning Service (DPS)

The Azure IoT Device Provisioning Service (DPS) enables zero-touch, scalable, and secure device provisioning to the Azure IoT hub of your choice. It eliminates the need for manual provisioning steps and supports a wide range of authentication mechanisms.

Key Features

How it Works

  1. Create an enrollment or enrollment group in DPS.
  2. Device connects to DPS using its credentials.
  3. DPS authenticates the device and assigns it to a target IoT hub.
  4. Device establishes a secure MQTT/HTTPS/AMQP connection to the assigned hub.

Quickstart: Register a Device

Follow these steps to provision a device using the Azure portal.

  1. Navigate to Device Provisioning Services in the Azure portal.
  2. Create a new DPS instance or select an existing one.
  3. Under Enrollments, click Add enrollment group.
  4. Upload a root certificate (or use a symmetric key) and provide a group name.
  5. Configure the IoT hub that devices in this group should be assigned to.
  6. Save the enrollment and note the registration ID for your device.

Device Provisioning Sample (C#)

using Microsoft.Azure.Devices.Provisioning.Client;
using Microsoft.Azure.Devices.Provisioning.Client.Transport;
using Microsoft.Azure.Devices.Shared;

var provisioningHost = "global.azure-devices-provisioning.net";
var idScope = "<Your ID Scope>";
var registrationId = "<Device Registration Id>";
var symmetricKey = Convert.FromBase64String("<Device Symmetric Key>");

using var security = new SecurityProviderSymmetricKey(registrationId, symmetricKey, null);
using var transport = new ProvisioningTransportHandlerMqtt(TransportFallbackType.TcpOnly);
var provClient = ProvisioningDeviceClient.Create(provisioningHost, idScope, security, transport);

Console.WriteLine("Attempting registration...");
DeviceRegistrationResult result = await provClient.RegisterAsync();
Console.WriteLine($"Status: {result.Status}");

if (result.Status == ProvisioningRegistrationStatusType.Assigned)
{
    var iotHub = result.AssignedHub;
    var deviceId = result.DeviceId;
    Console.WriteLine($"Device assigned to {iotHub} with DeviceId {deviceId}");
}

REST API Reference

Base URL: https://global.azure-devices-provisioning.net

MethodEndpointDescription
GET/enrollmentsList all enrollments
POST/enrollmentsCreate a new enrollment
GET/enrollments/{id}Retrieve enrollment details
DELETE/enrollments/{id}Delete an enrollment

All requests must include the Authorization header with a valid SAS token.