Giter Site home page Giter Site logo

azure / azure-iot-cli-extension Goto Github PK

View Code? Open in Web Editor NEW
81.0 15.0 64.0 5.81 MB

Azure IoT extension for Azure CLI

License: Other

Python 99.62% PowerShell 0.38% Shell 0.01%
azure-cli azure-iot-edge azure-iot-dps azure-iothub azure-cli-extension azure-iot-automation iot-extension iot-edge azure-iot-devops command-line azure-iot-extension azure-iot-dt iot-cli cicd azure-iot-central azure-iot azure iot azure-device-update

azure-iot-cli-extension's Introduction

Microsoft Azure IoT extension for Azure CLI

Python Build Status

The Azure IoT extension for Azure CLI aims to accelerate the development, management and automation of Azure IoT solutions. It does this via addition of rich features and functionality to the official Azure CLI.

News

  • โ— When upgrading your Azure CLI core version, for the best experience and to avoid breaking changes, we recommend updating your azure-iot extension to the latest available.

  • Azure CLI 2.24.0 requires an azure-iot extension update to 0.10.11 or later for IoT Hub commands to work properly. However we recommend at least azure-iot 0.10.14. Updating the extension can be done with az extension update --name azure-iot.

Note: A common error that arises when using an older azure-iot with Azure CLI 2.24.0+ shows as follows: AttributeError: 'IotHubResourceOperations' object has no attribute 'config'.

  • Starting with version 0.10.13 of the IoT extension, you will need an Azure CLI core version of 2.17.1 or higher. IoT extension version 0.10.11 remains on the extension index to support environments that cannot upgrade core CLI versions.

  • The legacy IoT extension Id azure-cli-iot-ext is deprecated in favor of the new modern Id azure-iot. azure-iot is a superset of azure-cli-iot-ext and any new features or fixes will apply to azure-iot only. Also the legacy and modern IoT extension should never co-exist in the same CLI environment.

    Uninstall the legacy extension with the following command: az extension remove --name azure-cli-iot-ext.

    Related - if you see an error with a stacktrace similar to:

    ...
    azure-cli-iot-ext/azext_iot/common/_azure.py, ln 90, in get_iot_hub_connection_string
        client = iot_hub_service_factory(cmd.cli_ctx)
    cliextensions/azure-cli-iot-ext/azext_iot/_factory.py, ln 29, in iot_hub_service_factory
        from azure.mgmt.iothub.iot_hub_client import IotHubClient
    ModuleNotFoundError: No module named 'azure.mgmt.iothub.iot_hub_client'
    

    The resolution is to remove the deprecated azure-cli-iot-ext and install any version of the azure-iot extension.

Commands

Please refer to the official az iot reference on Microsoft Docs for a complete list of supported commands. You can also find IoT CLI usage tips on the wiki.

Installation

  1. Install the Azure CLI
    • You must have at least v2.32.0 for the latest versions of azure-iot, which you can verify with az --version
  2. Add, Update or Remove the IoT extension with the following commands:
    • Add: az extension add --name azure-iot
    • Update: az extension update --name azure-iot
    • Remove: az extension remove --name azure-iot

Please refer to the Installation Troubleshooting Guide if you run into any issues or the Alternative Installation Methods if you'd like to install from a GitHub release or local source.

Usage

After installing the Azure IoT extension your CLI environment is augmented with the addition of hub, central, dps, dt, edge and device commands.

For usage and help content of any command or command group, pass in the -h parameter. Root command group details are shown for the following IoT services.

Click a section to expand or collapse

Digital Twins
$ az dt -h

Group
    az dt : Manage Azure Digital Twins solutions & infrastructure.

Subgroups:
    data-history    : Manage and configure data history.
    endpoint        : Manage and configure Digital Twins instance endpoints.
    job             : Manage and configure jobs for a digital twin instance.
    model           : Manage DTDL models and definitions on a Digital Twins instance.
    network         : Manage Digital Twins network configuration including private links and
                      endpoint connections.
    role-assignment : Manage RBAC role assignments for a Digital Twins instance.
    route           : Manage and configure event routes.
    twin            : Manage and configure the digital twins of a Digital Twins instance.

Commands:
    create          : Create or update a Digital Twins instance.
    delete          : Delete an existing Digital Twins instance.
    list            : List the collection of Digital Twins instances by subscription or resource
                      group.
    reset [Preview] : Reset an existing Digital Twins instance by deleting associated
                      assets. Currently only supports deleting models and twins.
    show            : Show an existing Digital Twins instance.
    wait            : Wait until an operation on an Digital Twins instance is complete.
IoT Central
$ az iot central -h

Group
    az iot central : Manage IoT Central resources.
        IoT Central is an IoT application platform that reduces the burden and cost of developing,
        managing, and maintaining enterprise-grade IoT solutions. Choosing to build with IoT Central
        gives you the opportunity to focus time, money, and energy on transforming your business
        with IoT data, rather than just maintaining and updating a complex and continually evolving
        IoT infrastructure.

        IoT Central documentation is available at https://aka.ms/iotcentral-documentation
        Additional information on CLI commands is available at https://aka.ms/azure-cli-iot-ext.

Subgroups:
    api-token             : Manage API tokens for your IoT Central application.
    app                   : Manage IoT Central applications.
    device                : Manage and configure IoT Central devices.
    device-group          : Manage and configure IoT Central device groups.
    device-template       : Manage and configure IoT Central device templates.
    diagnostics [Preview] : Perform application and device level diagnostics.
    enrollment-group      : Manage and configure IoT Central enrollment group.
    export      [Preview] : Manage and configure IoT Central data exports.
    file-upload-config    : Manage and configure IoT Central file upload.
    job                   : Manage and configure jobs for an IoT Central application.
    organization          : Manage and configure organizations for an IoT Central application.      
    role                  : Manage and configure roles for an IoT Central application.
    scheduled-job         : Manage and configure IoT Central schedule job.
    user                  : Manage and configure IoT Central users.

Commands:
    query       [Preview] : Query device telemetry or property data with IoT Central Query
                            Language.
IoT Device Provisioning
$ az iot dps -h

Group
    az iot dps : Manage entities in an Azure IoT Hub Device Provisioning Service (DPS). Augmented
    with the IoT extension.

Subgroups:
    access-policy     : Manage Azure IoT Hub Device Provisioning Service access policies.
    certificate       : Manage Azure IoT Hub Device Provisioning Service certificates.
    connection-string : Manage connection strings for an Azure IoT Hub Device Provisioning Service
                        instance.
    enrollment        : Manage individual device enrollments in an Azure IoT Hub Device Provisioning
                        Service.
    enrollment-group  : Manage enrollment groups in an Azure IoT Hub Device Provisioning Service.
    linked-hub        : Manage Azure IoT Hub Device Provisioning Service linked IoT hubs.

Commands:
    create            : Create an Azure IoT Hub device provisioning service.
    delete            : Delete an Azure IoT Hub device provisioning service.
    list              : List Azure IoT Hub device provisioning services.
    show              : Get the details of an Azure IoT Hub device provisioning service.
    update            : Update an Azure IoT Hub device provisioning service.
IoT Edge
$ az iot edge -h

Group
    az iot edge : Manage IoT solutions on the Edge.

Subgroups:
    deployment  : Manage IoT Edge deployments at scale.

