Quickstart: Set up the IoT Hub Device Provisioning Service with the Azure portal

The IoT Hub Device Provisioning Service enables zero-touch, just-in-time device provisioning to any IoT hub. The Device Provisioning Service enables customers to provision millions of IoT devices in a secure and scalable manner, without requiring human intervention. Azure IoT Hub Device Provisioning Service supports IoT devices with TPM, symmetric key, and X.509 certificate authentications. For more information, please refer to IoT Hub Device Provisioning Service overview

In this quickstart, you'll learn how to set up the IoT Hub Device Provisioning Service in the Azure portal.

To provision your devices, you will:

  • Use the Azure portal to create an IoT Hub
  • Use the Azure portal to create an IoT Hub Device Provisioning Service
  • Link the IoT hub to the Device Provisioning Service

Prerequisites

You'll need an Azure subscription to begin with this article. You can create a free account, if you haven't already.

Create an IoT hub

This section describes how to create an IoT hub using the Azure portal.

  1. Sign in to the Azure portal.

  2. From the Azure homepage, select the + Create a resource button, and then enter IoT Hub in the Search the Marketplace field.

  3. Select IoT Hub from the search results, and then select Create.

  4. On the Basics tab, complete the fields as follows:

    • Subscription: Select the subscription to use for your hub.

    • Resource Group: Select a resource group or create a new one. To create a new one, select Create new and fill in the name you want to use. To use an existing resource group, select that resource group. For more information, see Manage Azure Resource Manager resource groups.

    • Region: Select the region in which you want your hub to be located. Select the location closest to you. Some features, such as IoT Hub device streams, are only available in specific regions. For these limited features, you must select one of the supported regions.

    • IoT Hub Name: Enter a name for your hub. This name must be globally unique, with a length between 3 and 50 alphanumeric characters. The name can also include the dash ('-') character.

    Important

    Because the IoT hub will be publicly discoverable as a DNS endpoint, be sure to avoid entering any sensitive or personally identifiable information when you name it.

    Create a hub in the Azure portal.

  5. Select Next: Networking to continue creating your hub.

    Choose the endpoints that devices can use to connect to your IoT Hub. You can select the default setting Public endpoint (all networks), or choose Public endpoint (selected IP ranges), or Private endpoint. Accept the default setting for this example.

    Choose the endpoints that can connect.

  6. Select Next: Management to continue creating your hub.

    Set the size and scale for a new hub using the Azure portal.

    You can accept the default settings here. If desired, you can modify any of the following fields:

    • Pricing and scale tier: Your selected tier. You can choose from several tiers, depending on how many features you want and how many messages you send through your solution per day. The free tier is intended for testing and evaluation. It allows 500 devices to be connected to the hub and up to 8,000 messages per day. Each Azure subscription can create one IoT hub in the free tier.

      If you are working through a Quickstart for IoT Hub device streams, select the free tier.

    • IoT Hub units: The number of messages allowed per unit per day depends on your hub's pricing tier. For example, if you want the hub to support ingress of 700,000 messages, you choose two S1 tier units. For details about the other tier options, see Choosing the right IoT Hub tier.

    • Defender for IoT: Turn this on to add an extra layer of threat protection to IoT and your devices. This option is not available for hubs in the free tier. For more information about this feature, see Microsoft Defender for IoT.

    • Advanced Settings > Device-to-cloud partitions: This property relates the device-to-cloud messages to the number of simultaneous readers of the messages. Most hubs need only four partitions.

  7. Select Next: Tags to continue to the next screen.

    Tags are name/value pairs. You can assign the same tag to multiple resources and resource groups to categorize resources and consolidate billing. In this document, you won't be adding any tags. For more information, see Use tags to organize your Azure resources.

    Assign tags for the hub using the Azure portal.

  8. Select Next: Review + create to review your choices. You see something similar to this screen, but with the values you selected when creating the hub.

    Review information for creating the new hub.

  9. Select Create to start the deployment of your new hub. Your deployment will be in progress a few minutes while the hub is being created. Once the deployment is complete, select Go to resource to open the new hub.

Create a new IoT Hub Device Provisioning Service

  1. In the Azure portal, select + Create a resource .

  2. Search the Marketplace for the Device Provisioning Service. Select IoT Hub Device Provisioning Service.

  3. Select Create.

  4. Enter the following information:

    • Name: Provide a unique name for your new Device Provisioning Service instance. If the name you enter is available, a green check mark appears.

    • Subscription: Choose the subscription that you want to use to create this Device Provisioning Service instance.

    • Resource group: This field allows you to create a new resource group, or choose an existing one to contain the new instance. Choose the same resource group that contains the Iot hub you created in the previous steps. By putting all related resources in a group together, you can manage them together. For example, deleting the resource group deletes all resources contained in that group. For more information, see Manage Azure Resource Manager resource groups.

    • Location: Select the location that's closest to your devices.

      Enter basic information about your Device Provisioning Service instance in the portal blade

  5. Select Review + Create to validate your provisioning service.

  6. Select Create.

  7. After the deployment successfully completes, select Go to resource to view your Device Provisioning Service instance.

In this section, you'll add a configuration to the Device Provisioning Service instance. This configuration sets the IoT hub for which devices will be provisioned.

  1. In the Settings menu, select Linked IoT hubs.

  2. Select + Add.

  3. On the Add link to IoT hub panel, provide the following information:

    • Subscription: Select the subscription containing the IoT hub that you want to link with your new Device Provisioning Service instance.

    • Iot hub: Select the IoT hub to link with your new Device Provisioning Service instance.

    • Access Policy: Select iothubowner as the credentials for establishing the link with the IoT hub.

      Link the hub name to link to the Device Provisioning Service instance in the portal blade

  4. Select Save.

  5. Select Refresh. Now you should see the selected hub under the Linked IoT hubs blade.

Clean up resources

The rest of the Device Provisioning Service quickstarts and tutorials use the resources that you created in this quickstart. However, if you don't plan on doing any more quickstarts or tutorials, you'll want to delete those resources.

To clean up resources in the Azure portal:

  1. From the left-hand menu in the Azure portal, select All resources.

  2. Select your Device Provisioning Service.

  3. At the top of the device detail pane, select Delete.

  4. From the left-hand menu in the Azure portal, select All resources.

  5. Select your IoT hub.

  6. At the top of the hub detail pane, select Delete.

Next steps

Provision a simulated device with IoT hub and the Device Provisioning Service: