你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Get-AzIotHubDeviceConnectionString

获取 IoT 中心中目标 IoT 设备的连接字符串。

语法

Get-AzIotHubDeviceConnectionString
   [-ResourceGroupName] <String>
   [-IotHubName] <String>
   [-DeviceId <String>]
   [-KeyType <PSKeyType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzIotHubDeviceConnectionString
   [-InputObject] <PSIotHub>
   [-DeviceId <String>]
   [-KeyType <PSKeyType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzIotHubDeviceConnectionString
   [-ResourceId] <String>
   [-DeviceId <String>]
   [-KeyType <PSKeyType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

说明

列出 Azure IoT 中心中包含的所有设备或目标 IoT 设备的连接字符串。

示例

示例 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

显示 IoT 中心中的所有设备连接字符串。

示例 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******

获取 IoT 设备的辅助连接字符串。

参数

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

类型:IAzureContextContainer
别名:AzContext, AzureRmContext, AzureCredential
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-DeviceId

目标设备 ID。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-InputObject

IotHub 对象

类型:PSIotHub
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-IotHubName

IoT 中心的名称

类型:String
Position:1
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-KeyType

用于身份验证的共享访问策略密钥类型。

类型:PSKeyType
接受的值:primary, secondary
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ResourceGroupName

资源组的名称

类型:String
Position:0
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-ResourceId

IotHub 资源 ID

类型:String
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

输入

PSIotHub

String

输出

PSDeviceConnectionString