Just the steps to use the script. No background info._

What you need

Getting started

  • Get the az-iothub-ps repository
  • Set path to the script and run the script -In the PS folder run .\set-path
    • run get-iothub

You get a Splash Screen, press any key to go the main menu.

Setting up an Azure IoT and getting the connection strings

  1. Subscription
    • Select the subcription to use. Usually only one.
  2. Group
    • Create a new Resource Group or select an existing one from the subscription.
    • Give a unique group name
    • Set the location by enter the number of the location
  3. Hub
    • Give it a unique hub name
    • Create a new IOT Hub or select an existing one from the Group.
    • If no other hubs in the group, for a new one, select SKU F1 (Free)
    • Otherwise select S1 (Standard 1)
  4. Device
    • Give it a unique Device name
    • Create a new Device for the hub, or select an existing one
  5. Environment Variables
    • Select option 2. Generate Enviroment Variables
    • Save to file (PowerShell and/or Bash)
    • Put a copy in the script root, Quickstarts and elsewhere as required.
    • You can now reload them when you need
  6. Run Quickstart Apps
    • If running on the desktop, assuming .NET Core is ready to go .._
    • To run both the device and server on the desktop simultaneoously select option1
      And choose the Quickstart pair of apps you want to run
      • When you exit the script, just run .\run-apps in PowerShell
        • Two consoles will fire up, one for each app.
    • To run just one of the apps, choose option 2
      Then select the Quickstart and then the specific app.
      • In that folder run dotnet run

Note that the hub connection info is extracted from the environment variables.

  • If deploying to run on a device that doesn’t have .NET Core installed
    • Download the specific IoT Hub SDK (os-cpu). And extract
      • Eg win-arm or linux-arm for the RPi
    • The .NET Core will be in ps\qs-apps\dotnet whereas Quickstarts are in ps\qs-apps\quickstarts
    • In 5. Environment Variables, make sure you have saved them to Quickstarts folder
    • Copy the qs-apps folder to the target
    • In quickstarts folder on the device run set-env:
      • .\setenv for PowerShell
      • Need to run source ./set-env.sh in Bash but on the RPi …
        • There is a fix required for this wrt DOS line endings:
        • Run tr -d '\r' < set-env.sh > set-env2.sh
        • Run source ./set-envl.sh instead.
    • Navigate to a device app folder and run the app. Enter: dotnet run


 TopicSubtopic
   
 This Category Links 
Category:IoT Index:IoT
  Next: > .NET Core on IoT
<  Prev:   .NET Core on IoT