Share via


az iot hub

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage Azure IoT hubs.

Commands

Name Description Type Status
az iot hub certificate

Manage IoT Hub certificates.

Core and Extension GA
az iot hub certificate create

Create/upload an Azure IoT Hub certificate.

Core GA
az iot hub certificate delete

Deletes an Azure IoT Hub certificate.

Core GA
az iot hub certificate generate-verification-code

Generates a verification code for an Azure IoT Hub certificate.

Core GA
az iot hub certificate list

Lists all certificates contained within an Azure IoT Hub.

Core GA
az iot hub certificate root-authority

Manage the certificate root-authority for an IoT Hub instance.

Extension Deprecated
az iot hub certificate root-authority set

Set the certificate root-authority for an IoT Hub instance to a specific version.

Extension Deprecated
az iot hub certificate root-authority show

Show the current certificate root-authority for an IoT Hub instance.

Extension Deprecated
az iot hub certificate show

Shows information about a particular Azure IoT Hub certificate.

Core GA
az iot hub certificate update

Update an Azure IoT Hub certificate.

Core GA
az iot hub certificate verify

Verifies an Azure IoT Hub certificate.

Core GA
az iot hub configuration

Manage IoT automatic device management configuration at scale.

Extension GA
az iot hub configuration create

Create an IoT automatic device management configuration in a target IoT Hub.

Extension GA
az iot hub configuration delete

Delete an IoT device configuration.

Extension GA
az iot hub configuration list

List IoT automatic device management configurations in an IoT Hub.

Extension GA
az iot hub configuration show

Get the details of an IoT automatic device management configuration.

Extension GA
az iot hub configuration show-metric

Evaluate a target user or system metric defined in an IoT device configuration.

Extension GA
az iot hub configuration update

Update specified properties of an IoT automatic device management configuration.

Extension GA
az iot hub connection-string

Manage IoT Hub connection strings.

Extension GA
az iot hub connection-string show

Show the connection strings for the specified IoT Hubs using the given policy name and key.

Extension GA
az iot hub consumer-group

Manage the event hub consumer groups of an IoT hub.

Core GA
az iot hub consumer-group create

Create an event hub consumer group.

Core GA
az iot hub consumer-group delete

Delete an event hub consumer group.

Core GA
az iot hub consumer-group list

List event hub consumer groups.

Core GA
az iot hub consumer-group show

Get the details for an event hub consumer group.

Core GA
az iot hub create

Create an Azure IoT hub.

Core GA
az iot hub delete

Delete an IoT hub.

Core GA
az iot hub device-identity

Manage IoT devices.

Extension GA
az iot hub device-identity children

Manage children device relationships for IoT edge devices.

Extension GA
az iot hub device-identity children add

Add devices as children to a target edge device.

Extension GA
az iot hub device-identity children list

Outputs the collection of assigned child devices.

Extension GA
az iot hub device-identity children remove

Remove child devices from a target edge device.

Extension GA
az iot hub device-identity connection-string

Manage IoT device's connection string.

Extension GA
az iot hub device-identity connection-string show

Show a given IoT Hub device connection string.

Extension GA
az iot hub device-identity create

Create a device in an IoT Hub.

Extension GA
az iot hub device-identity delete

Delete an IoT Hub device.

Extension GA
az iot hub device-identity export

Export all device identities from an IoT Hub to an Azure Storage blob container.

Extension GA
az iot hub device-identity import

Import device identities to an IoT Hub from a storage container blob.

Extension GA
az iot hub device-identity list

List devices in an IoT Hub.

Extension GA
az iot hub device-identity parent

Manage parent device relationships for IoT devices.

Extension GA
az iot hub device-identity parent set

Set the parent device of a target device.

Extension GA
az iot hub device-identity parent show

Get the parent device of a target device.

Extension GA
az iot hub device-identity renew-key

Renew target keys of IoT Hub devices with sas authentication.

Extension GA
az iot hub device-identity show

Get the details of an IoT Hub device.

Extension GA
az iot hub device-identity update

Update an IoT Hub device.

Extension GA
az iot hub device-twin

Manage IoT device twin configuration.

Extension GA
az iot hub device-twin list

List device twins in an IoT Hub.

Extension GA
az iot hub device-twin replace

Replace device twin definition with target json.

Extension GA
az iot hub device-twin show

Get a device twin definition.

Extension GA
az iot hub device-twin update

Update device twin desired properties and tags.

Extension GA
az iot hub devicestream

Manage device streams of an IoT hub.

Core Preview
az iot hub devicestream show

Get IoT Hub's device streams endpoints.

Core Preview
az iot hub digital-twin

Manipulate and interact with the digital twin of an IoT Hub device.

Extension GA
az iot hub digital-twin invoke-command

Invoke a root or component level command of a digital twin device.

Extension GA
az iot hub digital-twin show

Show the digital twin of an IoT Hub device.

Extension GA
az iot hub digital-twin update

Update the read-write properties of a digital twin device via JSON patch specification.

