az iot hub connection-string

Manage IoT Hub connection strings.

Commands

az iot hub connection-string show

Show the connection strings for an IoT Hub.

az iot hub connection-string show

Show the connection strings for an IoT Hub.

az iot hub connection-string show [--all]
                                  [--default-eventhub {false, true}]
                                  [--hub-name]
                                  [--key-type {primary, secondary}]
                                  [--pn]
                                  [--resource-group]

Examples

Show the connection string for all IoT Hubs in a subscription using the default policy and primary key.

az iot hub connection-string show

Show the connection string for all IoT Hubs in a resource group using the default policy and primary key.

az iot hub connection-string show --resource-group MyResourceGroup

Show all the connection string of an IoT Hub using primary key.

az iot hub connection-string show -n MyIotHub --all

Show the connection string of an IoT Hub using default policy and primary key.

az iot hub connection-string show -n MyIotHub

Show the connection string of an IoT Hub using policy 'service' and secondary key.

az iot hub connection-string show -n MyIotHub --policy-name service --key-type secondary

Show the eventhub compatible connection string of an IoT Hub's default eventhub.

az iot hub connection-string show -n MyIotHub --default-eventhub

Optional Parameters

--all --show-all

Allow to show all shared access policies.

--default-eventhub --eh

Flag indicating the connection string returned is for the default EventHub endpoint. Default: false.

accepted values: false, true
--hub-name -n

IoT Hub name.

--key-type --kt

Shared access policy key type for auth.

accepted values: primary, secondary
default value: primary
--pn --policy-name

Shared access policy with operation permissions for target IoT Hub entity.

default value: iothubowner
--resource-group -g

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