Edit

Get started with Azure Device Registry for Azure IoT Hub

Set up an Azure Device Registry (ADR) namespace with Azure IoT Hub and Device Provisioning Service (DPS). Use the guided setup with new or existing IoT Hub and DPS instances, or connect the instances individually for more control. You can also enable certificate management and the software update feature where supported.

This article covers namespace and service setup, the first stage of connecting a device. The complete process is:

Diagram of four stages: create and link services in this article; optionally configure certificates; configure provisioning; and connect devices.

  1. Set up your namespace and link new or existing IoT Hub and DPS instances by following this article.
  2. If you use certificate management, create an intermediate certificate authority (CA) and create a certificate policy.
  3. Configure provisioning in DPS. If you use certificate management, select the certificate policy for provisioning.
  4. Provision and connect your device with the unified Azure IoT SDKs.

After you finish either setup method in this article, follow Next steps to continue the remaining stages.

Important

Azure Device Registry bills for device and asset resources, certificate authorities, and certificate issuance and renewal. The IoT Hub and Device Provisioning Service (DPS) instances that you use with it are billed at their standard rates. Groups, jobs, and software updates aren't billed during preview. For IoT Hub rates, see Azure IoT Hub pricing.

Prerequisites

  • An active Azure subscription. If you don't have an Azure subscription, create a free account.
  • The Microsoft.DeviceRegistry and Microsoft.Devices resource providers registered in your subscription. If you plan to use software update, also register Microsoft.DeviceUpdate. You need subscription-level permission if you register them yourself. For instructions, see Register a resource provider.
  • An existing resource group, or permission to create one in your subscription.
  • Permission to create and configure Azure Device Registry namespaces, IoT Hub instances, DPS instances, and managed identities in each resource group you use, plus software update instances if you enable software update. For example, the Contributor role on each resource group grants these resource-management permissions. The Owner role also grants them.
  • The privilege to perform role assignments within your target scope. Performing role assignments in Azure requires a privileged role, such as Owner or User Access Administrator at the appropriate scope.
  • A supported region for Azure Device Registry with IoT Hub. New services use the namespace's region.

Warning

Connecting an existing IoT Hub instance or DPS instance to an Azure Device Registry namespace is permanent and can't be reversed. You're asked to acknowledge this effect when you select an existing resource.

Ways to get started

You can set up Azure Device Registry in two ways:

Both setup methods link a DPS instance and IoT Hub instances to an ADR namespace.

The guided setup is available only in the Azure portal. When you connect services individually, you can use the Azure portal or the Azure CLI.

New IoT Hub instances created through either portal setup method have public network access enabled. Authentication with IoT Hub-level shared access keys is disabled.

Use existing IoT Hub and DPS instances

Use IoT Hub and DPS instances in the namespace's region, and wait for them to finish provisioning before linking them.

Enable a managed identity on both the DPS instance and each IoT Hub instance before linking them. For instructions, see Enable a managed identity for DPS and Use managed identities in IoT Hub. The CLI examples in this article use system-assigned identities.

IoT Hub instances must also have public network access enabled.

To select Existing IoT Hub instances, use hubs that aren't already linked to a namespace or DPS instance. Their connection profile must match the profile selected for the namespace.

To select Existing DPS linked to IoT Hub instances, use a DPS instance that isn't already linked to a namespace and has at least one linked hub. The DPS instance and all its linked hubs must be in the selected subscription and region. Its hubs must use the same connection profile, must not belong to another namespace, and must fit within the namespace's remaining hub capacity.

The linked hubs determine the connection profile for an existing DPS setup.

In the portal, open IoT Hub requirements or DPS setup requirements beside the selector for details. Unavailable entries can't be selected.

Use the guided setup

You can start the guided setup from either of these locations in the Azure portal:

  • Search for Azure Device Registry in the Azure portal. Open the service page, and on the Get started tab, select Get started.
  • From an existing namespace, on the Get started tab, select Set up under Set up your solution. Only namespaces that still need setup are eligible. To add services to a namespace that already has a linked DPS instance, link services individually.

Screenshot of the Azure Device Registry Get started tab with the Get started action.