Commands:
    set-modules : Set edge modules on a single device.
IoT Hub
$ az iot hub -h

Group
    az iot hub : Manage entities in an Azure IoT Hub.

Subgroups:
    certificate                         : Manage IoT Hub certificates.
    configuration                       : Manage IoT automatic device management configuration at
                                          scale.
    connection-string                   : Manage IoT Hub connection strings.
    consumer-group                      : Manage the event hub consumer groups of an IoT hub.
    device-identity                     : Manage IoT devices.
    device-twin                         : Manage IoT device twin configuration.
    devicestream                        : Manage device streams of an IoT hub.
    digital-twin                        : Manipulate and interact with the digital twin of an IoT
                                          Hub device.
    distributed-tracing       [Preview] : Manage distributed settings per-device.
    identity                            : Manage identities of an Azure IoT hub.
    job                                 : Manage IoT Hub jobs (v2).
    message-enrichment                  : Manage message enrichments for endpoints of an IoT Hub.
    module-identity                     : Manage IoT device modules.
    module-twin                         : Manage IoT device module twin configuration.
    policy                              : Manage shared access policies of an IoT hub.
    route                               : Manage routes of an IoT hub.
    routing-endpoint                    : Manage custom endpoints of an IoT hub.

Commands:
    create                              : Create an Azure IoT hub.
    delete                              : Delete an IoT hub.
    generate-sas-token                  : Generate a SAS token for a target IoT Hub, device or
                                          module.
    invoke-device-method                : Invoke a device method.
    invoke-module-method                : Invoke a module method.
    list                                : List IoT hubs.
    list-skus                           : List available pricing tiers.
    manual-failover                     : Initiate a manual failover for the IoT Hub to the geo-
                                          paired disaster recovery region.
    monitor-events                      : Monitor device telemetry & messages sent to an IoT Hub.
    monitor-feedback                    : Monitor feedback sent by devices to acknowledge cloud-to-
                                          device (C2D) messages.
    query                               : Query an IoT Hub using a powerful SQL-like language.
    show                                : Get the details of an IoT hub.
    show-connection-string [Deprecated] : Show the connection strings for an IoT hub.
    show-quota-metrics                  : Get the quota metrics for an IoT hub.
    show-stats                          : Get the statistics for an IoT hub.
    update                              : Update metadata for an IoT hub.
Device Update for IoT Hub
$ az iot du -h

Group
    az iot du : Device Update for IoT Hub is a service that enables you to deploy over-the-air
    updates (OTA) for your IoT devices.
        As organizations look to further enable productivity and operational efficiency, Internet of
        Things (IoT) solutions continue to be adopted at increasing rates. This makes it essential
        that the devices forming these solutions are built on a foundation of reliability and
        security and are easy to connect and manage at scale. Device Update for IoT Hub is an end-
        to-end platform that customers can use to publish, distribute, and manage over-the-air
        updates for everything from tiny sensors to gateway-level devices.
        To learn more about the Device Update for IoT Hub service visit
        https://docs.microsoft.com/en-us/azure/iot-hub-device-update/.

Subgroups:
    account  : Device Update account management.
    device   : Device Update device management.
    instance : Device Update instance management.
    update   : Device Update update management.

Scenario Automation

Please refer to the Scenario Automation page for examples of how to use the IoT extension in scripts.

Contributing

Please refer to the Contributing page for developer setup instructions and contribution guidelines.

Feedback

We are constantly improving and are always open to new functionality or enhancement ideas. Submit your feedback in the project issues.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-iot-cli-extension's People

Contributors

41vin avatar alexandair avatar anusapan avatar avagraw avatar c-ryan-k avatar digimaun avatar dominicbetts avatar elsie4ever avatar gtrifonov avatar hangyiwang avatar jackbk avatar jdmartinez36 avatar joaohf avatar jongio avatar lucadruda avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar montgomp avatar msftgits avatar msmoot0 avatar r-delgadillo avatar rakeshmohanmsft avatar rido-min avatar utsavized avatar valluriraj avatar vilit1 avatar williamberryiii avatar yang-hai-feng avatar yingxue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-iot-cli-extension's Issues

Add an option to generate ECDSA certs for new devices

az iot hub device-identity create offers to generate self-signed certs for devices.
however, those are RSA certs, and it would be nice to be able to generate ECDSA as well.
they work just fine and have a number of advantages, one being that they are smaller, require less memory during handshake and EC math is faster than RSA.
if not outright switching to ECDSA, at least an option would be nice.

Can't update extension (missing version number)

When trying to update the extension, the following error is thrown:

$ az extension update --name azure-cli-iot-ext
'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 386, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 379, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 356, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 452, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/operations.py", line 259, in update_extension
    cur_version = ext.get_version()
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/extension/__init__.py", line 108, in get_version
    return self.metadata.get('version')
AttributeError: 'NoneType' object has no attribute 'get'

And sure enough, the extension doesn't seem to have a version number:

$ az extension list
[
  {
    "extensionType": "whl",
    "name": "azure-cli-iot-ext",
    "version": null
  }
]

Digging further I found out, that this seems to be due to a change in wheel: Azure/azure-cli#6441

Please package a version with the old version of wheel. It seems users using 0.6.1 can't update from there anymore (will have to remove&add when the new extension version is out).

Would be nice to tell user how to provide iot hub name

Entered this:

az iot hub device-identity create -d d0

Got this:
Please provide an IoT Hub entity name or IoT Hub connection string via --login...

It would be nice if it told me the name of the parameter for iothub...and entity name is confusing. Shouldn't it just say provide iot hub name via the -n parameter?

Enhancement request - Event monitor filter devices by simple pattern

It would be nice to be able to provide a simple query pattern for the monitor-events command such that you could monitor more than 1 device at a time (that meet the pattern) without monitoring all devices. Simple query pattern could consist of wildcards or similar elements.

"no matching extensions for azure-cli-iot-ext"

when I try to install the azure-cli-iot-ext on an Ubuntu 16.04 linux, box, I get an error claiming no matching extension exists...

environment - Linux azureEdgeUbuntu1 4.15.0-1031-azure #32~16.04.1-Ubuntu SMP Wed Oct 31 19:20:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

azure cli version - azure-cli 2.0.66

when I try to run

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

I get this error...
No matching extensions for 'azure-cli-iot-ext'. Use --debug for more information.

if I run it with --debug, I get..

