Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

az iot hub connection-string

Note

This reference is part of the azure-iot extension for the Azure CLI (version 2.67.0 or higher). The extension will automatically install the first time you run an az iot hub connection-string command. Learn more about extensions.

Manage IoT Hub connection strings.

Commands

Name Description Type Status
az iot hub connection-string show

Show the connection strings for the specified IoT Hubs using the given policy name and key.

Extension GA

az iot hub connection-string show

Show the connection strings for the specified IoT Hubs using the given policy name and key.

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

Examples

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

az iot hub connection-string show

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

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

Show all connection strings of the given IoT Hub using primary key.

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

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

az iot hub connection-string show -n MyIotHub

Show the connection string of the given 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 the given IoT Hub's default eventhub.

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

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--all --show-all

Show all shared access policies for the respective IoT Hub.

Property Value
Default value: False
--default-eventhub --eh

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

Property Value
Default value: False
Accepted values: false, true
--hub-name -n

IoT Hub name or hostname. Required if --login is not provided.

Property Value
Parameter group: IoT Hub Identifier Arguments
--key-type --kt

Shared access policy key type for authentication.

Property Value
Default value: primary
Accepted values: primary, secondary
--pn --policy-name

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

Property Value
Default value: iothubowner
--resource-group -g

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


Feedback

Was this page helpful?