Git Product home page Git Product logo

azureapiexamples's Introduction

Azure Functions Examples

Created by Debaveye Elias

  1. Python Fetches PythonFetch.py

  2. GET GET/GET.cs

    • FunctionName("GET_NoParams")

      Normal GET without parameters
      Route can be changed however you want

    • FunctionName("GET_Params")

      Normal GET with parameters
      Route can be changed however you want

      Note: Don't forget to add your parameters to your function

    • FunctionName("GET_noParams_withDB")

      GET without parameters with database
      Route can be changed however you want

      Note: Don't forget to add your ConnectionString to local.settings.json and include it in the code. (see comments)

    • FunctionName("GET_Params_withDB")

      GET with parameters with database
      Route can be changed however you want

      Note: Don't forget to add your ConnectionString to local.settings.json and include it in the code. (see comments)
      Don't forget to add your parameters to your function

  3. POST POST/POST.cs

    • FunctionName("POST_noDB")

      Normal POSt Without database connection
      Can be used for a simple calculation F.E.

    • FunctionName("POSTWithDB")

      Normal POST with database connection
      Route can be changed however you want

      Note: Don't forget to add your ConnectionString to your local.settings.json and include it in the code. (see comments)

      Note: Don't forget to add your sql NuGet package
      Don't forget to install the System.Data.SqlClient package
      package

  4. MQTT

    3.1 MQTT Without Azure Functions MQTT/MQTTNoFunctions.cs MQTT/MQTT01.py

    • Example on adding MQTT

      Example on how you would implement MQTT in a C# project
      Covers sending and receiving messages

      Note: Don't forget to add the M2MQTT NuGet package
      Package

    • Example on adding MQTT in PYTHON

      Example on how you would implement MQTT in a Python project
      Covers sending and receiving messages

      Note: Don't forget to add the pip package
      pip install paho-mqtt

    3.2 MQTT With Azure Functions MQTT/MQTTFunctions.cs

    • FunctionName("MQTTFunctionsWithResend")

      MQTT function that will execute included code when message is received at broker to specific topic
      This function will send his own message to the same or different topic. This can be changed in code

      The data can be used for all sorts of end results (Database, ...)(see variablenames)

      Note: Don't forget to add the CaseOnline.Azure.WebJobs.Extensions.Mqtt package
      package ❗❗VERSION 1.2.0❗❗

    • FunctionName("MQTTFunctionsWithoutResend")

      MQTT function that will execute included code when message is received at broker to specific topic
      This function will not send his own message towards the broker

      The data can be used for all sorts of end results (Database, ...)(see variablenames)

      Note: Don't forget to add the CaseOnline.Azure.WebJobs.Extensions.Mqtt package
      package ❗❗VERSION 1.2.0❗❗

  5. Azure Storage

    4.1 Table Storage Storage/CloudTables.cs

    Both Functions need a TableEntity class to send data to the cloud storage

    • FunctionName("POSTWithAzureStorage")

      Azure POST function that will create an instance of ExampleRequest and put this in a Table storage.
      This can be a replacement to a SQL database.

      Note: Don't forget to add your ConnectionString for you Storage Acoount in local.settings.json
      Don't forget to write your Tablename correctly
      Don't forget to add the Microsoft.Azure.Cosmos.Table package
      package

    • FunctionName("GETWithAzureStorage")

      Azure GET function that will get all rows or certain rows with a specific value in a specific column.
      Be mindfull of parameters and change them accordingly!

      Note: Don't forget yo add your ConnectionString for your Storage Account in local.settings.json
      Don't forget to write your Tablename correctly
      Don't forget to add the Microsoft.Azure.Cosmos.Table package
      package

    4.2 Queues Queues/Queues.cs

    • FunctionName("Queues")

      Function will be triggered when data enters a queue
      Includes function to add a certain instance to the queue

      Note: Don't forget to add the ConnectionString to local.settings.json
      Don't forget to add the Azure.Storage.Queues package
      package

  6. IoTHub

    5.1 Listen to messages IoTHub/IoTHubListener.cs

    • FunctionName("IoTHubListener")

      Listens to all messages to the IoTHub

      Note: Don't forget to add you ConnectionString from YourIoTHub > Built-in endpoints > Event Hub compatible endpoint

    5.2 Twins IoTHub/IoTHubTwinEdits.cs

    • FunctionName("GetDevices")

      Will get all Twins from devices registered in the IoTHub

      Note: Requires the AdminConnectionString YourIoTHub > Shared access policies > iothubowner
      Don't forget to install the Microsoft.Azure.Devices package
      package

    • FunctionName("changeValue")

      Will change a value you specified in a twin of a device you specified via a GET trigger

      Note: Requires the AdminConnectionString YourIoTHub > Shared access policies > iothubowner
      Don't forget to install the Microsoft.Azure.Devices package
      package

    5.3 Direct methods and messaging to device IoTHub/IoTSending.cs

    • FunctionName("IoTSending")

      Will send messages OR send direct method to the device in the query params

      Note: Requires the AdminConnectionString YourIoTHub > Shared access policies > iothubowner
      Don't forget to install the Microsoft.Azure.Devices package
      package

    5.4 Device IoTHub/IoTHubPython.py

    • FunctionName("GetDevices")

      Will simulate a Device connected to the IoTHub

      • Sends data to the IotHub
      • Gets data from Device Twin (threshold)
      • Triggers event when new Twin is available

      Note: Requires the DeviceConnectionString YourIoTHub > Iot Devices > YourDevice > Primary Connection String
      Don't forget to install pip install azure-iot-device

  7. CosmosDb

    6.1 Add item to the database COSMOS/CosmosFunctions.cs

    • FunctionName("AddItemToCosmos")

      Adds new item to a specific comsos database in a specific container

      Note: Don't forget to add you ConnectionString from YourCosmosDatabase > Keys > Primary ConnectionString
      Don't forget to install the Microsoft.Azure.Cosmos package
      package

    6.2 Query items from the database COSMOS/CosmosFunctions.cs

    • FunctionName("QueryItemsCosmos")

      Queries items fron CosmosDB

      Note: Don't forget to add you ConnectionString from YourCosmosDatabase > Keys > Primary ConnectionString
      Don't forget to install the Microsoft.Azure.Cosmos package
      package

azureapiexamples's People

Contributors

gezellligheid 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.