Search code examples
azure-iot-hubazure-iot-sdkazure-iot-hub-device-update

Authenticate Import Update REST API to upload new updates into Azure IoT Hub


I have a IoT Hub and Device Update Service configured.

Now my requirement is to upload the files from Blob container to IoT Hub Updates. This I need to do with REST API. I had the below API.

POST https://XXXXXXXXXX.api.adu.microsoft.com/deviceupdate/XXXXXXXXX/v2/updates?action=import

But, I don't understand on how to authenticate this POST request.

I see some documentation that we need to use TENANT ID and CLIENT ID for authentication. But I dont have anything in my hand right now. How to get this ?

So, Kindly provide me the best solution to use this API and Authenticate it.


Solution

  • In order to use this API you will need to authenticate as mentioned in the Security Section here: https://learn.microsoft.com/en-us/rest/api/deviceupdate/2020-09-01/updates/import-update

    azure_auth_implicit, azure_auth_code , azure_auth_application or azure_auth_password

    Read how to Register your client application with Azure AD here.

    Most Azure services (such as Azure Resource Manager providers and the classic deployment model) require your client code to authenticate with valid credentials before you can call the service's API. Authentication is coordinated between the various actors by Azure AD, and provides your client with an access token as proof of the authentication.