Azure-docs: 'device-identity' is not in the 'az iot hub' command group.

Created on 25 Jun 2019  Â·  14Comments  Â·  Source: MicrosoftDocs/azure-docs

When attempting to follow along with this quickstart I am blocked because 'device-identity' is not in the 'az iot hub' command group according to the cli. I've tried the cli on Windows, Mac and the built-in web-based cli you link to. All show the same error.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-bug iot-husvc triaged

Most helpful comment

Seems like a step was missed. The iot extension is needed for this command set to work:

"Run the following command to add the Microsoft Azure IoT Extension for Azure CLI to your Cloud Shell instance. The IOT Extension adds IoT Hub, IoT Edge, and IoT Device Provisioning Service (DPS) specific commands to Azure CLI.

az extension add --name azure-cli-iot-ext
"

All 14 comments

@sethderrick Thank you for your feedback! We will review and provide an update as appropriate.

Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

Seems like a step was missed. The iot extension is needed for this command set to work:

"Run the following command to add the Microsoft Azure IoT Extension for Azure CLI to your Cloud Shell instance. The IOT Extension adds IoT Hub, IoT Edge, and IoT Device Provisioning Service (DPS) specific commands to Azure CLI.

az extension add --name azure-cli-iot-ext
"

reassign JimacoMS3

As this step already does exist in the Prerequisites section, I'm closing this issue.

please-close

az iot hub: 'device-identity' is not in the 'az iot hub' command group. See 'az iot hub --help'.i am getting this error

@nupur0308 Have you added the Azure IoT Extension for Azure CLI (azure-cli-iot-ext) to your environment as specified in the Prerequisites?

If so, you should be able to run the following command and see similar results:

az extension list

[
  {
    "extensionType": "whl",
    "name": "azure-cli-iot-ext",
    "version": "0.7.1"
  }
]

its working now.

thanks

@JimacoMS3 I have been experiencing this problem for a while now (and avoiding Azure CLI for that reason). It seems that it's still not fixed. Here's what I see when using the Cloud Shell from portal.azure.com

rrs@Azure:~$ az extension add --name azure-cli-iot-ext
Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
Extension 'azure-cli-iot-ext' is already installed.
rrs@Azure:~$ az extension list
Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
[
  {
    "extensionType": "whl",
    "name": "azure-cli-iot-ext",
    "version": "0.7.0"
  }
]
rrs@Azure:~$ az iot hub device-identity create --device-id hopper --hub-name nccl-hub-proto-rSSH-1 --edge-enabled
Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
az iot hub: 'device-identity' is not in the 'az iot hub' command group. See 'az iot hub --help'.
rrs@Azure:~$

Here's the --debug output

