az iot hub policy

Manage shared access policies of an IoT hub.

Commands

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 renew-key

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

az iot hub policy show

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

az iot hub policy create

Create a new shared access policy in an IoT hub.

az iot hub policy create --hub-name
                         --name
                         --permissions
                         [--resource-group]
                         [--subscription]

Examples

Create a new shared access policy.

az iot hub policy create --hub-name MyIotHub --name new-policy --permissions RegistryWrite ServiceConnect DeviceConnect

Required Parameters

--hub-name

IoT Hub name.

--name -n

Shared access policy name.

--permissions

Permissions of shared access policy. Use space-separated list for multiple permissions. Possible values: RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect.

Optional Parameters

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

az iot hub policy delete

Delete a shared access policy from an IoT hub.

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

Examples

Delete a shared access policy from an IoT hub. (autogenerated)

az iot hub policy delete --hub-name MyHub --name MySharedAccessPolicy

Optional Parameters

--hub-name

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.

--name -n

Shared access policy 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.

az iot hub policy list

List shared access policies of an IoT hub.

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

Examples

List shared access policies of an IoT hub. (autogenerated)

az iot hub policy list --hub-name MyHub --resource-group MyResourceGroup

Optional Parameters

--hub-name

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.

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

az iot hub policy renew-key

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

az iot hub policy renew-key --renew-key {primary, secondary, swap}
                            [--hub-name]
                            [--ids]
                            [--name]
                            [--no-wait]
                            [--resource-group]
                            [--subscription]

Examples

Regenerate primary key of a shared access policy of an IoT hub.

az iot hub policy renew-key --hub-name MyHub --name MySharedAccessPolicy --rk Primary

Required Parameters

--renew-key --rk

Regenerate keys.

accepted values: primary, secondary, swap

Optional Parameters

--hub-name

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.

--name -n

Shared access policy name.

--no-wait

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

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

az iot hub policy show

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

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

Examples

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

az iot hub policy show --hub-name MyHub --name MySharedAccessPolicy

Optional Parameters

--hub-name

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.

--name -n

Shared access policy 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.