Get-AzIotHubDeviceConnectionString
Get the connection string of a target IoT device in an Iot Hub.
Syntax
ResourceSet (Default)
Get-AzIotHubDeviceConnectionString
[-ResourceGroupName] <String>
[-IotHubName] <String>
[-DeviceId <String>]
[-KeyType <PSKeyType>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzIotHubDeviceConnectionString
[-InputObject] <PSIotHub>
[-DeviceId <String>]
[-KeyType <PSKeyType>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceIdSet
Get-AzIotHubDeviceConnectionString
[-ResourceId] <String>
[-DeviceId <String>]
[-KeyType <PSKeyType>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
List connection string of all devices or a target IoT device contained within an Azure IoT Hub.
Examples
Example 1
Get-AzIotHubDeviceConnectionString -ResourceGroupName "myresourcegroup" -IotHubName "myiothub"
Device Id Connection String
--------- -----------------
device1 HostName=myiothub.azure-devices.net;DeviceId=device1;SharedAccessKey=/X4y******
device2 HostName=myiothub.azure-devices.net;DeviceId=device2;x509=true
Show all devices connection string in an Iot Hub.
Example 2
Get-AzIotHubDeviceConnectionString -ResourceGroupName "myresourcegroup" -IotHubName "myiothub" -DeviceId "device1" -KeyType secondary
Device Id Connection String
--------- -----------------
device1 HostName=myiothub.azure-devices.net;DeviceId=device1;SharedAccessKey=/X4y******
Get the secondary connection string of an IoT device.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DeviceId
Target Device Id.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
IotHub object
Type: PSIotHub
Default value: None
Supports wildcards: False
DontShow: False
InputObjectSet
Position: 0
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-IotHubName
Name of the Iot Hub
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ResourceSet
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-KeyType
Shared access policy key type for auth.
Parameter properties
Type: PSKeyType
Default value: None
Accepted values: primary, secondary
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Name of the Resource Group
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ResourceSet
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceId
IotHub Resource Id
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ResourceIdSet
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs