Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In Azure, browse to 'Storage Accounts'. You should see something similar to what is shown below:

Image RemovedImage Added


Click 'NewCreate' in the upper left corner. This will open the following window:

Image Removed

Image AddedSpecify the Subscription, Resource Group, Storage account name, and Location as shown above. Leave the other fields default. Now click 'Review + Create' near the bottom of the screen. All of the other tab fields (under Networking, Data Protection, Advanced, and Tags) can be left default for the purposes of this example. However, if this is intended to run in production make sure to visit these tabs and set up the Storage Account appropriately for your use case and security needs. After creating the Storage Account, you should see it on the main Storage Accounts page as shown below:

Image RemovedImage Added

Now select the Storage Account and and scroll down to 'Containers' in the navigation pane for the Storage Account. This is under the 'Blob ServiceData Storage' section as shown below.

Image Removed

Image AddedClick the '+ Container' button near the top of the main panel. This will open a new panel on the right. Give the new container a name as shown below and click 'Create' in the lower right of the page.

Image RemovedImage Added

You should now see the new container as shown below.

Image RemovedImage Added

At this point the Storage Account and Container are ready to receive routed messages from Azure IoT Hub.

...

Now click the '+ Add' button to add a new Custom Endpoint. This will open a drop down menuthe page below. Select 'Storage' as the endpoint type as shown below.

Image Removed

This will open the window below:

Image Removed

Image Added

Enter Now give it a name and also select the Storage Container that was created during Step 2 of this tutorial. Also, make sure to set the 'Encoding' type to JSON as shown above. Leave all other fields default. Finally click 'Create'. When the endpoint creation completes, you should see the created endpoint as shown below.

Image Removed

Now switch back to the 'Routes' tab at the top of the main panel as shown below.

Image Removed

Now click the '+ Add' button Next, it will progress to create a new route. This will open the following window.:

Image AddedImage Removed

Set the Name, Endpoint (use the storage endpoint you just created) and leave the Data source to the default of 'Device Telemetry Messages'. Also set the Routing Query to the following (and as shown above):

Code Block
$body.topic.groupId = 'Routed Group'

Finally, click Save "Create" to save the route. You should now see the newly created route as shown below.

Image RemovedImage Added

At this point, IoT Hub should be ready to route messages based on the content of the message.

...

At this point, the data should be flowing into the container. To view it, browse back to your Storage Account in the Azure portal. In the main panel is a 'Storage Explorer' option (shown below) which is in preview at the time of this writing (Feb 26, 2021). Click this link to open the Storage Explorer.

Image Removed

After opening the Storage Explorer, you should see something similar to the following

Image Removed

got to Data Storage → Containers → your container

Image Added

Then browse into your IoT Hub folder down through the levels to find the JSON filesUnder the 'BLOB CONTAINERS' there should be a link with your container as well a folder showing your IoT Hub name. Note it may take a few minutes for this data to appear even with everything configured properly. Once the IoT Hub name is present, double click it in the far right panel and click through the series of folders shown there. These folders represent the time at which various files were created. When you get to the final folder, you should see something similar to what is shown below in that the final leaf folder contains one or more JSON files.:

Image RemovedImage Added

Select one of these files and download it. Upon opening with a text editor, you a JSON file and click to "Edit." You should see something similar to the following.:

Image RemovedImage Added



If you scroll to the right, you should ultimately see the 'body' of the message. This is the raw message that was sent to Azure from the Azure Injector module. Each one of these messages represents a message that was sent from Azure Injector to IoT Hub.

Image RemovedImage AddedNote that all of the messages shown here are from the 'Routed Group'. This is because of how the Azure IoT Hub message route was configured. The 'routing query' is looking for a 'groupId' of 'Routed Group'. So, all messages from the original 'Tutorial Group' were ignored and not routed to the container.

...