Extension GA
az iot hub distributed-tracing

Manage distributed settings per-device.

Extension Preview
az iot hub distributed-tracing show

Get the distributed tracing settings for a device.

Extension Preview
az iot hub distributed-tracing update

Update the distributed tracing options for a device.

Extension Preview
az iot hub generate-sas-token

Generate a SAS token for a target IoT Hub, device or module.

Extension GA
az iot hub identity

Manage identities of an Azure IoT hub.

Core GA
az iot hub identity assign

Assign managed identities to an IoT Hub.

Core GA
az iot hub identity remove

Remove managed identities from an IoT Hub.

Core GA
az iot hub identity show

Show the identity properties of an IoT Hub.

Core GA
az iot hub invoke-device-method

Invoke a device method.

Extension GA
az iot hub invoke-module-method

Invoke a module method.

Extension GA
az iot hub job

Manage IoT Hub jobs (v2).

Extension GA
az iot hub job cancel

Cancel an IoT Hub job.

Extension GA
az iot hub job create

Create and schedule an IoT Hub job for execution.

Extension GA
az iot hub job list

List the historical jobs of an IoT Hub.

Extension GA
az iot hub job show

Show details of an existing IoT Hub job.

Extension GA
az iot hub list

List IoT hubs.

Core GA
az iot hub list-skus

List available pricing tiers.

Core GA
az iot hub manual-failover

Initiate a manual failover for the IoT Hub to the geo-paired disaster recovery region.

Core GA
az iot hub message-endpoint

Manage custom endpoints of an IoT hub.

Extension Preview
az iot hub message-endpoint create

Add an endpoint to an IoT Hub.

Extension Preview
az iot hub message-endpoint create cosmosdb-container

Add a Cosmos DB Container endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint create eventhub

Add an Event Hub endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint create servicebus-queue

Add a Service Bus Queue endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint create servicebus-topic

Add a Service Bus Topic endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint create storage-container

Add a Storage Container endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint delete

Delete all or a specific endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint list

Get information on all the endpoints for an IoT Hub.

Extension Preview
az iot hub message-endpoint show

Get information on mentioned endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update

Update the properties of an existing endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update cosmosdb-container

Update the properties of an existing Cosmos DB Container endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update eventhub

Update the properties of an existing Event Hub endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update servicebus-queue

Update the properties of an existing Service Bus Queue endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update servicebus-topic

Update the properties of an existing Service Bus Topic endpoint for an IoT Hub.

Extension Preview
az iot hub message-endpoint update storage-container

Update the properties of an existing Storage Container endpoint for an IoT Hub.

Extension Preview
az iot hub message-enrichment

Manage message enrichments for endpoints of an IoT Hub.

Core GA
az iot hub message-enrichment create

Create a message enrichment for chosen endpoints in your IoT Hub.

Core GA
az iot hub message-enrichment delete

Delete a message enrichment in your IoT hub (by key).

Core GA
az iot hub message-enrichment list

Get information on all message enrichments for your IoT Hub.

Core GA
az iot hub message-enrichment update

Update a message enrichment in your IoT hub (by key).

Core GA
az iot hub message-route

Manage routes of an IoT hub.

Extension Preview
az iot hub message-route create

Add a route for an IoT Hub.

Extension Preview
az iot hub message-route delete

Delete all routes or a mentioned route in an IoT Hub.

Extension Preview
az iot hub message-route fallback

Manage the fallback route of an IoT hub.

Extension Preview
az iot hub message-route fallback set

Enable or disable the fallback route in an IoT Hub.

Extension Preview
az iot hub message-route fallback show

Show the fallback route of an IoT Hub.

Extension Preview
az iot hub message-route list

Get all the routes in an IoT Hub.

Extension Preview
az iot hub message-route show

Get information about the route in an IoT Hub.

Extension Preview
az iot hub message-route test

Test all routes or a mentioned route in an IoT Hub.

Extension Preview
az iot hub message-route update

Update a route for an IoT Hub.

Extension Preview
az iot hub module-identity

Manage IoT device modules.

Extension GA
az iot hub module-identity connection-string

Manage IoT device module's connection string.

Extension GA
az iot hub module-identity connection-string show

Show a target IoT device module connection string.

Extension GA
az iot hub module-identity create

Create a module on a target IoT device in an IoT Hub.

Extension GA
az iot hub module-identity delete

Delete a device in an IoT Hub.

Extension GA
az iot hub module-identity list

List modules located on an IoT device in an IoT Hub.

Extension GA
az iot hub module-identity renew-key

Renew target keys of IoT Hub device modules with sas authentication.

Extension GA
az iot hub module-identity show

Get the details of an IoT device module in an IoT Hub.

Extension GA
az iot hub module-identity update

Update an IoT Hub device module.

Extension GA
az iot hub module-twin

Manage IoT device module twin configuration.

Extension GA
az iot hub module-twin replace

Replace a module twin definition with target json.

Extension GA
az iot hub module-twin show

Show a module twin definition.

