Is there any way to get private IP of the IoT Hub?
[Note: As we migrate from MSDN, this question has been posted by an Azure Cloud Engineer as a frequently asked question]
You can use “nslookup” to get the IP address of the IoT Hub.
Ex: nslookup IoTHubname.azure-devices.net
Note that, once you have created an IoT hub in an Azure region, the IoT hub keeps the same IP address for the lifetime of that IoT hub. However, if Microsoft moves the IoT hub to a different scale unit to maintain quality of service, then it is assigned a new IP address.
The IP address prefixes of IoT hub are subject to change. These changes are published periodically via service tags before taking effect. It is 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 . Note that Service tags discovery API is still in preview and in some cases may not produce the full list of tags and IP addresses. Until discovery API is generally available, consider using the service tags in downloadable JSON format.
At this moment, the IoT Hub service tags are not yet available in the CLI, Powershell, or Rest API access. The JSON file download is the solution for now.
If you want to see how to automate the retrieval of service tags, here it is shown using the REST API: https://sandervandevelde.wordpress.com/2020/06/05/access-azure-api-with-a-bearer-token-for-impersonation/
5 people are following this question.