0

I have only one device connecting to Iothub and telemetry data is under 1k. In such situation, Azure Stream Analytics is too expensive.

Unlike Cosmos DB , Azure Functions has bindings of it , but SQL DB.

How can I store data from Azure Iothub into Azure SQL Database using azure function?

ps. I'm using Javascript.

1 Answer 1

2

Absolutely right, Stream Analytics would be overkill in this situation. My understanding of your questions is to use a Function to listen to device messages and store them in a SQL database. The steps you need to take are as follows:

  1. Create an Azure Function with a Event Hub binding to the default endpoint of IoT Hub (link)
  2. Add the SQL connection string to the application settings of the Function (link)
  3. Write JavaScript to run SQL to the database (you might need to install dependencies as the answer states. (link)
Sign up to request clarification or add additional context in comments.

3 Comments

Stuck on #2 . I'm not using VS and C#.. I wonder that is it available to use iotHub trigger with tedious(nodejs module) in index.js and insert data into SQL databaase ?
I changed the link for #2 to the documentation on how to add the application setting through the Azure portal instead, hope that helps. I also added a link to an SA question that shows how sample code and how to install the dependencies correctly.
After hours of testing , I finally stored telemetry data into my sql database. I also read Working with JSON data which I could store JSON data in a table directly. Thank You Matthijs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.