How to get private IP of the IoT Hub?

António Sérgio Azevedo 7,671 Reputation points Microsoft Employee
2020-05-14T17:57:20.517+00:00

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]

Source: MSDN

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,205 questions
0 comments No comments
{count} vote

Accepted answer
  1. AshokPeddakotla-MSFT 35,091 Reputation points
    2020-05-14T17:59:42.49+00:00

    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. 

    Doc Reference: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-understand-ip-address 

    Source: MSDN

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 33,146 Reputation points MVP
    2020-06-10T15:38:34.99+00:00

    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/

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.