Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Azure Functions for IoT Hub devices

Azure Functions for getting IoT Hub device info and telemetry from Azure Time Series Insights environment.


To help get started there is an IoT Remote Monitoring solution that we can try. This will setup Azure IoT Hub and Time Series Insights environment with sample IoT devices and telemetry data for our Azure Function APIs.



How to run Azure Functions on localhost

  1. To run Azure Functions locally you will the Azure Functions Core Tools v2 CLI installed.

  2. Add the following environment variables to your local.settings.json file. (If your local settings are encrypted then be sure to add them using the CLI's func settings add command)

    func settings add "IOTHUB_CONNECTION_STRING" "HostName=*;SharedAccessKeyName=*;SharedAccessKey=*"
    func settings add "TSI_FQDN" ""
    func settings add "AD_APP_ID" "YOUR_ACTIVE_DIRECTORY_APP_ID"
    func settings add "AD_APP_KEY" "YOUR_ACTIVE_DIRECTORY_APP_KEY"
    func settings add "AD_TENANT_DOMAIN" ""
  3. Run Azure Functions locally (for debugging in VS Code)
    func host start --debug VSCode


These REST APIs are to help client side developers get IoT Hub device info and device telemetry from Time Series Insights.


Gets a list of devices from IoT Hub

Param Description Default
pageSize The desired no. of results per page 100


Gets the device details from IoT Hub using the device Id

Param Description Default
deviceId The device Id required


Gets telemetry of device from Time Series Insights using the device Id

Param Description Default
deviceId The device Id required
seconds The number of seconds ago from now to search 60
count No. of Results limit 1000
msFrom Sample time from in MS now - {seconds}
msTo Sample time to in MS now


  1. Fork this repo
  2. Sign in to Azure portal
  3. Create new Azure Function
    • Once your Azure Function is provisioned ensure your Function app settings is using version 2
  4. Add the following environment variables using your Azure Function app settings:
    • TSI_FQDN
    • AD_APP_ID
    • AD_APP_KEY
  5. To deploy your Function app select
    Platform Features > Deployment Options > Setup > GitHub
    and choose your forked repo.


No releases published


No packages published