Azure IoT Connector

IoTIFY connectors make it extremely easy to manage device provisioning and testing. Learn more about how to deploy thousands of virtual IoT devices in Azure IoT Hub.

Introduction

Azure IoT Hub is one of the leading IoT platform out there. With native integration with wide set of Azure Services, Azure IoT offers compelling and easy to use solutions in IoT market.

Introducing Azure IoTIFY connector

Azure IoT connector from IoTIFY simplifies the entire process of provisioning devices in IoT Hub and template creation. All you need is a Connection String and you are good to deploy and test as many virtual IoT devices as you need in Azure IoT Hub.

Let’s get started with Azure IoT Hub deployment.

Step 1. Deploy an Azure IoT Hub Instance

Create an Azure IoT hub in your desired region and capacity.

Step 2. Credentials

Once the Azure IoT Hub is ready, provide the primary Connection string to IoTIFY. To do that,

Go to Shared Access Policies in the left side menu and then click on the registryReadWrite Policy menu.

A pop menu will open on the right side. Copy the Connection string—primary key from the input box. We will need this key in IoTIFY connector.

Now go to the Network template in IoTIFY and click on Azure Connectors. Provide the copied connection string in credentials input.

Specify the number of devices to be deployed and then click Provision button.

What will happen in the background?

  1. A new GUID will be created for authentication parameters.

  2. Specified number of the new devices will be created in IoT hub registry with name pattern iotify_%d where %d is device index

  3. Credentials will be assigned to each device based on the newly generated GUID pattern, followd by device index e.g. GUID[%d] where %d is device index

  4. A sample template will be generated which could be used to simulate all of the newly provisioned devices.

Step 3. Template

A new template will be automatically created by the connector Wizard. Once the wizard finishes deploying IoT things, you will be redirected to the newly created template.
This template has couple of clever tricks to enable multiple individual Azure IoT object being simulated in a single template.

Here is how the template works -
The template has {{state.credentials}} macro in the place of the password field in the Authentication Tab.
The password will be dynamically generated based on each device ID and the GUID. How? The trick is in the init function.

{
var expiryEpoch = moment().add(1, 'year').unix();
state.__$credentials = azureDevice.SharedAccessSignature.create(
'myazure.azure-devices.net',
'iotify_'+_meta.clientId,
new Buffer('4fc2f380-36f2-0288-4ca4-1b7038fd2568'+_meta.clientId).toString('base64'),
expiryEpoch).toString();
}

The init function will populate the state.__$credentials once the device is initialized. The password field will then be used for authentication for Azure IoT Hub MQTT broker.

Note that the GUID is only available in the template. If you delete the template, the credentials will be lost.

Cleaning up

To clean up, simply press the red button Cleanup instead of provision devices. It is necessary to cleanup devices if you want to provision new devices.