rrs@Azure:~$ az extension load azure-cli-iot-ext --debug
Command arguments: ['extension', 'load', 'azure-cli-iot-ext', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f693cdf4d08>, <function OutputProducer.on_global_arguments at 0x7f693c92fb70>, <function CLIQuery.on_global_arguments at 0x7f693c957bf8>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.015 seconds.
Loaded module 'acs' in 0.007 seconds.
Loaded module 'advisor' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.006 seconds.
Loaded module 'apim' in 0.002 seconds.
Loaded module 'appconfig' in 0.002 seconds.
Loaded module 'appservice' in 0.009 seconds.
Loaded module 'backup' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.010 seconds.
Loaded module 'batchai' in 0.002 seconds.
Loaded module 'billing' in 0.001 seconds.
Loaded module 'botservice' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.003 seconds.
Loaded module 'cloud' in 0.001 seconds.
Loaded module 'cognitiveservices' in 0.001 seconds.
Loaded module 'configure' in 0.002 seconds.
Loaded module 'consumption' in 0.002 seconds.
Loaded module 'container' in 0.002 seconds.
Loaded module 'cosmosdb' in 0.006 seconds.
Loaded module 'deploymentmanager' in 0.002 seconds.
Loaded module 'dla' in 0.004 seconds.
Loaded module 'dls' in 0.003 seconds.
Loaded module 'dms' in 0.002 seconds.
Loaded module 'eventgrid' in 0.002 seconds.
Loaded module 'eventhubs' in 0.003 seconds.
Loaded module 'extension' in 0.001 seconds.
Loaded module 'feedback' in 0.001 seconds.
Loaded module 'find' in 0.001 seconds.
Loaded module 'hdinsight' in 0.002 seconds.
Loaded module 'interactive' in 0.000 seconds.
Loaded module 'iot' in 0.004 seconds.
Loaded module 'iotcentral' in 0.001 seconds.
Loaded module 'keyvault' in 0.006 seconds.
Loaded module 'kusto' in 0.002 seconds.
Loaded module 'lab' in 0.004 seconds.
Loaded module 'managedservices' in 0.002 seconds.
Loaded module 'maps' in 0.001 seconds.
Loaded module 'monitor' in 0.008 seconds.
Loaded module 'natgateway' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'netappfiles' in 0.004 seconds.
Loaded module 'network' in 0.033 seconds.
Loaded module 'policyinsights' in 0.003 seconds.
Loaded module 'privatedns' in 0.005 seconds.
Loaded module 'profile' in 0.002 seconds.
Loaded module 'rdbms' in 0.007 seconds.
Loaded module 'redis' in 0.002 seconds.
Loaded module 'relay' in 0.004 seconds.
Loaded module 'reservations' in 0.002 seconds.
Loaded module 'resource' in 0.008 seconds.
Loaded module 'role' in 0.005 seconds.
Loaded module 'search' in 0.002 seconds.
Loaded module 'security' in 0.003 seconds.
Loaded module 'servicebus' in 0.006 seconds.
Loaded module 'servicefabric' in 0.003 seconds.
Loaded module 'signalr' in 0.002 seconds.
Loaded module 'sql' in 0.009 seconds.
Loaded module 'sqlvm' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.037 seconds.
Loaded module 'vm' in 0.018 seconds.
Loaded all modules in 0.287 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: '/home/rrs/.azure/cliextensions'
Found 1 extensions: ['azure-cli-iot-ext']
Extensions directory: '/home/rrs/.azure/cliextensions'
Extension compatibility result: is_compatible=True cli_core_version=2.0.76 min_required=2.0.24 max_required=None
Event: MainLoader.OnFailedExtensionLoad []
Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 202, in _update_command_table_from_extensions
    _load_extension_command_loader(self, args, ext_mod)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 964, in _load_extension_command_loader
    return _load_command_loader(loader, args, ext, '')
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 950, in _load_command_loader
    command_table = command_loader.load_command_table(args)
  File "/home/rrs/.azure/cliextensions/azure-cli-iot-ext/azext_iot/__init__.py", line 31, in load_command_table
    load_command_table(self, args)
  File "/home/rrs/.azure/cliextensions/azure-cli-iot-ext/azext_iot/commands.py", line 19, in load_command_table
    with self.command_group('iot hub', command_type=iothub_ops) as cmd_group:
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 446, in command_group
    return self._command_group_cls(self, group_name, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 1064, in __init__
    merged_kwargs = self._merge_kwargs(kwargs, base_kwargs=command_loader.module_kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 1088, in _merge_kwargs
    return _merge_kwargs(kwargs, base, CLI_COMMAND_KWARGS)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 1039, in _merge_kwargs
    raise TypeError('unrecognized kwargs: {}'.format(unrecognized_kwargs))
TypeError: unrecognized kwargs: ['min_profile']

Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f693c6d6ea0>]
az_command_data_logger : command args: extension {} {} --debug
metadata file logging enabled - writing logs to '/home/rrs/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f693c677ea0>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f693c62fa60>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f693c62fbf8>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7f693a211bf8>]
cli.azure.cli.core.parser : az extension: 'load' is not in the 'az extension' command group. See 'az extension --help'.
az extension: 'load' is not in the 'az extension' command group. See 'az extension --help'.
az_command_data_logger : exit code: 2
telemetry.save : Save telemetry record of length 2558 in cache
telemetry.check : Negative: The /home/rrs/.azure/telemetry.txt was modified at 2019-11-23 00:58:11.687782, which in less than 600.000000 s
command ran in 0.352 seconds.
rrs@Azure:~$

@JimacoMS3 My bad (leaving the comment above in case someone else trips like I did). I completely lost track of the fact that users must maintain Azure environment (!?). My problem was due to an old extension in my Azure Cloud environment.

Hi @radoye

Glad you were able to get it figured out, and thanks for leaving the comment :)

-Jimaco

HI All,

Question about az iot hub device-identity create ....

when I executed code via PHP's exec() syntax

exec("/usr/bin/az iot hub device-identity create -n {IOT HUB NAME} -d {DEVICE ID} 2>&1")

it gives me an output like this

{
    "message": "az iot hub: 'device-identity' is not in the 'az iot hub' command group. See 'az iot hub --help'. If the command is from an extension, please make sure the corresponding extension is installed. To learn more about extensions, please visit https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview"
}

But when i execute the az iot hub device-identity create through console, it works as expected.

Can anyone inspect code where I do wrong.

Thanks

Hi @slamgundam,

So I don't really know much - read that as anything :) - about PHP. If the command works in a (local) console window on your computer, but doesn't work from inside the exec command in PHP, then the issue is that whatever environment the exec command is running in can't access the azure-iot extension.

You might try running the command using the shell_exec() PHP command. Alternatively, you can check out the Azure CLI documentation here: https://docs.microsoft.com/cli/azure/azure-cli-extensions-overview?view=azure-cli-latest#install-extension. The last two sentences of that section explain how the Azure CLI finds extensions. One thing to note is that it looks like the extensions live in your user profile and Azure CLI defaults there if the environment variable isn't set -- so that could be why exec() isn't finding them. Again, I don't know much here.

If the above doesn't help, I would suggest that you search stack overflow or post there. I'd suggest using tags like azure-cli and/or php. This thread has an extremely limited audience (me :)), and is really focused on IoT Hub documentation issues. You'll probably get a much more helpful response on stack overflow.

Hope this helps,

Jimaco

Was this page helpful?
0 / 5 - 0 ratings