Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
588 stars 737 forks source link

Register and Connect over application gateway #2644

Closed aleksandarkrstic closed 2 months ago

aleksandarkrstic commented 2 months ago

Hello,

I have application gateway that is in this format: ip-address/dps that routes the traffic global.azure-devices-provisioning.net and ip-address/iot that routes the traffic to myiothub.azure-devices.net

My question is: What do I need to do in Azure IoT C SDK in Prov_Device_Create (or anything else) to be able to register device to my iothub not hitting global.azure-devices-provisioning.net but hitting my application gateway instead that will route the traffic to global.azure-devices-provisioning.net?

Also, what do I need to do after successful registration to connect device to my iot hub also not hitting iot hub directly but hitting my application gateway instead that will route the traffic to iot hub?

Can you provide code samples please if such thing is possible?

For example, imagine that 203.0.113.10/dps application gateway routes the traffic to global.azure-devices-provisioning.net. Prov_Device_Create("203.0.113.10/dps",iot_hub_scope_id, Prov_Device_MQTT_WS_Protocol)won't work and I am getting PROV_DEVICE_RESULT_TRANSPORT error, how to fix that?

Much appreciated. Thanks in advance.