Command arguments: ['extension', 'add', '--name', 'azure-cli-iot-ext', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fbbe05ace18>, <function OutputProducer.on_global_arguments at 0x7fbbe00e4bf8>, <function CLIQuery.on_global_arguments at 0x7fbbdfe86c80>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', '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', 'maps', 'monitor', 'natgateway', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.005 seconds.
Loaded module 'acs' in 0.013 seconds.
Loaded module 'advisor' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.006 seconds.
Loaded module 'appservice' in 0.007 seconds.
Loaded module 'backup' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.009 seconds.
Loaded module 'batchai' in 0.003 seconds.
Loaded module 'billing' in 0.001 seconds.
Loaded module 'botservice' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.002 seconds.
Loaded module 'cloud' in 0.001 seconds.
Loaded module 'cognitiveservices' in 0.001 seconds.
Loaded module 'configure' in 0.001 seconds.
Loaded module 'consumption' in 0.002 seconds.
Loaded module 'container' in 0.002 seconds.
Loaded module 'cosmosdb' in 0.004 seconds.
Loaded module 'deploymentmanager' in 0.002 seconds.
Loaded module 'dla' in 0.004 seconds.
Loaded module 'dls' in 0.004 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 'maps' in 0.001 seconds.
Loaded module 'monitor' in 0.005 seconds.
Loaded module 'natgateway' in 0.001 seconds.
Loaded module 'network' in 0.033 seconds.
Loaded module 'policyinsights' in 0.002 seconds.
Loaded module 'privatedns' in 0.004 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.003 seconds.
Loaded module 'reservations' in 0.002 seconds.
Loaded module 'resource' in 0.007 seconds.
Loaded module 'role' in 0.004 seconds.
Loaded module 'search' in 0.002 seconds.
Loaded module 'security' in 0.003 seconds.
Loaded module 'servicebus' in 0.005 seconds.
Loaded module 'servicefabric' in 0.002 seconds.
Loaded module 'signalr' in 0.001 seconds.
Loaded module 'sql' in 0.007 seconds.
Loaded module 'sqlvm' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.032 seconds.
Loaded module 'vm' in 0.014 seconds.
Loaded all modules in 0.242 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: '/home/stevebus/.azure/cliextensions'
Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fbbdfe08c80>]
az_command_data_logger : command args: extension add --name {} --debug
metadata file logging enabled - writing logs to '/home/stevebus/.azure/commands'.
Event: CommandInvoker.OnPostCommandTableCreate [<function register_global_subscription_argument..add_subscription_parameter at 0x7fbbdfe26c80>, <function register_ids_argument..add_ids_arguments at 0x7fbbdfddc7b8>, <function register_cache_arguments..add_cache_arguments at 0x7fbbdfddc950>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fbbdda64378>]
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fbbe00e4c80>, <function CLIQuery.handle_query_parameter at 0x7fbbdfe86d08>, <function register_ids_argument..parse_ids_arguments at 0x7fbbdfddc840>, <function handler at 0x7fbbdd96b378>]
Extensions directory: '/home/stevebus/.azure/cliextensions'
urllib3.connectionpool : Starting new HTTPS connection (1): aka.ms:443
urllib3.connectionpool : https://aka.ms:443 "GET /azure-cli-extension-index-v1 HTTP/1.1" 301 0
urllib3.connectionpool : Starting new HTTPS connection (1): azurecliextensionsync.blob.core.windows.net:443
urllib3.connectionpool : https://azurecliextensionsync.blob.core.windows.net:443 "GET /index1/index.json HTTP/1.1" 200 87461
No extension found with name 'azure-cli-iot-ext'
cli.azure.cli.core.util : No matching extensions for 'azure-cli-iot-ext'. Use --debug for more information.
No matching extensions for 'azure-cli-iot-ext'. Use --debug for more information.
az_command_data_logger : exit code: 1
telemetry.save : Save telemetry record of length 2488 in cache
telemetry.check : Negative: The /home/stevebus/.azure/telemetry.txt was modified at 2019-06-12 20:12:20.801253, which in less than 600.000000 s
command ran in 1.059 seconds.

[iotedge] new function request - export deploytment.json from an existing iot edge device

As we know that there exists "az iot hub apply-configuration" command to apply deployment configuration to an edge device, may we have an "az iot hub export-configuration" that could output the existing deployment to json file?

This will help to save a lot of time for developer/operator to keep their deployment settings, and to reuse the settings.

Thanks!

IoTEdge Deployment template returns a bad request when deploying with Azure CLI (azure-cli-iot-ext)

az : ERROR: ErrorCode:GenericBadRequest;BadRequest

I'm getting a BadRequest error when trying to run 'az iot edge deployment create'. The error is the same for templates that were valid with the preview version, and for templates valid for the new version (I'm copying the templates from a deployment created in the portal).
The code is part of deployment scripts that haven't changed and were working perfectly until today.

Templates attached for validation with sample data.

AzureCLI version: 2.0.39
azure-cli-iot-ext version: 0.4.3

UPDATE: deployment works correctly when using azure-cli-iot-ext version: 0.5.0

cc: @ralarcon
DeploymentTemplates.zip

az iot hub device-identity list fails

After Azure CLI update az iot hub device-identity list command started failing:

$ az iot hub device-identity list -n <hub-name>
command authoring error: multi-character short option '-ee' is not allowed. Use a single character or convert to a long-option.

Versions installed:

$ az --version
azure-cli (2.0.34)

acr (2.0.26)
acs (2.0.34)
advisor (0.5.1)
ams (0.1.1)
appservice (0.1.33)
backup (1.1.1)
batch (3.2.3)
batchai (0.2.3)
billing (0.1.8)
cdn (0.0.14)
cloud (2.0.13)
cognitiveservices (0.1.13)
command-modules-nspkg (2.0.1)
configure (2.0.15)
consumption (0.3.1)
container (0.1.24)
core (2.0.34)
cosmosdb (0.1.21)
dla (0.1.0)
dls (0.0.21)
dms (0.0.1)
eventgrid (0.1.12)
eventhubs (0.1.3)
extension (0.0.14)
feedback (2.1.1)
find (0.2.9)
interactive (0.3.21)
iot (0.1.21)
keyvault (2.0.22)
lab (0.0.22)
maps (0.1.0)
monitor (0.1.7)
network (2.1.3)
nspkg (3.0.2)
policyinsights (0.1.0)
profile (2.0.25)
rdbms (0.2.3)
redis (0.2.13)
reservations (0.1.2)
resource (2.0.30)
role (2.0.24)
servicebus (0.1.2)
servicefabric (0.0.12)
sql (2.0.27)
storage (2.0.34)
vm (2.0.33)

Extensions:
azure-cli-iot-ext (0.4.4)

Python location '/opt/az/bin/python3'
Extensions directory '/home/dmitry/.azure/cliextensions'

Python (Linux) 3.6.1 (default, Jun  1 2018, 02:31:16)
[GCC 5.4.0 20160609]

Legal docs and information: aka.ms/AzureCliLegal

TypeError: unrecognized kwargs: ['is_preview'] when loading azure-cli-iot-ext v0.8.0

Hello,

We have an automated script run out of our CD server that performs (amongst other things) the following two commands:

az extension add --name azure-cli-iot-ext
az iot hub device-identity list --hub-name $HubName

Since the v0.8.0 release, the second command always fails. The relevant output from the debug logs are:

23:36:31   Error    |       WARNING: Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
23:36:31   Error    |       DEBUG: Traceback (most recent call last):
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\__init__.py", line 183, in _update_command_table_from_extensions
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands\__init__.py", line 614, in _load_extension_command_loader
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands\__init__.py", line 600, in _load_command_loader
23:36:31   Error    |       File "C:\Octopus\Work\20190813233551-69003-5310\azure-cli\cliextensions\azure-cli-iot-ext\azext_iot\__init__.py", line 39, in load_command_table
23:36:31   Error    |       load_command_table(self, args)
23:36:31   Error    |       File "C:\Octopus\Work\20190813233551-69003-5310\azure-cli\cliextensions\azure-cli-iot-ext\azext_iot\commands.py", line 77, in load_command_table
23:36:31   Error    |       with self.command_group('iot hub distributed-tracing', command_type=iothub_ops, is_preview=True) as cmd_group:
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\__init__.py", line 398, in command_group
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands\__init__.py", line 714, in __init__
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands\__init__.py", line 738, in _merge_kwargs
23:36:31   Error    |       File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands\__init__.py", line 689, in _merge_kwargs
23:36:31   Error    |       TypeError: unrecognized kwargs: ['is_preview']

