element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Blog #1  Prerequisites (Azure IoT account)
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: james.flynn
  • Date Created: 3 Dec 2018 4:46 PM Date Created
  • Views 546 views
  • Likes 1 like
  • Comments 0 comments
Related
Recommended

Blog #1  Prerequisites (Azure IoT account)

james.flynn
james.flynn
3 Dec 2018

    • Web/Azure Prerequisites
    • Create an IoT hub
    • Retrieve the IoT Hub Connection String
    • Register your device in the IoT hub using the Web Interface
    • Install Azure Command Line Interface (CLI)
    • Install Microsoft Azure Device Explorer (Windows GUI)
    • Wrap-up
image

Much of this BLOG has been covered before and in other BLOGS, but for the sake of completeness, I have included it here.  Additionally, Microsoft has recently discontinued support for their iot-explorer CLI tool and integrated that functionality into their Azure CLI tool, so I discuss how to install and get monitoring and messaging capabilities.

 

Web/Azure Prerequisites

To work with the example code, you must have an active Azure subscription. If you don't have an Azure account, you can create a free Azure trial account. After you have an account there are two steps you must perform to work with it:

  • Step #1 You must create an IoT Hub.  This is the repository that contains the devices you interact with.
  • Step #2 You must register a device in the IoT Hub.

 

Create an IoT hub

  1. Sign in to the Azure portal.
  2. Select Create a resource > Internet of Things > IoT Hub.

image

  • In the IoT hub pane, enter the following information for your IoT hub:
  • Subscription: Choose the subscription that you want to use to create this IoT hub.
  • Resource group: Create a resource group to host the IoT hub or use an existing one. For more information, see Use resource groups to manage your Azure resources.
  • Region: Select the closest location to you.
  • Name: Create a name for your IoT hub. If the name you enter is available, a green check mark appears.

Important

The IoT hub will be publicly discoverable as a DNS endpoint, so make sure to avoid any sensitive information while naming it.

image

  1. Next: Size and scale to continue creating your IoT hub.
  2. Choose your Pricing and scale tier. For this article, select the F1 - Free tier if it's still available on your subscription. For more information, see the Pricing and scale tier.

image

  1. Review + create.
  2. Review your IoT hub information, then click Create. Your IoT hub might take a few minutes to create. You can monitor the progress in the Notifications pane.

 

Retrieve the IoT Hub Connection String

With the IoT Hub you just created, you will need to have a connection string to interact with it. You obtain this by going to the IoT hub navigation menu, and opening Shared access policies. Select the iothubowner policy, and then copy the Connection string---primary key of your IoT hub. For more information, see Control access to IoT Hub.  This connection string is used by the device you create to connect to your IoT Hub.

Note: You need this iothubowner connection string to configure your example application.

image

Register your device in the IoT hub using the Web Interface

  1. In your IoT hub navigation menu, open IoT devices, then click Add to register your device in the IoT hub.

image

  1. Enter a Device ID for the new device. Device IDs are case sensitive.

Important: The device ID may be visible in collected logs so avoid sensitive information while naming it.

  1. Save.
  2. After the device is created, open the device from the list in the IoT devices pane.
  3. You should then record the Connection string---primary key for later use.

image

 

Note: There are two connection strings you have recorded now. The first Connection String is for connecting to the IoT Hub, the second connection string is for connecting to the device you created. When you want to interact with the device itself, you use the device connection string (the last one discussed). However, when you want to interact with the IoT Hub, you use the connection string obtained in the previous step. For me, this was a point of confusion initially.

 

Install Azure Command Line Interface (CLI)

The Azure CLI (with iot hub extensions) allows you to manage and monitor data that is sent to/from Azure IoT Hub using the command line.  Alternatively, you can use the Microsoft Device Explorer (see next section).

To install the Azure CLI, use the information provided by Microsoft from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest.  After the Azure CLI is installed, you need to add the add the azure-cli-iot-ext extension so that you can monitor/send messages to your device. This is done by executing the following command:

 

az extension add --name azure-cli-iot-ext

 

Install Microsoft Azure Device Explorer (Windows GUI)

Microsoft Device Explorer helps you manage devices, send messages, and monitor events by connecting to the IoT Hub that you have created using a graphical user interface.  To use the GUI, Install this application. You will find the install package SetupDeviceExplorer.msi which will install everything needed.

 

Wrap-up

With the prerequisites installed, we have the tools necessary for the M18Qx to interact with Azure IoT Hub, plus, we have to tools necessary to both send and monitor messages sent between the M18Qx and Azure.  You also use the connection strings we obtained to build the software application so it interacts with your Azure IoT Hub.

 

Previous Blog                                                                                     Next Blog

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube