GithubHelp home page GithubHelp logo

isabella232 / geographically-provisioning-iot-devices-on-azure Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/geographically-provisioning-iot-devices-on-azure

0.0 0.0 0.0 19 KB

This repository details how to provision your IoT devices based on their location using Azure.

License: MIT License

C# 100.00%

geographically-provisioning-iot-devices-on-azure's Introduction

Geographically Provisioning IoT Devices on Azure

The goal of this repository is to explain how you can implement IoT device geo-provisioning with Azure IoT Hub, Device Provisioning Service (DPS), Functions and Maps. Using these Azure services, you will learn how to control an IoT device’s provisioning based on their location.

The corresponding Tech Community blog that fully explains this architecture can be found here.

Getting Started

Prerequisites

  1. Create an Azure IoT Hub
  2. Create an Azure IoT Hub Device Provisioning Service (DPS)
    • Ensure the IoT Hub from step 1 has been linked to this DPS
  3. Create an Azure Function App
    • Ensure the Runtime Stack and Version settings have been set to .NET and 6
  4. Create an Azure Maps account
  5. Install the .NET 6.0 SDK on your local machine

Demo

To run the demo, follow these steps:

  1. Obtain your Azure Maps account's Primary Key
    • You can find the value of this key in the Azure Portal under the Authentication blade of your Azure Maps account or by using the Azure CLI script below:
      az maps account keys list -n "mapsAccountName" -g "resourceGroupName" -o tsv --query primaryKey
  2. Update the subscriptionKey variable's value in the run.csx file, under the Azure Function Code folder, with the Primary Key value from step 1.
  3. From the Azure portal, create an HTTP Trigger function in your Azure Function App.
  4. Replace the HTTP Trigger function's default code with the code in the run.csx file.
  5. Create an Individual Enrollment with a Custom Allocation Policy that uses your Azure Function App and the HTTP Trigger function from step 4.
  6. Run the below commands locally, from within the root folder of this project:
    cd GeoProvisioningSample
    
    dotnet build
    
    dotnet run -- --DpsIdScope "replaceMeWithDPSScopeID" --DeviceId "replaceMeWithEnrollmentRegistrationId" --DeviceSymmetricKey "replaceMeWithEnrollmentPrimaryKey" --IPAddress "replaceMeWithEitherAPublicIPv4ORIPv6Address"
    • For now, this demo is configured to only allow provisioning devices with a public IPv4 or IPv6 address from the United States (US).

Resources

geographically-provisioning-iot-devices-on-azure's People

Contributors

microsoft-github-operations[bot] avatar microsoftopensource avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.