Loading the previous version, 0.7.1, works fine.

The Azure CLI version is 2.0.43.

What could be the cause of this issue?

Unable to access blob storage account

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az iot hub device-identity export Extension Name: azure-cli-iot-ext. Version: 0.7.1.

Errors:

Unable to access blob. If you contact a support representative please include this correlation identifier: 98677835-c20b-4bf4-84b2-7824fd78f4f9, timestamp: 2019-09-12 18:15:32Z, errorcode: IH400007.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az iot hub device-identity export --bcu {} -n {} --ik {} -g {}

Expected Behavior

Environment Summary

Windows-10-10.0.18980-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.73
azure-cli-iot-ext 0.7.1

Extensions:
alias 0.5.2
azure-cli-iot-ext 0.7.1
azure-devops 0.12.0
interactive 0.4.3
storage-preview 0.2.7
vm-repair 0.1.1
webapp 0.2.19

Additional Context

I used this to generate the SAS token
$azstgsas = az storage blob generate-sas --account-name $azstgacnt.name -c $azcontainer.name -n $azblob.name --https-only --permissions rwdc --start $start --expiry $end --full-uri

and here is the acutal command for the export

az iot hub device-identity export --bcu $azstgsas -n $aziothub.name --ik true -g $rg

Do not print content of deployment manifest when creating Edge deployment

I'm using Azure CLI in Azure Pipelines to do Edge deployment. When I invoked the az iot edge deployment create command to create an Edge deployment, the output message contains the content of deployment manifest and will be persisted in Azure Pipelines task logs.
Since the deployment manifest may contain credentials, the credentials might be leaked in such situation. So please do not print the content of deployment manifest when creating Edge deployment.

The monitor-events command only monitors default events

The monitor-events command monitors the default "events" endpoint of an IoT Hub; therefore, after adding routing to send some messages to other endpoints, a developer loses all visibility into those messages.
'monitor-events' should monitor messages before they are routed. This functionality could be configurable. Ideally CLI output would include an additional field indicating the route(s) that it matched.

az iot dps certificate verify (Operation returned an invalid status code 'Not Found')

Azure CLI: azure-cli (2.0.43)
IoT Extension: azure-cli-iot-ext (0.5.1)
Command: az iot dps certificate verify --dps-name "$dpsName" --resource-group "$resourceGroup" --name VerifyCert --path ./Verification.cer --etag AAAAAAAAAAA=

I get the following error when trying to verify a certificate in DPS using a command similar to the one above. I am able to successfully run the 'az iot dps certificate create' and 'az iot dps certificate generate-verification-code' commands.

The error message is:

Operation returned an invalid status code 'Not Found'
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands_init_.py", line 369, in execute
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\six.py", line 693, in reraise
raise value
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands_init_.py", line 343, in execute
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\commands_init_.py", line 182, in call
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core_init_.py", line 436, in default_command_handler
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-iot\azure\cli\command_modules\iot\custom.py", line 277, in iot_dps_certificate_verify
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-mgmt-iothubprovisioningservices\azure\mgmt\iothubprovisioningservices\operations\dps_certificate_operations.py", line 505, in verify_certificate
azure.mgmt.iothubprovisioningservices.models.error_details.ErrorDetailsException: Operation returned an invalid status code 'Not Found'

"az iot hub list" returns "resourceGroup" property twice in output json

The command "az iot hub list" returns the property "resourceGroup" twice (with different casing):

[
  {
    ...
    "resourceGroup": "testhub",
    "resourcegroup": "testhub",
    ..
  }
]

That's valid JSON, however, it's hard to parse this with PowerShells "ConvertFrom-Json" as PowerShell is case insensitive and throws an error.

Perhaps you could evaluate if this is intended or required to be like this.

Convert all query operation results to YAML before display to CLI users.

I'd like to suggest that the JSON results from CLI calls are converted to YAML for display by default and JSON as optional. That way the output would be more human readable than sifting through tabs, braces and brackets for every operation result. It would mean adding a pyyaml dependency, but I feel like the developer experience would be significantly better.

Cloud Shell cannot load the extension

Attempt to use the extension in Azure Cloud Shell fails.

Requesting a Cloud Shell.Succeeded.
Connecting terminal...

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 iot hub monitor-events
Unable to load extension 'azure-cli-iot-ext'. Use --debug for more information.
az iot hub: 'monitor-events' is not in the 'az iot hub' command group. See 'az iot hub --help'.
rrs@Azure:~$

Tell user how to install extension in the deprecation notice

I ran an az iot command

jon@Azure:~$ az iot hub create --name jongiotfree --resource-group jongkeep --sku F1

And got this

Comprehensive IoT data-plane functionality is available
in the Azure IoT CLI Extension. For more info and install guide
go to https://github.com/Azure/azure-iot-cli-extension

Let's tell the user how to install in this message instead of making them go to github.

Add the following to the message:

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

Update .gitignore to exclude pytest default output directory

Currently the .gitignore for the extension includes the following section:

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

The draw back to having this in the .gitignore is that the default output directory for pytest is to put results in .cache/v/cache/lastfailed. We could skirt this by defining the output directory for pytest in a script runner ... or loose the ability to track .cache directory for developers doing work in Visual Studio. Anyone have any thoughts on this?

Property or Tag value should be maximum 512 bytes.

When creating an iotedge deployment, I get the following message:
'ErrorCode:ArgumentInvalid;Property or Tag value should be maximum 512 bytes.'

AFAIK, with the newest version of iotedge (1.0.5), the size limit for properties is 4Kb, and I've actually tried to create the same deployment manually in the portal and it worked correctly.

I'm using azure-cli-iot-ext (0.6.1)

Add edge deployment create option

I want to be able to save a configuration definition and then call it later.

For example, define config
edge deployment config create deploy id= test tags = env="test"

and then
edge deployment -id test -config config.json

Azure IoT Hub D2C message fails with: "Connection Refused: not authorised."

Hi

I'm getting message Connection Refused: not authorised. when sending D2C messages using the CLI extension, but using VS Code it works fine.

I'm embarrassed but I can't figure out what I'm doing wrong and I couldn't find it online. Oddly enough it is working with Send Message from VS Code.

This is my configuration. First I created my IoT Hub:

az login -u <username>
az configure --defaults location=brazilsouth
$group="happybeer"
az group create -n $group
az iot hub create -n "happybeerhub" -g "happybeer" --sku F1

Then I created my device:

az iot hub device-identity create --device-id teste-device-01 --hub-name happybeerhub

Then I send the message:

