question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

azure-cli on ubuntu 18.04 does not find IoT Hub

See original GitHub issue

Describe the bug

I wanted to run the IoT Edge Tutorial https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux using the azure-cli on my own Ubuntu notebook (the tutorial uses cloud shell).

Errors:

After creating the IoT Hub, az iot hub device-identity create --hub-name {correct-hub-name} --device-id myEdgeDevice --edge-enabled fails: No IoT Hub found with name {correct-hub-name} in current subscription.

Listing the IoT hubs returns an empty list: az iot hub list --subscription {correct-subscription-name} []

Strangely, if I run the exact same command az iot hub list --subscription {correct-subscription-name} in cloud shell, it returns my IoT Hub

Environment Summary

Linux-5.3.0-46-generic-x86_64-with-debian-buster-sid
Python 3.6.5
Installer: DEB

azure-cli 2.3.1

Extensions:
azure-iot 0.9.1
azure-devops 0.15.0

Additional Context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dbartzcommented, Apr 25, 2020

Hi @digimaun, thanks for looking into this.

I followed your advice and looked into the debug logs. The reason for not finding the IoT Hub was trivial and entirely my fault: Long time ago, I configured a default resource group on this machine, a fact which I even did not remember anymore.

0reactions
digimauncommented, Apr 24, 2020

Please run the commands and append --debug in each environment you are using (cloud shell & ubuntu).

Look at the debug logs and take note of management.azure.com against Microsoft.Devices/IotHubs

You should notice a debug entry that looks like this (API versions will differ - as of this comment, cloud shell is using Azure CLI 2.2.0):

urllib3.connectionpool : https://management.azure.com:443 "GET /subscriptions/{your-correct-subscription-id}/providers/Microsoft.Devices/IotHubs?api-version=2019-11-04 HTTP/1.1" 200

And the related response content:

msrest.http_logger : Response content:
msrest.http_logger : {"value":[{"id":"/subscriptions/

Please verify the API calls between cloud shell/non-cloud shell are against the same subscription GUID in the request and validate the response content coming back. Please also note the API versions for this exercise - I am wondering if a particular API version is the cause of this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Try Device Update for Azure IoT Hub using a simulator agent
Create a Device Update account and instance configured with an IoT hub. Have an Ubuntu 18.04 device. This device can be either physical...
Read more >
Create and provision an IoT Edge device on Linux using ...
Sign in to the Azure portal and navigate to your IoT hub. · In the left pane, select Devices from the menu, then...
Read more >
Quickstart create an Azure IoT Edge device on Linux
Register an IoT Edge device · In the Azure Cloud Shell, enter the following command to create a device named myEdgeDevice in your...
Read more >
Run Azure IoT Edge on Ubuntu Virtual Machines by using ...
Deploy from Azure CLI. You can't deploy a remote Bicep file. Save a copy of the Bicep file locally as main.bicep. Ensure that ......
Read more >
Run Azure IoT Edge on Ubuntu Virtual Machines
We will deploy an Azure IoT Edge enabled Linux VM using the iotedge-vm-deploy Azure Resource Manager template. · On the newly launched window, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found