This repository has a copy of the Azure IoT Hub SDK Quickstart .NET Core apps folder. It has been modified so that all apps get the Hub Connection strings from enviroment variables, that can be set by the PowerShell script in dicussion here. The script can also direct you to the folder for each quickstart upon selection from a menu.

The Quickstarts

These have been previously discussed on this blog here. Inbrief, these are presented as .NET Core apps (to be compiled and run). You need to supply Hub connection strings for the apps.The Quickstarts are discussed on Microsoft Documents are, (.NET versions are linked):

The Quickstarts in this repository are a copy of those as used in the Quickstarts dicusssion on Microsoft Documents linkto the code zipfile here. Some apps (the Telemetry ones) have been modified to take the required connection strings from environment variables as does, for example the Device Streaming Echo app. An app has been added with similar functionality to the Device Streaming Echo app that upeercases the text returned from the device. Another Decice Streaming pair of apps were added where the device take three character commands from the service and sends a response back (tem for temperature, pre for pressure, etc). Other apps will be added including one that uses RPI hardware. The apps have also been modified to wait at the end for user input and with some to wait at the start.

The get-iothub script can direct you to these versions from the main menu option 6. Run Quickstart Apps:.

A Z U R E  I o T  H U B  -  R U N  Q U I C K S T A R T  A P P S  using PowerShell AND Azure CLI

Subscription :"Visual Studio Ultimate with MSDN"
Group :"DSHubGrp"
Hub :"DSHub"
Device :"DSHubDevice"

Select a Quickstart Pair

1. Telemetry-Telemetry
2. Telemetry-Control-A-DeviceC
3. device-streams-echo
4. device-streams-proxy
5. device-streams-ucase

B. Back
Please make a (numerical) selection .. Or [Enter] if previous selection highlighted.

Selecting one of the Quickstarts as above will do a CD to the named folder under PS\Quickstarts and exit there so that that Quickstart can be run. You can change directory to the device or service folder and run the app there also using dotnet run. Alternatively, there is a script run-apps.ps1 to simulatenously run the device and service in separate shells in the folder that contains both apps (One deep from Quickstarts). Note:┬╗Before doing this, set the hub connection strings environment variables from the menu option 5. Generate Environment Variables from the main menu option first. Select 1. Generate Environment Variables from that menu.See below


  • Telemetry
    • Telemetry
      • Simulated Device
        Streams randomly generated packets of temperature and humidity to the IoT Hub.
        Also includes alerts when a threshold is exceeded.
      • Read D2C
        Retrieves the data packets received by the Hub and displays the data.
    • Control a Device
      • Simulated Device 2
        As per the Simulated Device above but also monitors mesages to the Hub to change the period between packets, and adjusts accordingly.
      • Backend Application
        Upon user keypress sends a differenet interval to the hub.
        The last one is zero which the Device interprets as a command to exit the Device app, as does the Backend app.
  • Device Streaming
    • Device Streaming Echo
      • Service
        Sends a string over a websocket stream to the Hub and awaits the response, which it displays.
      • Device
        Awaits the reception of the string at the hub which it retrieves.
        Sends it back to the hub.
    • Device Streaming UCase
      • Service
        Sends a user entered string over a websocket stream to the Hub and awaits the response, which it displays.
      • Device
        Awaits the reception of the string at the hub which it retreives and then process it by uppercasing it. Sends it back to the hub.
    • Device Streaming CMD
      • Service
        Sends a user entered string over a websocket stream to the Hub and awaits the response.
      • Device
        Awaits the reception of the string at the hub and retrives it. Processes it by interpretting it as a command ...
        Truncates the string to the first 3 characters. Depening upon the command sends back an enviroment value
        or manipulates a saved state (toggle, set clr etc) which can be read back.

The Quickstart folders as per this repository on GitHub at djaus2\az-iothub-ps


  • The apps have been updated to use .NET Core 3.1
  • The apps have been modified so that the hub connection strings are read from the environment variables.

Environment Variables.

After selecting or generating the Hub and Device, you can generate all of the connection strings required by all of the apps, as enviroment variables.These can be used directly as-is if used in the script context. (That is from the same command prompt as the script, especially when you navigate to apps via the Quickstart menu option). These can also be saved as a PowerShell script set-env.ps1 and can be placed in a variety of locations. When run, this script resets the env variables to those for the hub and device that was used to generate the script. The set-env script can also be loaded from the get-iothub context.

Note that the when the script starts it now automatically reloads the environament settings and app settings that are present as set-env.ps1 and app-settings.ps1 that are in the root folder of the script. App settings are the current Subscription, Group, Hub and Device as well as some of the Az queries.


  • Running the az-iothub-ps script on a RPI
  • Some RPI apps that use hardware as part of the Quickstarts

  Next: > .NET Core on IoT
<  Prev:   .NET Core on IoT
This Category:.NET Core on IoT
  Next: > .NET Core on IoT Using the PS Script to run Quickstarts on RPi (IoT-Core) 
<  Prev:   .NET Core on IoT