The guided setup walks you through four steps: ADR namespace, Connectivity, Capabilities, and Review + create.

1. ADR namespace

On the ADR namespace page:

  1. Select whether to Create a namespace or Use an existing namespace.
  2. Select the Azure subscription and resource group.
  3. If you create a namespace, enter a Namespace name with 3-60 lowercase letters, numbers, or hyphens, and select a region. Setup uses the name to suggest names for new services.
  4. If you use an existing namespace, select it from the eligible namespaces. Its region determines where DPS and IoT Hub instances are created and which existing instances you can select. The namespace must have a managed identity enabled. If it has no managed identity, follow the identity setup steps in an Azure CLI tab under Create or open a namespace before continuing.

To use existing DPS or IoT Hub instances, select their subscription and region.

Screenshot of the ADR namespace step with options to create or use an existing namespace and fields for subscription, resource group, namespace name, and region.

2. Connectivity

On the Connectivity page, choose how your devices connect. Based on your selection, Azure uses or creates a DPS instance and one or more IoT Hub instances.

Select one of these paths:

  • Create new DPS and IoT Hub instances: Choose a connection profile and a fleet preset. Azure creates one IoT Hub instance and a DPS instance.
  • Use existing IoT Hub instances: Choose Existing DPS linked to IoT Hub instances to use an existing DPS setup, or Existing IoT Hub instances to select hubs and create a new DPS instance.

Guided setup enables a system-assigned managed identity for each new ADR namespace, DPS instance, and IoT Hub instance. To create a user-assigned identity for a new DPS or IoT Hub instance, use that instance's Advanced settings.

Setup assigns the Azure roles required to connect the namespace, DPS instance, and IoT Hub instances.

If you use existing IoT Hub or DPS instances, follow the requirements for existing IoT Hub and DPS instances before selecting them.

When you create IoT Hub instances or use existing IoT Hub instances that aren't linked to DPS, select the Classic connection profile for MQTT 3.1.1, AMQP, or HTTPS, or the MQTT v5 (preview) connection profile for MQTT 5. For an existing DPS setup, its linked hubs determine the connection profile. The MQTT v5 (preview) connection profile is available only in supported regions and doesn't support certificate management or software update.

Each preset creates one IoT Hub instance with the following default capacity. You can configure it before continuing and add more hubs later.

Preset Classic connection profile MQTT v5 (preview) connection profile
Small connected fleet S1, 1 unit 1 unit
Growing fleet S2, 2 units 10 units
Large-scale fleet S3, 3 units 25 units

Screenshot of the Connectivity step with new DPS and IoT Hub instances, the Classic connection profile, and three fleet presets.

You can select up to 10 IoT Hub instances. Linking existing IoT Hub and DPS instances is permanent.

3. Capabilities

On the Capabilities page, choose which capabilities to enable. Azure sets up the required resources based on your selection.

  • Certificate management is selected by default for supported hubs. It creates a Microsoft-issued root CA, or uses the namespace's existing root CA. Creating an intermediate CA and certificate policy is a separate step.
  • Software update (preview) is optional. Azure creates an update instance with a default configuration. Select the edit icon on its card to change its settings before continuing. This option is unavailable if a selected IoT hub has a Device Update for IoT Hub instance. Select a new or existing IoT hub that doesn't have one. To use an IoT hub that already has a Device Update for IoT Hub instance, delete that instance first. The guided setup also creates the role assignments for the managed identities and gives you the Device Update Administrator role on the update instance. For more information, see Access control.

Note

During preview, setting up the software update feature can take up to 30 minutes.

For the MQTT v5 (preview) connection profile, both capabilities are unavailable.

Screenshot of the Capabilities step with certificate management and software update selected.

4. Review + create

On the Review + create page, review the impact summary, namespace details, connectivity setup, and enabled capabilities before you submit:

  • An Impact summary lists the services that are added to the subscription and resource group.
  • Check the namespace, the existing DPS and IoT Hub instances you selected, the instances to be created, and your selected capabilities. Return to the relevant step to change a selection or configuration.
  • A warning states that connecting these services is an irreversible action that can cause downtime for existing management services.

Review the cost estimate shown during setup. Availability and amounts depend on the selected resources and pricing information.

