0
votes

I am doing some POC on Azure Digital Twin. So i am using some DT samples available on GitHub by azure. But those samples require IOT Hub connection string to enter. But i am not able to find the IOT hub connection string any where in Azure Digital Twin.

for example, see this following line:

IoT Hub connection string has to be set to system environment variable IOT_HUB_CONNECTION_STRING

How can i get this connection string, i can have device connection string but i can not have iot hub connection string.

I know Azure DT has its underline IOT Hub and currently developers can not access it. I want to ask is there any way we can get that ?

2
It's for the device connection string not for IOT hub itselfSaad Zulfiqar
Do you have a link to the sample you're trying to use? Currently, there is no way to access the IoT Hub as you would normally.Matthijs van der Veer
That explains it, please see my answer.Matthijs van der Veer

2 Answers

0
votes

The Node sample you're using (as you stated in the comments) is actually an IoT Plug and Play sample. If I run the sample against a North European IoT Hub (they are PnP enabled) I get the PnP digital twin of a device:

{
  "interfaces": {
    "urn_azureiot_ModelDiscovery_DigitalTwin": {
      "name": "urn_azureiot_ModelDiscovery_DigitalTwin",
      "properties": {
        "modelInformation": {
          "reported": {
            "value": {
              "interfaces": {
                "urn_azureiot_ModelDiscovery_DigitalTwin": "urn:azureiot:ModelDiscovery:DigitalTwin:1"
              }
            }
          }
        }
      }
    }
  },
  "version": 1
}

The git comments also suggest this is a Plug and Play sample: enter image description here

0
votes

Azure Digital Twins in preview only supports an IoT Hub created through the Digital Twins API at the root of the spatial graph. This IoT Hub instance has no management API and will not appear in any management tools (such as the Azure Portal). All interaction is via the API.

The following answer indicates that this limitation will be addressed upon GA:

https://stackoverflow.com/a/59151340/12929015