Extension GA
az iot hub module-twin update

Update module twin desired properties and tags.

Extension GA
az iot hub monitor-events

Monitor device telemetry & messages sent to an IoT Hub.

Extension GA
az iot hub monitor-feedback

Monitor feedback sent by devices to acknowledge cloud-to-device (C2D) messages.

Extension GA
az iot hub policy

Manage shared access policies of an IoT hub.

Core GA
az iot hub policy create

Create a new shared access policy in an IoT hub.

Core GA
az iot hub policy delete

Delete a shared access policy from an IoT hub.

Core GA
az iot hub policy list

List shared access policies of an IoT hub.

Core GA
az iot hub policy renew-key

Regenerate keys of a shared access policy of an IoT hub.

Core GA
az iot hub policy show

Get the details of a shared access policy of an IoT hub.

Core GA
az iot hub query

Query an IoT Hub using a powerful SQL-like language.

Extension GA
az iot hub route

Manage routes of an IoT hub.

Core Deprecated
az iot hub route create

Create a route in IoT Hub.

Core Deprecated
az iot hub route delete

Delete all or mentioned route for your IoT Hub.

Core Deprecated
az iot hub route list

Get all the routes in IoT Hub.

Core Deprecated
az iot hub route show

Get information about the route in IoT Hub.

Core Deprecated
az iot hub route test

Test all routes or mentioned route in IoT Hub.

Core Deprecated
az iot hub route update

Update a route in IoT Hub.

Core Deprecated
az iot hub routing-endpoint

Manage custom endpoints of an IoT hub.

Core Deprecated
az iot hub routing-endpoint create

Add an endpoint to your IoT Hub.

Core Deprecated
az iot hub routing-endpoint delete

Delete all or mentioned endpoint for your IoT Hub.

Core Deprecated
az iot hub routing-endpoint list

Get information on all the endpoints for your IoT Hub.

Core Deprecated
az iot hub routing-endpoint show

Get information on mentioned endpoint for your IoT Hub.

Core Deprecated
az iot hub show

Get the details of an IoT hub.

Core GA
az iot hub show-connection-string

Show the connection strings for an IoT hub.

Core Deprecated
az iot hub show-quota-metrics

Get the quota metrics for an IoT hub.

Core GA
az iot hub show-stats

Get the statistics for an IoT hub.

Core GA
az iot hub state

Manage the state of an IoT Hub.

Extension Experimental
az iot hub state export

Export the state of an IoT Hub to a file.

Extension Experimental
az iot hub state import

Import a Hub state from a file to an IoT Hub.

Extension Experimental
az iot hub state migrate

Migrate the state of one hub to another hub without saving to a file.

Extension Experimental
az iot hub update

Update metadata for an IoT hub.

Core GA
az iot hub wait

Wait until an operation on an IoT Hub instance is complete.

Core GA

az iot hub create

Create an Azure IoT hub.

For an introduction to Azure IoT Hub, see https://docs.microsoft.com/azure/iot-hub/.

az iot hub create --name
                  --resource-group
                  [--c2d-max-delivery-count]
                  [--c2d-ttl]
                  [--dds {false, true}]
                  [--disable-local-auth {false, true}]
                  [--disable-module-sas {false, true}]
                  [--edr {false, true}]
                  [--fc]
                  [--fcs]
                  [--fd]
                  [--feedback-lock-duration]
                  [--feedback-ttl]
                  [--fileupload-notification-lock-duration]
                  [--fileupload-notification-max-delivery-count]
                  [--fileupload-notification-ttl]
                  [--fileupload-notifications {false, true}]
                  [--fileupload-sas-ttl]
                  [--fileupload-storage-auth-type {identityBased, keyBased}]
                  [--fileupload-storage-identity]
                  [--location]
                  [--mi-system-assigned {false, true}]
                  [--mi-user-assigned]
                  [--min-tls-version]
                  [--no-wait]
                  [--partition-count]
                  [--rd]
                  [--role]
                  [--scopes]
                  [--sku {B1, B2, B3, F1, S1, S2, S3}]
                  [--tags]
                  [--unit]

Examples

Create an IoT Hub with the free pricing tier F1, in the region of the resource group.

az iot hub create --resource-group MyResourceGroup --name MyIotHub --sku F1 --partition-count 2

Create an IoT Hub with the standard pricing tier S1 and 4 partitions, in the 'westus' region, with tags.

az iot hub create --resource-group MyResourceGroup --name MyIotHub --location westus --tags a=b c=d

Create an IoT Hub with a system-assigned managed identity, and assign a role and scope to a storage account for the created identity.

az iot hub create --resource-group MyResourceGroup --name MyIotHub --location westus --mi-system-assigned --role "Storage Blob Data Contributor" --scopes {resourceId}

Create an IoT Hub with local authentication, device SAS keys, and module SAS keys all disabled

az iot hub create --resource-group MyResourceGroup --name MyIotHub --location westus --disable-local-auth --disable-device-sas --disable-module-sas

Create an IoT Hub with data residency enforced. This will disable cross-region disaster recovery.

az iot hub create --resource-group MyResourceGroup --name MyIoTHub --edr

Required Parameters

--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--c2d-max-delivery-count --cdd

The number of times the IoT hub will attempt to deliver a cloud-to-device message to a device, between 1 and 100.

Default value: 10
--c2d-ttl --ct

The amount of time a message is available for the device to consume before it is expired by IoT Hub, between 1 and 48 hours.

Default value: 1
--dds --disable-device-sas

A boolean indicating whether or not to disable all device (including Edge devices but excluding modules) scoped SAS keys for authentication.

Accepted values: false, true
--disable-local-auth --dla

A boolean indicating whether or not to disable IoT hub scoped SAS keys for authentication.

Accepted values: false, true
--disable-module-sas --dms

A boolean indicating whether or not to disable module-scoped SAS keys for authentication.

Accepted values: false, true
--edr --enforce-data-residency

Enforce data residency for this IoT Hub by disabling cross-region disaster recovery. This property is immutable once set on the resource. Only available in select regions. Learn more at https://aka.ms/iothubdisabledr.

Accepted values: false, true
--fc --fileupload-storage-container-name

The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.

--fcs --fileupload-storage-connectionstring

The connection string for the Azure Storage account to which files are uploaded.

--fd --feedback-max-delivery-count

The number of times the IoT hub attempts to deliver a message on the feedback queue, between 1 and 100.

Default value: 10
--feedback-lock-duration --fld

The lock duration for the feedback queue, between 5 and 300 seconds.

Default value: 5
--feedback-ttl --ft

The period of time for which the IoT hub will maintain the feedback for expiration or delivery of cloud-to-device messages, between 1 and 48 hours.

Default value: 1
--fileupload-notification-lock-duration --fnld

The lock duration for the file upload notifications queue, between 5 and 300 seconds.

Default value: 5
--fileupload-notification-max-delivery-count --fnd

The number of times the IoT hub will attempt to deliver a file notification message, between 1 and 100.

Default value: 10
--fileupload-notification-ttl --fnt

The amount of time a file upload notification is available for the service to consume before it is expired by IoT Hub, between 1 and 48 hours.

Default value: 1
--fileupload-notifications --fn

A boolean indicating whether to log information about uploaded files to the messages/servicebound/filenotifications IoT Hub endpoint.

Accepted values: false, true
Default value: False
--fileupload-sas-ttl --fst

The amount of time a SAS URI generated by IoT Hub is valid before it expires, between 1 and 24 hours.

Default value: 1
--fileupload-storage-auth-type --fsa

The authentication type for the Azure Storage account to which files are uploaded.

Accepted values: identityBased, keyBased
--fileupload-storage-identity --fsi

The managed identity to use for file upload authentication. Use '[system]' to refer to the system-assigned managed identity or a resource ID to refer to a user-assigned managed identity.

--location -l

Location of your IoT Hub. Default is the location of target resource group.

--mi-system-assigned

Enable system-assigned managed identity for this hub.

Accepted values: false, true
--mi-user-assigned

Enable user-assigned managed identities for this hub. Accept space-separated list of identity resource IDs.

--min-tls-version --mintls

Specify the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected.

--no-wait

Do not wait for the long-running operation to finish.

Default value: False
--partition-count

The number of partitions of the backing Event Hub for device-to-cloud messages.

Default value: 4
--rd --retention-day

Specifies how long this IoT hub will maintain device-to-cloud events, between 1 and 7 days.

Default value: 1
--role

Role to assign to the hub's system-assigned managed identity.

--scopes

Space separated list of scopes to assign the role (--role) for the system-assigned managed identity.

--sku

Pricing tier for Azure IoT Hub. Note that only one free IoT hub instance (F1) is allowed in each subscription. Exception will be thrown if free instances exceed one.

Accepted values: B1, B2, B3, F1, S1, S2, S3
Default value: S1
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--unit

Units in your IoT Hub.

Default value: 1
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub delete

Delete an IoT hub.

az iot hub delete [--ids]
                  [--name]
                  [--no-wait]
                  [--resource-group]
                  [--subscription]

Examples

Delete an IoT hub. (autogenerated)

az iot hub delete --name MyIoTHub --resource-group MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--no-wait

Do not wait for the long-running operation to finish.

Default value: False
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub generate-sas-token

Generate a SAS token for a target IoT Hub, device or module.

For device SAS tokens, the policy parameter is used to access the the device registry only. Therefore the policy should have read access to the registry. For IoT Hub tokens the policy is part of the SAS.

az iot hub generate-sas-token [--auth-type {key, login}]
                              [--connection-string]
                              [--device-id]
                              [--du]
                              [--hub-name]
                              [--key-type {primary, secondary}]
                              [--login]
                              [--module-id]
                              [--pn]
                              [--resource-group]

Examples

Generate an IoT Hub SAS token using the iothubowner policy and primary key.

az iot hub generate-sas-token -n {iothub_name}

Generate an IoT Hub SAS token using the registryRead policy and secondary key.

az iot hub generate-sas-token -n {iothub_name} --policy registryRead --key-type secondary

Generate a device SAS token using the iothubowner policy to access the {iothub_name} device registry.

az iot hub generate-sas-token -d {device_id} -n {iothub_name}

Generate a device SAS token using an IoT Hub connection string (with registry access)

az iot hub generate-sas-token -d {device_id} --login 'HostName=myhub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Generate an Iot Hub SAS token using an IoT Hub connection string

az iot hub generate-sas-token --connection-string 'HostName=myhub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Generate a Device SAS token using a Device connection string

az iot hub generate-sas-token --connection-string 'HostName=myhub.azure-devices.net;DeviceId=mydevice;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Generate a Module SAS token using a Module connection string

az iot hub generate-sas-token --connection-string 'HostName=myhub.azure-devices.net;DeviceId=mydevice;ModuleId=mymodule;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Optional Parameters

--auth-type

Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. If the authentication type is login and the resource hostname is provided, resource lookup will be skipped unless needed.You can configure the default using az configure --defaults iothub-data-auth-type={auth-type-value}.

Accepted values: key, login
Default value: key
--connection-string --cs

Target connection string. This bypasses the IoT Hub registry and generates the SAS token directly from the supplied symmetric key without further validation. All other command parameters aside from duration will be ignored. Supported connection string types: Iot Hub, Device, Module.

--device-id -d

Target Device Id.

--du --duration

Valid token duration in seconds.

Default value: 3600
--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--key-type --kt

Shared access policy key type for authentication.

Accepted values: primary, secondary
Default value: primary
--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--module-id -m

Target Module Id.

--pn --policy-name

Shared access policy with operation permissions for target IoT Hub entity.

Default value: iothubowner
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub invoke-device-method

Invoke a device method.

az iot hub invoke-device-method --device-id
                                --method-name
                                [--auth-type {key, login}]
                                [--hub-name]
                                [--login]
                                [--method-payload]
                                [--resource-group]
                                [--timeout]

Examples

Invoke a direct method on a device.

az iot hub invoke-device-method --hub-name {iothub_name} --device-id {device_id} --method-name Reboot --method-payload '{"version":"1.0"}'

Required Parameters

--device-id -d

Target Device Id.

--method-name --mn

Target method for invocation.

Optional Parameters

--auth-type

Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. If the authentication type is login and the resource hostname is provided, resource lookup will be skipped unless needed.You can configure the default using az configure --defaults iothub-data-auth-type={auth-type-value}.

Accepted values: key, login
Default value: key
--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--method-payload --mp

Json payload to be passed to method. Must be file path or raw json.

Default value: {}
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--timeout --to

Maximum number of seconds to wait for the device method result.

Default value: 30
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub invoke-module-method

Invoke a module method.

This command supports both edge and non-edge device modules.

az iot hub invoke-module-method --device-id
                                --method-name
                                --module-id
                                [--auth-type {key, login}]
                                [--hub-name]
                                [--login]
                                [--method-payload]
                                [--resource-group]
                                [--timeout]

Examples

Invoke a direct method on an edge device module.

az iot hub invoke-module-method -n {iothub_name} -d {device_id} -m '$edgeAgent' --method-name 'RestartModule' --method-payload '{"schemaVersion": "1.0"}'

Required Parameters

--device-id -d

Target Device Id.

--method-name --mn

Target method for invocation.

--module-id -m

Target Module Id.

Optional Parameters

--auth-type

Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. If the authentication type is login and the resource hostname is provided, resource lookup will be skipped unless needed.You can configure the default using az configure --defaults iothub-data-auth-type={auth-type-value}.

Accepted values: key, login
Default value: key
--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--method-payload --mp

Json payload to be passed to method. Must be file path or raw json.

Default value: {}
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--timeout --to

Maximum number of seconds to wait for the module method result.

Default value: 30
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub list

List IoT hubs.

az iot hub list [--resource-group]

Examples

List all IoT hubs in a subscription.

az iot hub list

List all IoT hubs in the resource group 'MyGroup'

az iot hub list --resource-group MyGroup

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub list-skus

List available pricing tiers.

az iot hub list-skus [--ids]
                     [--name]
                     [--resource-group]
                     [--subscription]

Examples

List available pricing tiers. (autogenerated)

az iot hub list-skus --name MyIoTHub

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub manual-failover

Initiate a manual failover for the IoT Hub to the geo-paired disaster recovery region.

az iot hub manual-failover [--ids]
                           [--name]
                           [--no-wait]
                           [--resource-group]
                           [--subscription]

Examples

Initiate failover “myhub” from primary to secondary region.

az iot hub manual-failover -n myhub

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--no-wait

Do not wait for the long-running operation to finish.

Default value: False
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub monitor-events

Monitor device telemetry & messages sent to an IoT Hub.

This command relies on and may install dependent Cython package (uamqp) upon first execution. https://github.com/Azure/azure-uamqp-python

