Share via


az iot hub policy

Manage shared access policies of an IoT hub.

Commands

Name Description Type Status
az iot hub policy create

Create a new shared access policy in an IoT hub.

Core GA
az iot hub policy delete

Delete a shared access policy from an IoT hub.

Core GA
az iot hub policy list

List shared access policies of an IoT hub.

Core GA
az iot hub policy renew-key

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

Core GA
az iot hub policy show

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

Core GA

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]

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Default value: False
--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.