Submit the setup and follow the deployment's progress in the Azure portal. If setup or deployment fails, review the error details before trying again.

When the deployment succeeds, open the ADR namespace and select Linked services. Confirm that the DPS instance and your selected IoT Hub instances are linked before continuing.

Continue with Next steps to prepare and connect your first device.

Connect services individually

Use this path to choose resources individually or add services to an existing namespace. Link a DPS instance first, then one or more IoT Hub instances. Set up a root CA if you want certificate management, and optionally link a software update instance.

The CLI walkthrough creates an S1 IoT Hub instance with the Classic connection profile and uses system-assigned managed identities. This profile supports the optional certificate-management and software update steps.

Note

For the MQTT v5 (preview) connection profile, use the guided setup or the Azure portal option in Connect an IoT Hub instance. Create a new hub or select existing hubs with that profile; all hubs in the namespace must use the same profile. After linking, go to Verify the connected resources. The root CA and software update steps apply to the Classic connection profile.

The examples use one resource group. If you use existing DPS or IoT Hub instances in other resource groups, use each instance's resource group in its lookup commands and the namespace's resource group in the link commands.

Azure CLI setup

If you use the CLI tabs, install the Azure CLI and choose one version of the azure-iot extension.

Use preview version 1.1.0b1 to follow all steps, including optional preview features. The preview extension supports both generally available and preview features:

az login
az extension add --name azure-iot --version 1.1.0b1 --allow-preview true --upgrade

If you use only generally available features, install stable version 1.0.0 instead:

az login
az extension add --name azure-iot --version 1.0.0 --upgrade

Confirm the installed version:

az extension show --name azure-iot --query version -o tsv

Linking can take several minutes while managed-identity permissions propagate. Let each command finish before continuing.

1. Create or open a namespace

Create an Azure Device Registry namespace or open an existing namespace. The namespace is the organizational and fleet boundary for the devices in your solution. When you create a namespace, the portal automatically enables its system-assigned managed identity.

If you use an existing namespace, check that it has a managed identity enabled before connecting a DPS instance or IoT Hub instances. If the namespace has no managed identity, select an Azure CLI tab in this section and follow the identity setup steps.

Open the namespace and select the Linked services tab. Use Connect to add the DPS instance first. Wait for it to finish linking before connecting IoT Hub instances.

Screenshot of the Linked services Connect menu with IoT Hub unavailable before a DPS instance is linked.

2. Connect a Device Provisioning Service instance

If you use an existing DPS instance, follow the requirements for existing IoT Hub and DPS instances before connecting it.

Select Connect > Device Provisioning Service (DPS), and choose how to connect the DPS instance:

  • Use existing: Select a DPS instance that isn't already linked to an ADR namespace. Its linked IoT Hub instances are included.
  • Create new: Select the subscription and resource group, and enter a name. The portal creates the DPS instance in the namespace's region with a system-assigned managed identity. To create a user-assigned identity instead, expand Advanced.

Select Save and wait for the portal to finish linking the DPS instance before connecting more IoT Hub instances.

3. Connect an IoT Hub instance

If you use existing IoT Hub instances, follow the requirements for existing IoT Hub and DPS instances before connecting them.

Select Connect > IoT Hub, and review the connection profile. Choose Classic or MQTT v5 (preview) if the profile isn't already set by the namespace's linked IoT Hub or software update instances. All IoT Hub instances you add must match this profile.

Choose how to connect the IoT Hub instances:

  • Use existing: Select the IoT Hub instances to connect.
  • Create new: Select the subscription and resource group, and configure the IoT Hub instance's name and capacity. The portal creates the IoT Hub instance in the namespace's region with a system-assigned managed identity. To create a user-assigned identity instead, expand Advanced.

When you connect existing IoT Hub instances, acknowledge that linking them to the namespace is permanent.

Select Save and wait for linking to finish. Then verify the linked DPS and IoT Hub instances.

4. Set up a root certificate authority (optional)

  1. In your namespace, under Security, select Certificate Authorities.
  2. Select Create > Root Certificate Authority. This option is disabled if the namespace already has a root CA.
  3. Enter a name for the root CA that's 3-63 characters long, and then select Create.
  4. Wait for provisioning to finish. Confirm that the root CA appears on the Certificate Authorities page.

