Our devices does not support fully qualified URL;s and we have challenge to find the changed IPs!

DEEPAK KUMPALA 191 Reputation points
2023-08-02T11:33:45.1166667+00:00

We are connecting Azure IoT Hub URL's from Windows OS-based devices.

Example: myiothubname.azure-devices.net

And, our device script does not support fully qualified names, hence we are using IPs.

We know that backend IP of the URL can change anytime, and we want to know how to solve this issue.

  1. Do we need to check for IP changes periodically? if yes, how can we do it?
  2. Will OS automatically update DNS IPs?
  3. Do we need to manage this on windows host files?
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,157 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
0 comments No comments
{count} votes

Accepted answer
  1. AshokPeddakotla-MSFT 30,511 Reputation points
    2023-08-02T13:00:23.79+00:00

    DEEPAK KUMPALA Greetings!

    Do we need to check for IP changes periodically? if yes, how can we do it?

    Yes, The IP address of an IoT hub is subject to change without notice. To minimize disruption, recommended to use the IoT hub hostname for networking and firewall configuration whenever possible.

    However, if your device script does not support fully qualified names, you can use the IP address of the IoT hub.

    • For constrained IoT systems without domain name resolution (DNS), IoT Hub IP address ranges are published periodically via service tags before changes take effect. It’s therefore important that you develop processes to regularly retrieve and use the latest service tags. This process can be automated via the service tags discovery API or by reviewing service tags in downloadable JSON format.
    • Use the AzureIoTHub.[region name] tag to identify IP prefixes used by IoT Hub endpoints in a specific region. To account for datacenter disaster recovery or regional failover, ensure connectivity to IP prefixes of your IoT hub's geo-pair region is also enabled.
    • Setting up firewall rules in IoT Hub may block off connectivity needed to run Azure CLI and PowerShell commands against your IoT Hub. To avoid this, you can add ALLOW rules for your clients' IP address prefixes to re-enable CLI or PowerShell clients to communicate with your IoT Hub.
    • When adding ALLOW rules in your devices' firewall configuration, it’s best to provide specific ports used by applicable protocols.

    Will OS automatically update DNS IPs?

    It depends on your network configuration. If you are using a DNS server that is configured to resolve the hostname of the IoT hub, then the DNS server will automatically update the IP address when it changes. However, if you are using a static IP address in your device script, then you will need to manually update the IP address when it changes.

    Do we need to manage this on windows host files?

    You do not need to manage this on the Windows host files. Instead, you can use the service tags discovery API or the downloadable JSON format to retrieve the latest IP address ranges for the IoT hub.

    I would suggest you, please check Best practices and Limitations on IoT Hub IP addresses for more details.

    I hope this helps. Do let me know if you have any further questions.


    If the response helped, please do click Accept Answer and Yes . Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful