az iot hub

(PREVIEW) Manage Azure IoT hubs.

Commands

az iot hub consumer-group (PREVIEW) Manage the event hub consumer groups of an IoT hub.
az iot hub consumer-group create Create an event hub consumer group.
az iot hub consumer-group delete Delete an event hub consumer group.
az iot hub consumer-group list List event hub consumer groups.
az iot hub consumer-group show Get the details for an event hub consumer group.
az iot hub create Create an Azure IoT hub.
az iot hub delete Delete an IoT hub.
az iot hub job (PREVIEW) Manage jobs in an IoT hub.
az iot hub job cancel Cancel a job in an IoT hub.
az iot hub job list List the jobs in an IoT hub.
az iot hub job show Get the details of a job in an IoT hub.
az iot hub list List IoT hubs.
az iot hub list-skus List available pricing tiers.
az iot hub policy (PREVIEW) Manage shared access policies of an IoT hub.
az iot hub policy create Create a new shared access policy in an IoT hub.
az iot hub policy delete Delete a shared access policy from an IoT hub.
az iot hub policy list List shared access policies of an IoT hub.
az iot hub policy show Get the details of a shared access policy of an IoT hub.
az iot hub show Get the details of an IoT hub.
az iot hub show-connection-string Show the connection strings for an IoT hub.
az iot hub show-quota-metrics Get the quota metrics for an IoT hub.
az iot hub show-stats Get the statistics for an IoT hub.
az iot hub update Update metadata for an IoT hub.

az iot hub create

Create an Azure IoT hub.

az iot hub create --name
--resource-group
[--location]
[--sku {F1, S1, S2, S3}]
[--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

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

az iot hub create --resource-group MyResourceGroup --name MyIotHub --sku S1 --location westus

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

--location -l
Location of your IoT Hub. Default is the location of target resource group.
--sku
Pricing tier for Azure IoT Hub. Default value is F1, which is free. Note that only one free IoT Hub instance is allowed in each subscription. Exception will be thrown if free instances exceed one.
accepted values: F1, S1, S2, S3
default value: F1
--unit
Units in your IoT Hub.
default value: 1

az iot hub delete

Delete an IoT hub.

az iot hub delete --name
[--resource-group]

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

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

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>`.

az iot hub list-skus

List available pricing tiers.

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

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

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

az iot hub show

Get the details of an IoT hub.

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

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

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

az iot hub show-connection-string

Show the connection strings for an IoT hub.

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

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

Optional Parameters

--key
The key to use.
accepted values: primary, secondary
default value: primary
--name -n
IoT Hub name.
--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>`.

az iot hub show-quota-metrics

Get the quota metrics for an IoT hub.

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

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

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

az iot hub show-stats

Get the statistics for an IoT hub.

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

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

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

az iot hub update

Update metadata for an IoT hub.

az iot hub update --name
[--add]
[--remove]
[--resource-group]
[--set]

Examples

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

Required Parameters

--name -n
IoT Hub name.

Optional Parameters

--add
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty .
--remove
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
--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=.