Git Product home page Git Product logo

azure-iot-central-samples-csharp's Introduction

page_type languages products description urlFragment
sample
csharp
dotnet
This sample shows you how to interact with Azure IoT Central APIs
update-this-to-unique-url-stub

Azure IoT Central Samples

This sample shows you how to interact with Azure IoT Central APIs in C#. If you have any questions or feature requests, please create new issue with detailed infomation.

Contents

File/folder Description
IoTCentral Auto-generate C# REST client from the swagger
IoTCentralApp A guided C# sample script that creates an IoT Central App with Arm templates and device templates
samples Each sample app that interats with single IoT Central API
.gitignore Define what to ignore at commit time.
README.md This README file.
LICENSE The license for the sample.

Prerequisites

Running the sample in IoTCentralApp folder

  1. Make sure Azure CLI has been installed on your dev machine.

  2. In console window, run below command to login:

    az login
    az account get-access-token --resource https://apps.azureiotcentral.com
  3. In console window, change directory to src folder.

  4. Type dotnet run and press enter.

  5. Follow the output in the console window to create your IoT Central App with a connected device. Basically, you will be doing the following things.

    • Login via Azure CLI.
    • Select a subscrption with arrow keys.
    • Create a new resource group or not.
    • Specify your IoT Central app name.
    • After several minutes, you should see an new IoT Central app created. Then specify a device template file. If you leave blank, you will use the device template in resource folder.
    • Enter the Component Name (if you use the default one in resource folder, please type Interface in this step)
    • Enter the Telemetry Name (if you use the default one in resource folder, please type Temperature in this step)
    • To visit your IoT Central app, you can either view the resource on Azure Portal, or just visit https://[YourIoTCentralAppName].azureiotcentral.com/

Running the sample in samples folder

  1. Follow the steps to create an Azure IoT Central application or open your existing IoT Central application.

  2. Generate an IoT Central API token.

    • Navigate to Administration then Access Tokens.
    • Select Generate Token.
    • Enter a Token name, select Next, and then Copy.

    The token value is only shown once, so it must be copied before closing the dialog. After closing the dialog, it is never shown again.

  3. Navigate to samples/listApplication folder in your terminal. This app can list the IoT Central applications you have access to.

    cd samples/listApplication
  4. Update the following placeholders in the sample app.

    • [ACCESS_TOKEN], replace with the API token you generated from last step.
    • https://[APP_NAME].azureiotcentral.com/api/preview, replace the [APP_NAME] with the app name in your IoT Central app URL.
  5. In the terminal, type and run dotnet run.

  6. Change directory into the sample app you want to run. Repeat step 4 and 5. You might also need to update other placeholders like deviceID, MyDisplayName and etc. based on the app you selected.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-iot-central-samples-csharp's People

Contributors

formulahendry avatar 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.