Learn Azure Sphere together (5)-Provision Azure Sphere to Azure China

note:

This article actually introduces a case of connecting multi-tenant IoT Hub through DPS:

Provision devices to Azure China IoT Hub through Azure Global DPS- Link Azure IoT Hub on Azure China to Device provisioning Service on Azure Global

 

The content of this section is as follows: How to talk about Azure Sphere provisioning to Azure IoT Hub in China

1. Create DPS in Azure global;

2. Create IoT Hub in Azure China;

3. Connect Azure China IoT Hub to Azure Global DPS through Azure CLI;

4. Register Azure Sphere to Azure China IoT Hub through Azure Global DPS;

 

Video introduction:

 

You can watch the video explanation of this article at Station B: https://www.bilibili.com/video/BV1Y7411C7e1/

 

Graphic introduction:

 

Actual combat steps:

1. Create DPS in Azure global;

2. Create IoT Hub in Azure China;

3. Connect Azure China IoT Hub to Azure Global DPS through Azure CLI;

4. Register Azure Sphere to Azure China IoT Hub through Azure Global DPS;

 

This article only demonstrates step 3. The rest of the content has been introduced in other articles and will not be repeated.

 

In many scenarios, we need to configure the DPS to connect to the multi-tenant IoT Hub:

such as:

1. The device manufacturer provides a DPS, but the actual Azure IoT Hub is provided and saved by the customer;

2. Register a certain type of device with regional characteristics to the specified Azure IoT Hub, for example, register a Chinese voice sweeping robot to the Azure IoT Hub in China, and the English version to the Azure region in the western United States;

3. Register a specific product to a specific Azure region according to the user's place. For example, in this example, if a device that uses Azure Sphere is only available in China, you need to register Azure Sphere to Azure China.

For the multi-tenant configuration of DPS, see the official website document: https://docs.microsoft.com/zh-cn/azure/iot-dps/how-to-provision-multitenant

 

For normal single-tenant configuration, the Azure IoT Hub can be selected through the drop-down list in the Azure Portal, see the following figure:

img-66049336-821d-4ac4-a08d-4e30b7b2c2e8.png

 

In a multi-tenant scenario, you cannot see someone's IoT Hub under your own tenant, and you cannot complete it on Portal.

At this point, you can use the Azure CLI. In this example, we use Cloud shll to complete the command:

img-7cf4b8b5-89eb-40f5-9c8e-3ccfb028b3e8.png

For the executed commands, please refer to:

az iot dps linked-hub create --connection -string " target IoT Hub connection string, care to preserve the double quotes" 
                             - DPS-name 
                             --location 
                             --resource-Group 
                             [--allocation-weight] 
                             [--apply- allocation-policy {false, true}] 
                             [--no-wait] 
                             [--subscription]

 

The required parameters are as follows:

--connection-string

The target IoT Hub, in this case the Azure China IoT Hub connection string, can be found at:

img-eb0a6f75-9552-4759-8730-27978a6774c9.png

 

--dps-name

The DPS name of Global Azure in this example

--location 

IoT Hub的 location,本例中为中国东部2,chinaeast2

--resource-group

DPS的resource group

在页面下方执行:

img-20c9d013-eee1-465d-854e-59d66b762581.png

本例中,执行如下:

az iot dps linked-hub create 
--connection-string "HostName=xxx.azuredevices.cn;SharedAccessKeyName=iothubowner;SharedAccessKey=xxx" --dps-name dps-global-seanyu 
--location chinaeast2 
--resource-group seanyu_azure_sphere_test

执行完成可以在 页面上查看结果:

img-b8bd4ef2-cacf-4f2c-b9d0-a76d2391123e.png

 

 

实际上到此已经结束了。

 

可以通过 文章《使用DPS通过对称密钥进行单个设备注册》进行创建组注册或单个注册并通过模拟设备进行测试,是否能通过Azure Global 的DPS 将设备注册到Azure China中国区IoT Hub。

 

 

 

本系列其他内容:

  1. (视频)一起学Azure Sphere(1)- 什么是 Azure Sphere

  2. (视频)一起学Azure Sphere(2)- 准备 Azure Sphere开发环境并声明设备

  3. (视频)一起学Azure Sphere(3)- 本地开发调试高级程序,上传映像后云端部署到设备

  4. (视频)一起学Azure Sphere(4)- 将Azure Sphere 通过DPS注册到Azure IoT Hub并发送遥测消息

  5. (视频)一起学Azure Sphere(5)- 将Azure Sphere 预配到Azure China IoT Hub

  6. (Video) Learn Azure Sphere together (6)-Connect Azure Sphere to Azure IoT Central and display basic diagrams in 30 minutes

 


Guess you like

Origin blog.51cto.com/10117438/2486630