To issue device certificates, you also need an intermediate CA and a certificate policy. For instructions, see Set up a managed root and intermediate CA.

5. Connect a software update instance (optional)

Note

During preview, setting up the software update feature can take up to 30 minutes.

The software updates (preview) feature isn't supported for the MQTT v5 (preview) connection profile. You can't use software updates with an IoT hub that has a Device Update for IoT Hub instance. Connect a new or existing IoT hub that doesn't have one. To use an IoT hub that already has a Device Update for IoT Hub instance, delete that instance first.

Only one software update instance can connect to a namespace. Connecting it creates the role assignments the namespace and the update instance need, so you need permission to create role assignments, as described in Prerequisites. Connecting doesn't assign a role to your account, so the last step assigns you one.

  1. Select Connect > Software update (preview). You can also start from the namespace's Software updates (preview) page by selecting Set up software updates (preview).

  2. In Configure software update (preview) instance, enter a Name for the new update instance. The subscription, resource group, and region match the namespace.

  3. By default, the update instance uses a system-assigned managed identity to communicate with the namespace. To use a user-assigned identity instead, expand Advanced, select User-assigned, and then select the identity in Managed identity.

    Screenshot of the Configure software update (preview) instance pane with the subscription, resource group, instance name, and region, and Advanced options showing System-assigned selected as the managed identity type.

  4. Select Save.

  5. Assign yourself the Device Update Content Administrator role on the update instance so you can import and delete updates. For steps, see Assign Azure roles using the Azure portal. For more information about the roles, see Access control.

Role assignments created during setup

Connecting a software update instance, through the guided setup, the Azure portal, or the Azure CLI, creates these role assignments for the managed identities so that the namespace and the update instance can communicate:

  • Namespace managed identity: Contributor and Device Update Administrator on the update instance, Azure Device Registry Administrator on the namespace, and Reader on the resource groups of the namespace and the update instance.
  • Update instance managed identity: Azure Device Registry Contributor and Reader on the namespace.

6. Verify the connected resources

On the namespace's Linked services tab, confirm that the resources show a Health status of Available and a Link status of Linked. If you enabled certificate management, also confirm that the root CA finished provisioning under Security > Certificate authorities.

Screenshot of Linked services showing a software update instance, IoT Hub, and DPS with Available health and Linked status.

Continue with Next steps to prepare and connect your first device.

Resource naming

The guided setup suggests resource names based on the namespace name. You can change the suggested names before you submit them.

For example, if the namespace name is contoso-devices, the guided setup suggests the following names:

Resource Suggested name pattern Example
Azure Device Registry namespace <namespace-name> contoso-devices
IoT Hub instance <namespace-name>-hub-<number> contoso-devices-hub-1
Device Provisioning Service <namespace-name>-provisioning contoso-devices-provisioning
Root certificate authority <namespace-name>-root-ca contoso-devices-root-ca
Software update instance <namespace-name>-su contoso-devices-su

Manage linked resources

Connecting services to a namespace doesn't replace their individual management experiences. To change settings for an IoT Hub instance, open the instance in the Azure portal. To change DPS settings, open the DPS instance in the Azure portal.

Next steps

Your namespace and selected services are configured. If you enabled certificate management, follow these steps in order. The device uses separate onboarding and operational credentials.

  1. Create an intermediate CA that uses your namespace's existing root CA, then create a certificate policy.
  2. Configure provisioning in DPS in the instance already linked to your namespace. Create an individual enrollment or enrollment group for the onboarding credential your device will use.
  3. Select your intermediate CA and certificate policy for provisioning.
  4. Use the unified Azure IoT SDKs to send a certificate signing request during DPS provisioning and connect to the assigned IoT Hub with the issued certificate.

Other connection paths

  • For the Classic connection profile, try provisioning without managed certificate issuance by following Provision a simulated symmetric key device. Use the DPS and hubs you linked here rather than repeating the service-setup prerequisite.
  • For the MQTT v5 (preview) connection profile, review the SDK documentation and samples for version-specific protocol support before choosing a device client.