az iot device send-d2c-message -n happybeerhub -d test-device-01 `
--data 'Hello from Azure CLI'

I get the following error message: Connection Refused: not authorised. and --verbose is not giving any helpful information.

Updates

  • Tried the same command from the Portal web shell and got the same error.
  • Recreated IoT Hub in Central US location and got the same error.

Error trying to update uamqp

Trying to monitor events on an Azure IoT hub, the freshly installed CLI and IoT extension requests an update to uamqp that fails. not sure what the maps stuff is doing in there too...

(MacOS X High Sierra: Darwin <hostname> 17.5.0 Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4570.51.2~1/RELEASE_X86_64 x86_64)

Pierres-iMac:~ pierreca$ az iot hub monitor-events --hub-name iot-sdks-test
Dependency update required for IoT extension version: 0.4.5. 
Updated dependency must be compatible with uamqp 0.1.0b5. Continue? (y/n) -> y
Updating required dependency...
Collecting uamqp~=0.1.0b5
  Downloading https://files.pythonhosted.org/packages/dd/12/84c134e8676526ec73c4748ed4ed659743aad828fe9dee150941d495831b/uamqp-0.1.0rc1.tar.gz (5.6MB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 5.6MB 64.3MB/s 
Collecting certifi>=2017.4.17 (from uamqp~=0.1.0b5)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 153kB 48.2MB/s 
azure-cli-maps 0.1.0 requires azure-mgmt-maps==0.1.0, which is not installed.
Installing collected packages: certifi, uamqp
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 335, in run
    use_user_site=options.use_user_site,
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/req/__init__.py", line 49, in install_given_reqs
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 748, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 961, in move_wheel_files
    warn_script_location=warn_script_location,
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/wheel.py", line 216, in move_wheel_files
    prefix=prefix,
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/locations.py", line 165, in distutils_scheme
    i.finalize_options()
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/command/install.py", line 248, in finalize_options
    "must supply either home or prefix/exec-prefix -- not both")
distutils.errors.DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both
Failure updating uamqp 0.1.0b5. Aborting...

libffi.so.5 not found when install this extension

Hi, I tried installing this extension on VSTS build agent, but get following error. Can you tell me how to fix it? Thanks
platform: linux
release: 4.13.0-1011-azure

/usr/bin/az extension add --name azure-cli-iot-ext --debug
DEBUG: Command arguments: ['extension', 'add', '--name', 'azure-cli-iot-ext', '--debug']
DEBUG: Event: Cli.PreExecute []
DEBUG: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fa0c6fb5d08>, <function OutputProducer.on_global_arguments at 0x7fa0c6ad69d8>, <function CLIQuery.on_global_arguments at 0x7fa0c6665510>]
DEBUG: Event: CommandInvoker.OnPreCommandTableCreate [<function CLILogging.remove_logger_flags at 0x7fa0c6fb5d90>]
DEBUG: Installed command modules ['acr', 'acs', 'advisor', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'dla', 'dls', 'eventgrid', 'extension', 'feedback', 'find', 'interactive', 'iot', 'keyvault', 'lab', 'monitor', 'network', 'profile', 'rdbms', 'redis', 'reservations', 'resource', 'role', 'servicefabric', 'sql', 'storage', 'vm']
DEBUG: Loaded module 'acr' in 0.002 seconds.
DEBUG: Loaded module 'acs' in 0.002 seconds.
DEBUG: Loaded module 'advisor' in 0.001 seconds.
DEBUG: Loaded module 'appservice' in 0.005 seconds.
DEBUG: Loaded module 'backup' in 0.002 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'batch' in 0.007 seconds.
DEBUG: Loaded module 'batchai' in 0.002 seconds.
DEBUG: Loaded module 'billing' in 0.001 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'cdn' in 0.002 seconds.
DEBUG: Loaded module 'cloud' in 0.002 seconds.
DEBUG: Loaded module 'cognitiveservices' in 0.001 seconds.
DEBUG: Loaded module 'configure' in 0.001 seconds.
DEBUG: Loaded module 'consumption' in 0.002 seconds.
DEBUG: Loaded module 'container' in 0.001 seconds.
DEBUG: Loaded module 'cosmosdb' in 0.004 seconds.
DEBUG: Loaded module 'dla' in 0.004 seconds.
DEBUG: Loaded module 'dls' in 0.003 seconds.
DEBUG: Loaded module 'eventgrid' in 0.001 seconds.
DEBUG: Loaded module 'extension' in 0.001 seconds.
DEBUG: Loaded module 'feedback' in 0.001 seconds.
DEBUG: Loaded module 'find' in 0.001 seconds.
DEBUG: Loaded module 'interactive' in 0.000 seconds.
DEBUG: Loaded module 'iot' in 0.003 seconds.
DEBUG: Loaded module 'keyvault' in 0.004 seconds.
DEBUG: Loaded module 'lab' in 0.003 seconds.
DEBUG: Loaded module 'monitor' in 0.003 seconds.
DEBUG: Loaded module 'network' in 0.016 seconds.
DEBUG: Loaded module 'profile' in 0.002 seconds.
DEBUG: Loaded module 'rdbms' in 0.004 seconds.
DEBUG: Loaded module 'redis' in 0.002 seconds.
DEBUG: Loaded module 'reservations' in 0.001 seconds.
DEBUG: Loaded module 'resource' in 0.004 seconds.
DEBUG: Loaded module 'role' in 0.002 seconds.
DEBUG: Loaded module 'servicefabric' in 0.002 seconds.
DEBUG: Loaded module 'sql' in 0.004 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'storage' in 0.017 seconds.
DEBUG: Loaded module 'vm' in 0.008 seconds.
DEBUG: Loaded all modules in 0.122 seconds. (note: there's always an overhead with the first module loaded)
DEBUG: Extensions directory: '/root/.azure/cliextensions'
DEBUG: Event: CommandInvoker.OnPreCommandTableTruncate []
DEBUG: Event: CommandInvoker.OnPostCommandTableCreate [<function add_id_parameters at 0x7fa0c4894bf8>]
DEBUG: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fa0c46d3510>]
DEBUG: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fa0c6ad6a60>, <function CLIQuery.handle_query_parameter at 0x7fa0c6665598>]
DEBUG: Extensions directory: '/root/.azure/cliextensions'
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): aka.ms
DEBUG: urllib3.connectionpool : https://aka.ms:443 "GET /azure-cli-extension-index-v1 HTTP/1.1" 301 186
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): azurecliextensionsync.blob.core.windows.net
DEBUG: urllib3.connectionpool : https://azurecliextensionsync.blob.core.windows.net:443 "GET /index1/index.json HTTP/1.1" 200 31791
DEBUG: Candidates ['azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'azure_cli_iot_ext-0.4.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'azure_cli_iot_ext-0.4.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'azure_cli_iot_ext-0.4.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'azure_cli_iot_ext-0.4.0-py2.py3-none-any.whl']
DEBUG: Choosing the latest of the remaining candidates.
DEBUG: Chosen {'filename': 'azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'sha256Digest': '0a76eb9c07953d29126b758da66ad84f3af1ec1480bcd0c0f8364054770fffed', 'downloadUrl': 'https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.4.1/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', 'metadata': {'azext.minCliCoreVersion': '2.0.24', 'classifiers': ['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License'], 'extensions': {'python.details': {'contacts': [{'email': '[email protected]', 'name': 'Microsoft', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': 'https://github.com/azure/a...
DEBUG: Extension source is url? True
DEBUG: Extensions directory: '/root/.azure/cliextensions'
DEBUG: Downloading https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.4.1/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl to /tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): github.com
DEBUG: urllib3.connectionpool : https://github.com:443 "GET /Azure/azure-iot-cli-extension/releases/download/v0.4.1/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl HTTP/1.1" 302 None
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): github-production-release-asset-2e65be.s3.amazonaws.com
DEBUG: urllib3.connectionpool : https://github-production-release-asset-2e65be.s3.amazonaws.com:443 "GET /103456760/8566dc1a-18cf-11e8-81b4-9cd9f7998b80?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180312%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180312T034618Z&X-Amz-Expires=300&X-Amz-Signature=57087aa8a4bb3c558ba9cdd933f5e8855f1678f664f83e9837d634b066d4179d&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dazure_cli_iot_ext-0.4.1-py2.py3-none-any.whl&response-content-type=application%2Foctet-stream HTTP/1.1" 200 129145
DEBUG: Downloaded to /tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl
DEBUG: Validating the extension /tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl
DEBUG: Checksum of /tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl is OK
DEBUG: Extension compatibility result: is_compatible=True cli_core_version=2.0.28 min_required=2.0.24 max_required=None
DEBUG: Validation successful on /tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl
DEBUG: Executing pip with args: ['install', '--target', '/root/.azure/cliextensions/azure-cli-iot-ext', '/tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl']
DEBUG: Running: ['/opt/az/bin/python3', '-m', 'pip', 'install', '--target', '/root/.azure/cliextensions/azure-cli-iot-ext', '/tmp/tmp3rc_2tme/azure_cli_iot_ext-0.4.1-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']
DEBUG: Traceback (most recent call last):
File "/opt/az/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/az/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/opt/az/lib/python3.6/runpy.py", line 109, in _get_module_details
import(pkg_name)
File "/opt/az/lib/python3.6/site-packages/pip/init.py", line 28, in
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/opt/az/lib/python3.6/site-packages/pip/vcs/mercurial.py", line 9, in
from pip.download import path_to_url
File "/opt/az/lib/python3.6/site-packages/pip/download.py", line 36, in
from pip.utils.glibc import libc_ver
File "/opt/az/lib/python3.6/site-packages/pip/utils/glibc.py", line 4, in
import ctypes
File "/opt/az/lib/python3.6/ctypes/init.py", line 7, in
from _ctypes import Union, Structure, Array
ImportError: libffi.so.5: cannot open shared object file: No such file or directory

Not intuitive how to create a device using CLI.

I attempted to create a device using CLI.

I first tried az iot device create:
az iot device: 'create' is not in the 'az iot device' command group. See 'az iot device --help'.

Looks like there are no device CRUD operations under device. I would expect there to be.

I want to create an edge device, so next I tried

az iot edge

But again no device creation commands.

I then tried

az iot hub

And found 'device-identity', which isn't super clear that I should use that to create a device.

But alas I discovered that is the appropriate way to create a device.

I recommend moving device crud to az iot device

Updating tags for (edge) device fails

Describe the bug

Command Name
az iot hub device-twin update Extension Name: azure-cli-iot-ext. Version: 0.7.1.

Errors:

pop from empty list
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 206, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 578, in execute
    raise ex
cli/core/commands/__init__.py, ln 636, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 629, in _run_job
    six.reraise(*sys.exc_info())
...
cli/core/commands/arm.py, ln 806, in set_properties
    name, path = _get_name_path(key)
cli/core/commands/arm.py, ln 968, in _get_name_path
    return pathlist.pop(), pathlist
IndexError: pop from empty list

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az iot hub device-twin update --hub-name {} --device-id {} --set {} {} {}

Expected Behavior

Environment Summary

Linux-4.18.0-21-generic-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.69 *
azure-cli-iot-ext 0.7.1

Extensions:
azure-cli-iot-ext 0.7.1

Additional Context

Add Test Runner

Can we add a test runner script at the root of the project to facilitate development?

Azure DevOps IoT-Edge Release pipeline getting error starting 14th of August 2019

I am using fully automated Release pipeline in Azure DevOps and starting 14th of August it will gives a following error on the step "Deploy to IoT Edge devices". Nothing changed in pipeline.

Edit:
This error is reported in hosted agent Hosted VS2017.
Everything works with hosted agent Hosted Windows 2019 with VS2019.

Error: Error: DEBUG: Command arguments: ['extension', 'add', '--name', 'azure-cli-iot-ext', '--debug']
DEBUG: Event: Cli.PreExecute []
DEBUG: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x03F09078>, <function OutputProducer.on_global_arguments at 0x03F43D68>, <function CLIQuery.on_global_arguments at 0x03F6AE40>]
DEBUG: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: Installed command modules ['acr', 'acs', 'advisor', 'ams', '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', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
DEBUG: Loaded module 'acr' in 0.006 seconds.
DEBUG: Loaded module 'acs' in 0.004 seconds.
DEBUG: Loaded module 'advisor' in 0.002 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'ams' in 0.007 seconds.
DEBUG: Loaded module 'appservice' in 0.009 seconds.
DEBUG: Loaded module 'backup' in 0.004 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'batch' in 0.011 seconds.
DEBUG: Loaded module 'batchai' in 0.004 seconds.
DEBUG: Loaded module 'billing' in 0.002 seconds.
DEBUG: Loaded module 'botservice' in 0.004 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'cdn' in 0.003 seconds.
DEBUG: Loaded module 'cloud' in 0.002 seconds.
DEBUG: Loaded module 'cognitiveservices' in 0.002 seconds.
DEBUG: Loaded module 'configure' in 0.002 seconds.
DEBUG: Loaded module 'consumption' in 0.003 seconds.
DEBUG: Loaded module 'container' in 0.003 seconds.
DEBUG: Loaded module 'cosmosdb' in 0.005 seconds.
DEBUG: Loaded module 'deploymentmanager' in 0.004 seconds.
DEBUG: Loaded module 'dla' in 0.005 seconds.
DEBUG: Loaded module 'dls' in 0.004 seconds.
DEBUG: Loaded module 'dms' in 0.003 seconds.
DEBUG: Loaded module 'eventgrid' in 0.003 seconds.
DEBUG: Loaded module 'eventhubs' in 0.004 seconds.
DEBUG: Loaded module 'extension' in 0.001 seconds.
DEBUG: Loaded module 'feedback' in 0.001 seconds.
DEBUG: Loaded module 'find' in 0.001 seconds.
DEBUG: Loaded module 'hdinsight' in 0.003 seconds.
DEBUG: Loaded module 'interactive' in 0.001 seconds.
DEBUG: Loaded module 'iot' in 0.005 seconds.
DEBUG: Loaded module 'iotcentral' in 0.002 seconds.
DEBUG: Loaded module 'keyvault' in 0.007 seconds.
DEBUG: Loaded module 'kusto' in 0.003 seconds.
DEBUG: Loaded module 'lab' in 0.004 seconds.
DEBUG: Loaded module 'managedservices' in 0.002 seconds.
DEBUG: Loaded module 'maps' in 0.002 seconds.
DEBUG: Loaded module 'monitor' in 0.006 seconds.
DEBUG: Loaded module 'natgateway' in 0.002 seconds.
DEBUG: Loaded module 'network' in 0.038 seconds.
DEBUG: Loaded module 'policyinsights' in 0.003 seconds.
DEBUG: Loaded module 'privatedns' in 0.006 seconds.
DEBUG: Loaded module 'profile' in 0.002 seconds.
DEBUG: Loaded module 'rdbms' in 0.007 seconds.
DEBUG: Loaded module 'redis' in 0.003 seconds.
DEBUG: Loaded module 'relay' in 0.004 seconds.
DEBUG: Loaded module 'reservations' in 0.003 seconds.
DEBUG: Loaded module 'resource' in 0.008 seconds.
DEBUG: Loaded module 'role' in 0.007 seconds.
DEBUG: Loaded module 'search' in 0.002 seconds.
DEBUG: Loaded module 'security' in 0.003 seconds.
DEBUG: Loaded module 'servicebus' in 0.007 seconds.
DEBUG: Loaded module 'servicefabric' in 0.004 seconds.
DEBUG: Loaded module 'signalr' in 0.002 seconds.
DEBUG: Loaded module 'sql' in 0.008 seconds.
DEBUG: Loaded module 'sqlvm' in 0.003 seconds.
DEBUG: Event: CommandLoader.OnLoadCommandTable []
DEBUG: Loaded module 'storage' in 0.035 seconds.
DEBUG: Loaded module 'vm' in 0.018 seconds.
DEBUG: Loaded all modules in 0.301 seconds. (note: there's always an overhead with the first module loaded)
DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
DEBUG: Found 1 extensions: ['azure-devops']
DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
DEBUG: Extension compatibility result: is_compatible=True cli_core_version=2.0.68 min_required=2.0.49 max_required=None
DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
DEBUG: Loaded extension 'azure-devops' in 0.036 seconds.
DEBUG: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03FC8198>]
INFO: az_command_data_logger : command args: extension add --name {} --debug
DEBUG: metadata file logging enabled - writing logs to 'C:\Users\VssAdministrator.azure\commands'.
DEBUG: Event: CommandInvoker.OnPostCommandTableCreate [<function register_global_subscription_argument..add_subscription_parameter at 0x04000A50>, <function register_ids_argument..add_ids_arguments at 0x04000A98>, <function register_cache_arguments..add_cache_arguments at 0x04000C90>]
DEBUG: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x04949F18>]
DEBUG: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x03F43DB0>, <function CLIQuery.handle_query_parameter at 0x03F6AE88>, <function register_ids_argument..parse_ids_arguments at 0x04000C48>, <function handler at 0x04E05DB0>, <function DevCommandsLoader.post_parse_args at 0x052E9FA8>]
DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): aka.ms:443
DEBUG: urllib3.connectionpool : https://aka.ms:443 "GET /azure-cli-extension-index-v1 HTTP/1.1" 301 0
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): azurecliextensionsync.blob.core.windows.net:443
DEBUG: urllib3.connectionpool : https://azurecliextensionsync.blob.core.windows.net:443 "GET /index1/index.json HTTP/1.1" 200 98108
DEBUG: Candidates ['azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl']
DEBUG: Candidates ['azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl']
DEBUG: Choosing the latest of the remaining candidates.
DEBUG: Chosen {'downloadUrl': 'https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.8.0/azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl', 'filename': 'azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl', 'metadata': {'azext.minCliCoreVersion': '2.0.24', 'classifiers': ['Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License'], 'extensions': {'python.details': {'contacts': [{'email': '[email protected]', 'name': 'Microsoft', 'role': 'author'}], 'document_names': {'description': 'DESCRIPTION.rst'}, 'project_urls': {'Home': 'https://github.com/azure/azure-iot-cli-extension'}}}, 'extras': [], 'generator': 'bdist_wheel (0.30.0)', 'license': 'MIT', 'metadata_version': '2.0', 'name': 'azure-cli-iot-ext', 'run_requires': [{'requires': ['paho-mqtt (==1.3.1)']}], 'summary': 'Provides the data plane command layer for Azure IoT Hub, IoT Edge and IoT Device Provisioning Service', 'version': '0.8.0'}, 'sha256Digest': 'cef95efd63c21f6ea29e8a5aba939a5b29c67734a857bf45f13749e6b07aa898'}
DEBUG: Extension source is url? True
DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
DEBUG: Downloading https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.8.0/azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl to C:\Users\VSSADM~1\AppData\Local\Temp\tmpqph9m57s\azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): github.com:443
DEBUG: urllib3.connectionpool : https://github.com:443 "GET /Azure/azure-iot-cli-extension/releases/download/v0.8.0/azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl HTTP/1.1" 302 None
DEBUG: urllib3.connectionpool : Starting new HTTPS connection (1): github-production-release-asset-2e65be.s3.amazonaws.com:443
DEBUG: urllib3.connectionpool : https://github-production-release-asset-2e65be.s3.amazonaws.com:443 "GET /103456760/a9d68400-be06-11e9-9d98-1bf376d391c6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190814%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190814T045050Z&X-Amz-Expires=300&X-Amz-Signature=92b1025722472f8169ad1884ca5e0945aa041577c290b9c30ad56b5295c879e2&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment;%20filename%3Dazure_cli_iot_ext-0.8.0-py2.py3-none-any.whl&response-content-type=application%2Foctet-stream HTTP/1.1" 200 163313
DEBUG: Downloaded to C:\Users\VSSADM~1\AppData\Local\Temp\tmpqph9m57s\azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl
DEBUG: Validating the extension C:\Users\VSSADM~1\AppData\Local\Temp\tmpqph9m57s\azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl
DEBUG: Invalid checksum for C:\Users\VSSADM~1\AppData\Local\Temp\tmpqph9m57s\azure_cli_iot_ext-0.8.0-py2.py3-none-any.whl. Expected 'cef95efd63c21f6ea29e8a5aba939a5b29c67734a857bf45f13749e6b07aa898', computed 'b56db2a2513b2aa20077a7b49ebe5dbf1c22a195d38305162282731f57fb9dd3'.
ERROR: cli.azure.cli.core.util : The checksum of the extension does not match the expected value. Use --debug for more information.
ERROR: The checksum of the extension does not match the expected value. Use --debug for more information.
INFO: az_command_data_logger : exit code: 1
INFO: telemetry.save : Save telemetry record of length 2444 in cache
WARNING: telemetry.check : Negative: The C:\Users\VssAdministrator.azure\telemetry.txt was modified at 2019-08-14 04:50:37.650660, which in less than 600.000000 s
INFO: command ran in 2.847 seconds.

Fails with azure-cli 2.0.33 docker image

This fails to install with the azure-cli 2.0.33 (currently latest) docker image. Running with the --debug flag says something about cffi being incompatible.

F:\repos\node\e2etests>docker run -it microsoft/azure-cli:2.0.33
bash-4.4# az extension add --name azure-cli-iot-ext
An error occurred. Pip failed with status code 1. Use --debug for more information.

The workaround is to use microsoft/azure-cli:2.0.24

It failed to invoke device method

Execute command: az iot hub invoke-device-method --device-id "iotdeviceautotest01" --hub-name "iothubautotest01" --method-name "reset"

It throws below error message:
{'Message': '{"errorCode":404103,"trackingId":"dde6cb7b025443d0a26e370e517d43db-G:11-TimeStamp:11/07/2018 09:22:57","message":"Timed out waiting for device to connect.","info":{"timeout":"00:01:00"},"timestampUtc":"2018-11-07T09:22:57.6054134Z"}', 'ExceptionMessage': ''}

Version:
azure-cli (2.0.47)
azure-cli-iot-ext (0.6.0)

Getting errors writing messages between Cloud and Device and vice versa

Below are the errors i am getting while writing messages between Cloud and Device and vice versa:

  1. AMQP Transport: Could not connect
  2. NotConnectedError: connect ECONNREFUSED xxx.xxx.xx.xx:8883
  3. [WinError 10061] No connection could be made because the target machine actively refused it

Please advise.

az iot extension failing to deploy to a single device

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az iot edge deployment create Extension Name: azure-cli-iot-ext. Version: 0.8.0.

Errors:

{'Message': "ErrorCode:InvalidConfigurationTargetCondition;Invalid targetCondition. It must be a filter condition based on 'deviceId', 'tags', or 'properties.reported'. It contains: edgeDeviceVM", 'ExceptionMessage': 'Tracking ID:6b8279e793d748528ba4b0a2fe486e21-G:3-TimeStamp:08/15/2019 21:59:21'}

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

I'm trying to create a deployment to a single device using the following syntax:

  • az iot edge deployment create --config-id {} --hub-name {} --content {} --target-condition deviceId='edgeDeviceVM' --priority {}

Expected Behavior

Deployment should work. It was working a few days ago.
Target condition is valid.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.70 *
azure-cli-iot-ext 0.8.0

Extensions:
azure-cli-iot-ext 0.8.0

Additional Context

Not able to monitor by IoT hub with az iot hub monitor-events

I am not able to monitor my IoT hub with the Azure CLI command...
az iot hub monitor-events -n "IoT hub name" --login "Connect String"

When I try to do the same I get the following error...
Starting event monitor, use ctrl-c to stop...
Failed to open Message Receiver. Please confirm credentials and target URI.
The command failed with an unexpected error. Here is the traceback:

Failed to open Message Receiver. Please confirm credentials and target URI.
Traceback (most recent call last):
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 575, in execute
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 633, in _run_jobs_serially
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 626, in run_job
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\six\six.py", line 693, in reraise
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init
.py", line 603, in run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init
.py", line 305, in call
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core_init_.py", line 470, in default_command_handler
File "C:\Users\e452034.azure\cliextensions\azure-cli-iot-ext\azext_iot\operations\hub.py", line 1332, in iot_hub_monitor_events
devices=device_ids)
File "C:\Users\e452034.azure\cliextensions\azure-cli-iot-ext\azext_iot\operations\events3_events.py", line 66, in executor
raise RuntimeError(error)
RuntimeError: Failed to open Message Receiver. Please confirm credentials and target URI.`

