A Companion Experience that enables you to move devices between Azure IoT Central applications or move devices from an Azure IoT Central application to an Azure IoT Hub
Перейти к файлу
Vincenzo Caruso c3eb264920
Merge pull request #23 from Azure/dependabot/npm_and_yarn/crypto-js-4.2.0
Bump crypto-js from 4.1.1 to 4.2.0
2023-11-17 09:30:54 -08:00
assets add readme 2022-08-19 00:40:28 +02:00
device_samples Bump xml2js and @azure/storage-blob in /device_samples/nodejs 2023-04-12 00:17:37 +00:00
docs add readme 2022-08-19 00:40:28 +02:00
public add readme 2022-08-19 00:40:28 +02:00
src fix build 2022-12-13 16:23:35 +01:00
.gitignore update ignore 2022-11-28 17:57:39 +01:00
.prettierrc.json refactor 2022-08-11 16:02:27 +02:00
LICENSE add readme 2022-08-19 00:40:28 +02:00
README.md update readme 2022-12-05 17:07:53 +01:00
SECURITY.md Microsoft mandatory file 2022-07-25 19:01:04 +00:00
package-lock.json Bump crypto-js from 4.1.1 to 4.2.0 2023-10-25 22:53:23 +00:00
package.json Bump crypto-js from 4.1.1 to 4.2.0 2023-10-25 22:53:23 +00:00
tsconfig.json refactor 2022-08-11 16:02:27 +02:00

README.md

Azure IoT Central device migration tool

A companion experience that enables you to move devices between IoT Central applications and from/to Azure IoT Hub.

Requirements

  • An IoT Central application (or two if moving between applications)

    Go to IoT Central to create one.

  • An Azure Active Directory Application (AAD)

    Follow instructions here.

  • An IoT Hub instance (if migrating from/to Azure IoT Hub)

    Go to Azure Portal > IoT Hub to create one IoT Hub.

  • An Azure IoT Hub Device Provisioning Services (DPS) associated to the IoT Hub instance.

    Go to Azure Portal > DPS to create one DPS.

Setup

Create a file called .env in project root with following content after completed AAD creation steps above.

PORT=3002
REACT_APP_AAD_APP_CLIENT_ID=<your-AAD-Application-(client)-ID>
REACT_APP_AAD_APP_TENANT_ID=<your-AAD-Directory-(tenant)-ID>
REACT_APP_AAD_APP_REDIRECT_URI=http://localhost:3002

Make sure that the REACT_APP_AAD_APP_REDIRECT_URI in the config file and the Redirect URIs specified in your AAD Application are the same.

Model requirements

To successfully perform a migration from an IoT Central application, the template for the devices to be migrated must comply to a specific configuration. The easiest and quickest way to define required capabilities is to import the DeviceMigration component into the template.

You can find the json file here.

Follow instructions on IoT Central official documentation.

This repository contains few code samples showing how to handle the migration process from device side.

Run

You can run the tool in development mode using:

npm start
  • Open in the browser the AADRedirectURI url previously defined in your .env (by default is http://localhost:3002) to view it in the browser.

  • Authenticate the user.

Options

  1. IoT Central -> IoT Hub

Pick the needed values from source and target forms. Provide a name and click on Migrate button.

Follow instructions on the page to create a new enrollment group in the DPS instance then click on Start migration.

  1. IoT Central -> IoT Central

Pick the needed values from source and target forms. Optionally specify a target template to automatically assign migrating devices to a particular template in the application. Provide a name and click on Migrate button. Wait for the migration job to be configured. After that the job will automatically start and you can follow the progress in the Migration status page.

  1. IoT Hub -> IoT Central

Select the hubs from which migrating devices, provide a name and click on Migrate button. The job has been configured and available in the Migration status page. Once there click on "Run" and provide the required keys following instructions.

Wait for the job to complete.

Codebase

iotc-migrator is a React SPA application written in Typescript that runs 100% in the browser. It was bootstrapped with Create React App.

The project consume public Azure APIs on the latest stable versions.

The Authentication is performed using Microsoft Authentication Library (MSAL).