Note: The event will be displayed even if the message body is non-unicode decodable, in this case the event payload portion will be displayed as {{non-decodable payload}} with the rest of the event properties that are available.

az iot hub monitor-events [--cg]
                          [--content-type]
                          [--device-id]
                          [--device-query]
                          [--enqueued-time]
                          [--hub-name]
                          [--interface]
                          [--login]
                          [--mc]
                          [--module-id]
                          [--properties {all, anno, app, sys}]
                          [--repair {false, true}]
                          [--resource-group]
                          [--timeout]
                          [--yes {false, true}]

Examples

Basic usage

az iot hub monitor-events -n {iothub_name}

Basic usage with an IoT Hub connection string

az iot hub monitor-events -n {iothub_name} --login 'HostName=myhub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Basic usage when filtering on target device

az iot hub monitor-events -n {iothub_name} -d {device_id}

Basic usage when filtering targeted devices with a wildcard in the ID

az iot hub monitor-events -n {iothub_name} -d Device*

Filter devices using IoT Hub query language

az iot hub monitor-events -n {iothub_name} -q "select * from devices where tags.location.region = 'US'"

Filter device and specify an Event Hub consumer group to bind to.

az iot hub monitor-events -n {iothub_name} -d {device_id} --cg {consumer_group_name}

Receive message annotations (message headers)

az iot hub monitor-events -n {iothub_name} -d {device_id} --properties anno

Receive message annotations + system properties. Never time out.

az iot hub monitor-events -n {iothub_name} -d {device_id} --properties anno sys --timeout 0

Receive all message attributes from all device messages

az iot hub monitor-events -n {iothub_name} --props all

Receive all messages and parse message payload as JSON

az iot hub monitor-events -n {iothub_name} --content-type application/json

Receive the specified number of messages from hub and then shut down.

az iot hub monitor-events -n {iothub_name} --message-count {message_count}

Optional Parameters

--cg --consumer-group -c

Specify the consumer group to use when connecting to event hub endpoint.

Default value: $Default
--content-type --ct

Specify the Content-Type of the message payload to automatically format the output to that type.

--device-id -d

Target Device Id.

--device-query -q

Specify a custom query to filter devices.

--enqueued-time --et -e

Indicates the time that should be used as a starting point to read messages from the partitions. Units are milliseconds since unix epoch. If no time is indicated "now" is used.

--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--interface -i

Target interface identifier to filter on. For example: dtmi:com:example:TemperatureController;1.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--mc --message-count

Number of telemetry messages to capture before the monitor is terminated. If not specified, monitor keeps running until meeting the timeout threshold of not receiving messages from hub.

--module-id -m

Target Module Id.

--properties --props -p

Indicate key message properties to output. sys = system properties, app = application properties, anno = annotations.

Accepted values: all, anno, app, sys
--repair -r

Reinstall uamqp dependency compatible with extension version. Default: false.

Accepted values: false, true
Default value: False
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--timeout --to -t

Maximum seconds to maintain connection without receiving message. Use 0 for infinity.

Default value: 300
--yes -y

Skip user prompts. Indicates acceptance of action. Used primarily for automation scenarios. Default: false.

Accepted values: false, true
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub monitor-feedback

Monitor feedback sent by devices to acknowledge cloud-to-device (C2D) messages.

This command relies on and may install dependent Cython package (uamqp) upon first execution. https://github.com/Azure/azure-uamqp-python.

az iot hub monitor-feedback [--auth-type {key, login}]
                            [--device-id]
                            [--hub-name]
                            [--login]
                            [--repair {false, true}]
                            [--resource-group]
                            [--wait-on-msg]
                            [--yes {false, true}]

Examples

Basic usage

az iot hub monitor-feedback -n {iothub_name}

Basic usage with an IoT Hub connection string

az iot hub monitor-feedback -n {iothub_name} --login 'HostName=myhub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=12345'

Basic usage when filtering on target device

az iot hub monitor-feedback -n {iothub_name} -d {device_id}

Exit feedback monitor upon receiving a message with specific id (uuid)

az iot hub monitor-feedback -n {iothub_name} -d {device_id} -w {message_id}

Optional Parameters

--auth-type

Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. If the authentication type is login and the resource hostname is provided, resource lookup will be skipped unless needed.You can configure the default using az configure --defaults iothub-data-auth-type={auth-type-value}.

Accepted values: key, login
Default value: key
--device-id -d

Target Device Id.

--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--repair -r

Reinstall uamqp dependency compatible with extension version. Default: false.

Accepted values: false, true
Default value: False
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--wait-on-msg -w

Feedback monitor will block until a message with specific id (uuid) is received.

--yes -y

Skip user prompts. Indicates acceptance of action. Used primarily for automation scenarios. Default: false.

Accepted values: false, true
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub query

Query an IoT Hub using a powerful SQL-like language.

Retrieve information regarding device and module twins, jobs and message routing. See https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language for more information.