Note: I have also tried to monitor my IoT hub via iothub-explorer and Service bus explorer. But I am also not able to monitor with them as well.
I am able to do other things though hence there seems to be no issue with the connection string I am using.

Creates invalid device SAS token

I run the following command to create a device SAS token:

az iot hub generate-sas-token --policy-name device --device-id MyTestDevice --hub-name MyHubName

If I try to use the generated token in the following Node.js code, I get a Connection refused: Not authorised error:

var Protocol = require('azure-iot-device-mqtt').Mqtt;
var Client = require('azure-iot-device').Client;
var test_token = 'generated token here';
var client = Client.fromSharedAccessSignature(test_token, Protocol);
...
client.open(connectCallback);

Error with SAS URI for az iot hub device-identity export

We are facing an issue with az iot hub device-identity export --bcu --hub-name [--ik {false, true}] [--resource-group], particularly with --bcu

When we execute the above command with SAS URI w/ all resources and all permissions, we get "Unable to access blob"

When we execute the above command with --bcu as the first argument it seems to cause all other flags to be missed. This all suggest an issue with the URI causing some issues parsing the arguments. Can someone please test this and confirm if its working? I can send snapshots of our commands.

Failed attempt to register my device

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az iot hub device-identity create Extension Name: azure-cli-iot-ext. Version: 0.8.0.

