question

95504669 avatar image
0 Votes"
95504669 asked 95504669 answered

Using Back-End Application to set values on Azure Hub Device Twins

Hi, I want to set desired properties in Azure Hub Device twins using a back-end application. How can I do it? Also wanted to know if I can set the desired properties of many devices at once, so that I wont have to do it for each and every device. Please let me know which is the simple way to do it.

Currently I'm trying to set the desired properties using the Postman App as given in this link.
azure-rest-apis-postman-2021



I made little changes and tried to get the desired properties from hub to see how it works. But it didn't work out.

Please guide me on this issue. Thank you

microsoft-authenticatorazure-sphere
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Hi Nishith – below is the same response which Microsoft product team shared with you via email.

Azure IoT device management is one way of managing multiple devices and device twins. Refer to below documentation for details on how to do this.

Automatic device management at scale with Azure IoT Hub | Microsoft Docs

For updating properties using a backend application, refer to the following document. It requires additional permissions to access the IoT Hub as defined in Control access to IoT Hub using SAS tokens | Microsoft Docs

Understand Azure IoT Hub device twins | Microsoft Docs

I hope this helps with your initial query. For further queries please comment in the below section.

1 Vote 1 ·

Thank you for your response.
Is there any website like the postman method link above that shows the complete method to do it?

The javascript functions provided in the SAS link which you mentioned, where do I have to use it?
98270-image.png



And where can I find about the life span of the tokens?
Thank you.

0 Votes 0 ·
image.png (23.1 KiB)
95504669 avatar image
1 Vote"
95504669 answered 95504669 edited

I was able to get my work done by creating sas token in postman using this link
https://blog.jongallant.com/2017/02/azure-iot-hub-device-twin-rest-apis-postman-newman/

Thank you.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BrianWilless-4902 avatar image
2 Votes"
BrianWilless-4902 answered 95504669 commented

Have you seen the example applications on the Azure Sphere Gallery GitHub Repo? There is an example there called SetIoTCentralPropsForDeviceGroup that sets a device twin property for all devices in an Azure Sphere Device Group. The example uses IoTCentral, but may give you some ideas on how to accomplish your goal. There is another example there called AzureSphereTenantDeviceTwinSync that may be what you're looking for. I have not tried that example.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your response.
I have registered the device in dps using the certificate. Is it possible to pass the cert token in REST API.

0 Votes 0 ·
95504669 avatar image
0 Votes"
95504669 answered

But I need one more help.
How can I use my device as a access point?
Thank you...

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.