azure-cli on ubuntu 18.04 does not find IoT Hub
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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
againstMicrosoft.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:
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.