Errors:

quote_from_bytes() expected bytes
Traceback (most recent call last):
site-packages/msrest/pipeline/requests.py, ln 65, in send
    self._creds.signed_session(session)
TypeError: signed_session() takes 1 positional argument but 2 were given

...

lib/python3.6/urllib/parse.py, ln 814, in quote_from_bytes
    raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az iot hub device-identity create --hub-name {} --device-id {} --output {}

Expected Behavior

Environment Summary

Linux-4.15.0-1055-azure-x86_64-with-debian-stretch-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.72
azure-cli-iot-ext 0.8.0

Extensions:
azure-cli-iot-ext 0.8.0

Additional Context

Error trying to add route

I'm trying to add a route to my IoT Hub.

az iot hub update --name myiothubname --add properties.routing.routes '{"condition":"true","endpointNames":["events"],"isEnabled":true,"name":"defaulteventrount","source":"DeviceMessages"}'

The json I'm sending in the --add command was extracted from when I added the route via the portal.
I'm just creating an explicit route to the "events" endpoint. Later I want to add a route to a custom endpoint.

This is the error I'm getting:
Unable to build a model: Cannot deserialize as [str] an object of type <class 'str'>, DeserializationError: Cannot deserialize as [str] an object of type <class 'str'>

Random IotHubNotFound error when executing commands

