az iot hub

Manage Azure IoT hubs.

Commands

az iot hub certificate Manage IoT Hub certificates.
az iot hub certificate create Create/upload an Azure IoT Hub certificate.
az iot hub certificate delete Deletes an Azure IoT Hub certificate.
az iot hub certificate generate-verification-code Generates a verification code for an Azure IoT Hub certificate.
az iot hub certificate list Lists all certificates contained within an Azure IoT Hub.
az iot hub certificate show Shows information about a particular Azure IoT Hub certificate.
az iot hub certificate update Update an Azure IoT Hub certificate.
az iot hub certificate verify Verifies an Azure IoT Hub certificate.
az iot hub consumer-group 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 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 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 route Manage routes of an IoT hub.
az iot hub route create Create a route in IoT Hub.
az iot hub route delete Delete all or mentioned route for your IoT Hub.
az iot hub route list Get all the routes in IoT Hub.
az iot hub route show Get information about the route in IoT Hub.
az iot hub route test Test all routes or mentioned route in IoT Hub.
az iot hub route update Update a route in IoT Hub.
az iot hub routing-endpoint Manage custom endpoints of an IoT hub.
az iot hub routing-endpoint create Add an endpoint to your IoT Hub.
az iot hub routing-endpoint delete Delete all or mentioned endpoint for your IoT Hub.
az iot hub routing-endpoint list Get information on all the endpoints for your IoT Hub.
az iot hub routing-endpoint show Get information on mentioned endpoint for your 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]
[--partition-count]
[--sku {B1, B2, B3, 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 and 4 partitions, in the 'westus' region.

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

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.

--partition-count

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

default value: 2
--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: B1, B2, B3, 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 --name
[--key {primary, secondary}]
[--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

Required Parameters

--name -n

IoT Hub name.

Optional Parameters

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

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]
[--force-string]
[--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 <key=value, string or JSON string>.

--force-string

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

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