az iot hub module-identity

Manage IoT device modules.

Commands

az iot hub module-identity create Create a module on a target IoT device in an IoT Hub.
az iot hub module-identity delete Delete a device in an IoT Hub.
az iot hub module-identity list List modules located on an IoT device in an IoT Hub.
az iot hub module-identity show Get the details of an IoT device module in an IoT Hub.
az iot hub module-identity show-connection-string Show a target IoT device module connection string.
az iot hub module-identity update Update an IoT Hub device module.

az iot hub module-identity create

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

az iot hub module-identity create --device-id
--module-id
[--am {shared_private_key, x509_ca, x509_thumbprint}]
[--hub-name]
[--login]
[--od]
[--primary-thumbprint]
[--resource-group]
[--secondary-thumbprint]
[--valid-days]

Required Parameters

--device-id -d

Target Device.

--module-id -m

Target Module.

Optional Parameters

--am --auth-method

The authorization type an entity is to be created with.

accepted values: shared_private_key, x509_ca, x509_thumbprint
default value: shared_private_key
--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.

--od --output-dir

Generate self-signed cert and use its thumbprint. Output to specified target directory.

--primary-thumbprint --ptp

Explicit self-signed certificate thumbprint to use for primary key.

--resource-group -g

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

--secondary-thumbprint --stp

Explicit self-signed certificate thumbprint to use for secondary key.

--valid-days --vd

Generate self-signed cert and use its thumbprint. Valid for specified number of days. Default: 365.

az iot hub module-identity delete

Delete a device in an IoT Hub.

az iot hub module-identity delete --device-id
--module-id
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--module-id -m

Target Module.

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 module-identity list

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

az iot hub module-identity list --device-id
[--hub-name]
[--login]
[--resource-group]
[--top]

Required Parameters

--device-id -d

Target Device.

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 elements to return. Use -1 for unlimited.

default value: 1000

az iot hub module-identity show

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

az iot hub module-identity show --device-id
--module-id
[--hub-name]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--module-id -m

Target Module.

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 module-identity show-connection-string

Show a target IoT device module connection string.

az iot hub module-identity show-connection-string --device-id
--module-id
[--hub-name]
[--key-type {primary, secondary}]
[--login]
[--resource-group]

Required Parameters

--device-id -d

Target Device.

--module-id -m

Target Module.

Optional Parameters

--hub-name -n

IoT Hub name.

--key-type --kt

Shared access policy key type for auth.

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.

--resource-group -g

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

az iot hub module-identity update

Update an IoT Hub device module.

az iot hub module-identity update --device-id
--module-id
[--add]
[--force-string]
[--hub-name]
[--login]
[--remove]
[--resource-group]
[--set]

Examples

Regenerate module symmetric authentication keys

az iot hub module-identity update -m {module_name} -d {device_id} -n {iothub_name} --set authentication.symmetricKey.primaryKey="" authentication.symmetricKey.secondaryKey=""

Required Parameters

--device-id -d

Target Device.

--module-id -m

Target Module.

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