Hi, I'm getting following IotHubNotFound error when executing azure cli iot related commands: ERROR: {'Message': 'ErrorCode:IotHubNotFound;Unauthorized', 'ExceptionMessage': 'Tracking ID:34b7ab68f5ca4cd1a0619419b705efe6-G:6-TimeStamp:06/19/2019 11:08:45'}
I'm using Azure Pipelines Azure CLI task to run a series of Azure CLI commands. This error happened randomly and all previous operations against same iot hub succeeded. Any one can help take a look on the error?

Pip failed

I have installed the latest azure cli (2.0.38)
and ran az extension add --name azure-cli-iot-ext --debug

and got:

Command '['C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe', '-m', 'pip', 'install', '--target', 'C:\Users\leode\.azure\cliextensions\azure-cli-iot-ext', 'C:\Users\myuser\AppData\Local\Temp\tmpkds3dj8q\azure_cli_iot_ext-0.4.5-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 2.
Pip failed

az --version tells me this:

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\myuser.azure\cliextensions'
Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]

Would you prefer more (debug) info? Or is this sufficient? Did I forgot to update something?

monitor-events terminates with no error message

When I invoke monitor-events on my iot hub, it starts event monitor, but terminates by itself in about 15 seconds with no error message:

$ az iot hub monitor-events -n myhub
Starting event monitor, use ctrl-c to stop...
$

It doesn't seem to receive any messages from the device either.

set-modules fails on cloudshell with a jsonschema distribution not found

Describe the bug

Tryied to update the module configuration of the edge device from the cloudshell prompt and it failed. Maybe some recent update on the dependency tree?

Command Name
az iot edge set-modules Extension Name: azure-cli-iot-ext. Version: 0.8.1.

Errors:

The 'jsonschema' distribution was not found and is required by the application
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 206, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 603, in execute
    raise ex
cli/core/commands/__init__.py, ln 661, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
...
python3.6/site-packages/pkg_resources/__init__.py, ln 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jsonschema' distribution was not found and is required by the application

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az iot edge set-modules --hub-name {...} --device-id {...} --content deployment.json

Expected Behavior

Updated module configuration.

Environment Summary

Linux-4.15.0-1057-azure-x86_64-with-debian-stretch-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.72 *
azure-cli-iot-ext 0.8.1

Extensions:
azure-cli-iot-ext 0.8.1

Additional Context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.