How to configure Azure Device Provisioning and IoT Hub behind an Azure Gateway

69 Views Asked by At

I am trying to configure an Azure Device Provisioning service and IoT Hub behind an Azure Gateway (using websockets), but have some of issues. Idealy I want to have a single DNS/Host/IP/port for all my services. e.g. gateway.example.com. This is to make it easy for clients to open their firewall for the IoT device, because they only have to allow a single DNS name (or ip/port for older firewalls). Then the different services could run behind different paths, e.g. /api -> points to some api's or API Management in Azure /deviceprovisioning -> Device Provisioning service /iot -> IoT Hub

Now I have serveral issues doing this. I cannot get path based endpoints to work with Device Provisioning and IoT Hub, the NuGet clients for .Net simply does not support paths, only a hostname. I have then created two seperate gateway domains, dps.example.com and iot.example.com pointing to the two services. It's different DNS names, but still pointing to same IP and port, so almost as good as the ideal solution. This works fine for the Device Provisioning Service, as I can provision the device. One issue though is that the DPS hands out the original DNS/host name for the IoT Hub and I have no way of overwriting this. I can of couse call one of my API's to get the right address to use. But for the IoT Hub I get a "no such host is know iot.example.com". So it seems that once the websocket connection is established to the IoT hub, the host name is exchanged trough the MQTT or AMQP protocol and that is refused by the server. Even though I set the Gateway to overwrite the hostname, it does not apply to any data transmitted trough the websocket once the connection is established (makes sense). I looked for an option to use custom domains, but seems to have been asked 6 !!! years ago with a "comming soon" reply from microsoft (https://feedback.azure.com/d365community/idea/6a805421-f924-ec11-b6e6-000d3a4f0da0), so that is not an option. Have anyone else found a solution to this issue or have any great ideas?

0

There are 0 best solutions below