az iot hub query --query-command
                 [--auth-type {key, login}]
                 [--hub-name]
                 [--login]
                 [--resource-group]
                 [--top]

Examples

Query all device twin data in an Azure IoT Hub.

az iot hub query -n {iothub_name} -q "select * from devices"

Query all module twin data on target device.

az iot hub query -n {iothub_name} -q "select * from devices.modules where devices.deviceId = '{device_id}'"

Required Parameters

--query-command -q

User query to be executed.

Optional Parameters

--auth-type

Indicates whether the operation should auto-derive a policy key or use the current Azure AD session. If the authentication type is login and the resource hostname is provided, resource lookup will be skipped unless needed.You can configure the default using az configure --defaults iothub-data-auth-type={auth-type-value}.

Accepted values: key, login
Default value: key
--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

--login -l

This command supports an entity connection string with rights to perform action. Use to avoid session login via "az login". If both an entity connection string and name are provided the connection string takes priority. Required if --hub-name is not provided.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--top

Maximum number of elements to return. By default query has no cap.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub show

Get the details of an IoT hub.

az iot hub show [--ids]
                [--name]
                [--resource-group]
                [--subscription]

Examples

Get the details of an IoT hub. (autogenerated)

az iot hub show --name MyIoTHub

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub show-connection-string

Deprecated

This command has been deprecated and will be removed in a future release. Use 'IoT Extension (azure-iot) connection-string command (az iot hub connection-string show)' instead.

Show the connection strings for an IoT hub.

az iot hub show-connection-string [--all]
                                  [--hub-name]
                                  [--ids]
                                  [--key {primary, secondary}]
                                  [--policy-name]
                                  [--resource-group]
                                  [--subscription]

Examples

Show the connection string of an IoT hub using default policy and primary key.

az iot hub show-connection-string --name MyIotHub

Show the connection string of an IoT Hub using policy 'service' and secondary key.

az iot hub show-connection-string --name MyIotHub --policy-name service --key secondary

Show the connection strings for all IoT hubs in a resource group.

az iot hub show-connection-string --resource-group MyResourceGroup

Show the connection strings for all IoT hubs in a subscription.

az iot hub show-connection-string

Show the connection strings for an IoT hub. (autogenerated)

az iot hub show-connection-string --key primary --policy-name MyPolicy

Optional Parameters

--all

Allow to show all shared access policies.

Default value: False
--hub-name --name -n

IoT Hub name.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--key

The key to use.

Accepted values: primary, secondary
Default value: primary
--policy-name

Shared access policy to use.

Default value: iothubowner
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub show-quota-metrics

Get the quota metrics for an IoT hub.

az iot hub show-quota-metrics [--ids]
                              [--name]
                              [--resource-group]
                              [--subscription]

Examples

Get the quota metrics for an IoT hub. (autogenerated)

az iot hub show-quota-metrics --ids {ids}

Get the quota metrics for an IoT hub. (autogenerated)

az iot hub show-quota-metrics --name MyIoTHub

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub show-stats

Get the statistics for an IoT hub.

az iot hub show-stats [--ids]
                      [--name]
                      [--resource-group]
                      [--subscription]

Examples

Get the statistics for an IoT hub. (autogenerated)

az iot hub show-stats --name MyIoTHub

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub update

Update metadata for an IoT hub.

az iot hub update [--add]
                  [--c2d-max-delivery-count]
                  [--c2d-ttl]
                  [--dds {false, true}]
                  [--disable-local-auth {false, true}]
                  [--disable-module-sas {false, true}]
                  [--fc]
                  [--fcs]
                  [--fcu]
                  [--fd]
                  [--feedback-lock-duration]
                  [--feedback-ttl]
                  [--fileupload-notification-lock-duration]
                  [--fileupload-notification-max-delivery-count]
                  [--fileupload-notification-ttl]
                  [--fileupload-notifications {false, true}]
                  [--fileupload-sas-ttl]
                  [--fileupload-storage-auth-type {identityBased, keyBased}]
                  [--fileupload-storage-identity]
                  [--force-string]
                  [--ids]
                  [--name]
                  [--rd]
                  [--remove]
                  [--resource-group]
                  [--set]
                  [--sku {B1, B2, B3, F1, S1, S2, S3}]
                  [--subscription]
                  [--tags]
                  [--unit]

Examples

Add storage container settings to file upload

az iot hub update --name MyIotHub --fileupload-storage-connectionstring "connection-string" \ --fileupload-storage-container-name "container_name"

Add a firewall filter rule to accept traffic from the IP mask 127.0.0.0/31.

az iot hub update --name MyIotHub --add properties.ipFilterRules filter_name=test-rule action=Accept ip_mask=127.0.0.0/31

Update metadata for an IoT hub. (autogenerated)

az iot hub update --name MyIotHub --set properties.allocationPolicy="GeoLatency"

Update units of an IoT Hub to 2 and add tags

az iot hub update -n MyIotHub --unit 2 --tags a=b c=d

Update pricing tier for an IoT Hub as S2

