az iot hub configuration

Manage IoT device configurations at scale.

Commands

az iot hub configuration create Create an IoT device configuration in the target IoT Hub.
az iot hub configuration delete Delete an IoT device configuration.
az iot hub configuration list List IoT device configurations in an IoT Hub.
az iot hub configuration show Get the details of an IoT device configuration.
az iot hub configuration show-metric Evaluate a target user or system metric defined in an IoT device configuration.
az iot hub configuration update Update an IoT device configuration with the specified properties.

az iot hub configuration create

Create an IoT device configuration in the target IoT Hub.

az iot hub configuration create --config-id
--content
[--hub-name]
[--lab]
[--login]
[--metrics]
[--pri]
[--resource-group]
[--target-condition]

Examples

Create a device configuration that applies on condition where a device is in 'building 9' and the environment is 'test'.

az iot hub configuration create -c {config_name} -n {iothub_name} --content ../device_content.json --target-condition "tags.building=9 and tags.environment='test'"

Create a device configuration with labels and provide user metrics inline (bash syntax example)

az iot hub configuration create -c {config_name} -n {iothub_name} --content ../device_content.json --target-condition "tags.building=9" --labels '{"key0":"value0", "key1":"value1"}' --metrics '{"metrics": {"queries": {"mymetrik": "select deviceId from devices where tags.location='US'"}}}'

Create a device configuration with labels and provide user metrics inline (cmd syntax example)

az iot hub configuration create -c {config_name} -n {iothub_name} --content ../device_content.json --target-condition "tags.building=9" --labels "{\"key0\":\"value0\", \"key1\":\"value1\"}" --metrics "{\"metrics\": {\"queries\": {\"mymetrik\": \"select deviceId from devices where tags.location='US'\"}}}"

Required Parameters

--config-id -c

Target device configuration.

--content -k

Device configuration content. Provide file path or raw json.

Optional Parameters

--hub-name -n

IoT Hub name.

--lab --labels

Map of labels to be applied to target configuration. Format example: {"key0":"value0", "key1":"value1"}.

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

--metrics -m

Device configuration metric definitions. Provide file path or raw json.

--pri --priority

Weight of the device configuration in case of competing rules (highest wins).

--resource-group -g

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

--target-condition --tc -t

Target condition in which a device configuration applies to.

az iot hub configuration delete

Delete an IoT device configuration.

az iot hub configuration delete --config-id
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--config-id -c

Target device configuration.

Optional Parameters

--hub-name -n

IoT Hub name.

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

--resource-group -g

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

az iot hub configuration list

List IoT device configurations in an IoT Hub.

az iot hub configuration list [--hub-name]
[--login]
[--resource-group]
[--top]

Optional Parameters

--hub-name -n

IoT Hub name.

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

--resource-group -g

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

--top

Maximum number of configurations to return.

default value: 10

az iot hub configuration show

Get the details of an IoT device configuration.

az iot hub configuration show --config-id
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--config-id -c

Target device configuration.

Optional Parameters

--hub-name -n

IoT Hub name.

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

--resource-group -g

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

az iot hub configuration show-metric

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

az iot hub configuration show-metric --config-id
--metric-id
[--hub-name]
[--login]
[--metric-type {system, user}]
[--resource-group]

Examples

Evaluate the user defined 'warningLimit' metric

az iot hub configuration show-metric -m warningLimit -c {configuration_name} -n {iothub_name}

Evaluate the system 'appliedCount' metric

az iot hub configuration show-metric --metric-id appliedCount -c {configuration_name} -n {iothub_name} --metric-type system

Required Parameters

--config-id -c

Target device configuration.

--metric-id -m

Target metric for evaluation.

Optional Parameters

--hub-name -n

IoT Hub name.

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

--metric-type --mt

Indicates which metric collection should be used to lookup a metric.

accepted values: system, user
default value: user
--resource-group -g

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

az iot hub configuration update

Update an IoT device configuration with the specified properties.

az iot hub configuration update --config-id
[--add]
[--force-string]
[--hub-name]
[--login]
[--remove]
[--resource-group]
[--set]

Examples

Alter the priority of a device configuration and update its target condition

az iot hub configuration update -c {configuration_name} -n {iothub_name} --set priority=10 targetCondition="tags.building=43 and tags.environment='dev'"

Required Parameters

--config-id -c

Target device configuration.

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.

--hub-name -n

IoT Hub name.

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

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