az iot hub update -n MyIotHub --sku S2

Update the retention days of IoT Hub device-to-cloud events as 3 days

az iot hub update -n MyIotHub --retention-day 3

Update the IoT Hub cloud-to-device messaging settings

az iot hub update --name MyIotHub --c2d-max-delivery-count 30 --c2d-ttl 5

Update the IoT Hub feedback queue settings

az iot hub update --name MyIoTHub --feedback-max-delivery-count 20 --feedback-lock-duration 100 --feedback-ttl 4

Update the IoT Hub file upload settings, and assign a managed identity to user for file upload

az iot hub update -n MyIoTHub --fileupload-sas-ttl 5 --fileupload-storage-auth-type identityBased --fileupload-storage-identity [system]

Update the IoT Hub file upload notification settings and queue lock duration

az iot hub update -n MyIoTHub --fileupload-notification-max-delivery-count 50 --fileupload-notification-ttl 48 --fileupload-notifications --fileupload-notification-lock-duration 10

Update the IoT Hub local authentication, device SAS, and module SAS settings

az iot hub update -n MyIoTHub --disable-local-auth --disable-device-sas false --disable-module-sas true

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Default value: []
--c2d-max-delivery-count --cdd

The number of times the IoT hub will attempt to deliver a cloud-to-device message to a device, between 1 and 100.

--c2d-ttl --ct

The amount of time a message is available for the device to consume before it is expired by IoT Hub, between 1 and 48 hours.

--dds --disable-device-sas

A boolean indicating whether or not to disable all device (including Edge devices but excluding modules) scoped SAS keys for authentication.

Accepted values: false, true
--disable-local-auth --dla

A boolean indicating whether or not to disable IoT hub scoped SAS keys for authentication.

Accepted values: false, true
--disable-module-sas --dms

A boolean indicating whether or not to disable module-scoped SAS keys for authentication.

Accepted values: false, true
--fc --fileupload-storage-container-name

The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.

--fcs --fileupload-storage-connectionstring

The connection string for the Azure Storage account to which files are uploaded.

--fcu --fileupload-storage-container-uri
Deprecated

Argument 'fileupload_storage_container_uri' has been deprecated and will be removed in a future release.

The container URI for the Azure Storage account to which files are uploaded.

--fd --feedback-max-delivery-count

The number of times the IoT hub attempts to deliver a message on the feedback queue, between 1 and 100.

--feedback-lock-duration --fld

The lock duration for the feedback queue, between 5 and 300 seconds.

--feedback-ttl --ft

The period of time for which the IoT hub will maintain the feedback for expiration or delivery of cloud-to-device messages, between 1 and 48 hours.

--fileupload-notification-lock-duration --fnld

The lock duration for the file upload notifications queue, between 5 and 300 seconds.

--fileupload-notification-max-delivery-count --fnd

The number of times the IoT hub will attempt to deliver a file notification message, between 1 and 100.

--fileupload-notification-ttl --fnt

The amount of time a file upload notification is available for the service to consume before it is expired by IoT Hub, between 1 and 48 hours.

--fileupload-notifications --fn

A boolean indicating whether to log information about uploaded files to the messages/servicebound/filenotifications IoT Hub endpoint.

Accepted values: false, true
--fileupload-sas-ttl --fst

The amount of time a SAS URI generated by IoT Hub is valid before it expires, between 1 and 24 hours.

--fileupload-storage-auth-type --fsa

The authentication type for the Azure Storage account to which files are uploaded.

Accepted values: identityBased, keyBased
--fileupload-storage-identity --fsi

The managed identity to use for file upload authentication. Use '[system]' to refer to the system-assigned managed identity or a resource ID to refer to a user-assigned managed identity.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Default value: False
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

IoT Hub name.

--rd --retention-day

Specifies how long this IoT hub will maintain device-to-cloud events, between 1 and 7 days.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Default value: []
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Default value: []
--sku

Pricing tier for Azure IoT Hub. Note that only one free IoT hub instance (F1) is allowed in each subscription. Exception will be thrown if free instances exceed one.

Accepted values: B1, B2, B3, F1, S1, S2, S3
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--unit

Units in your IoT Hub.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az iot hub wait

Wait until an operation on an IoT Hub instance is complete.

az iot hub wait [--created]
                [--custom]
                [--deleted]
                [--exists]
                [--ids]
                [--interval]
                [--name]
                [--resource-group]
                [--subscription]
                [--timeout]
                [--updated]

Examples

Wait until an existing IoT Hub instance is created

az iot hub wait -n MyIoTHub --created

Wait until an IoT Hub instance is deleted

az iot hub wait -n MyIoTHub --deleted

Wait until an existing IoT Hub instance has an Active state

az iot hub wait -n MyIoTHub --custom "properties.state=='Active'"

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

Default value: False
--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

Default value: False
--exists

Wait until the resource exists.

Default value: False
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

Polling interval in seconds.

Default value: 30
--name -n

IoT Hub name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

Maximum wait in seconds.

Default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.