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

Add-AzIoTDeviceProvisioningServiceLinkedHub

将 IoT 中心链接到 Azure IoT 中心设备预配服务。

语法

Add-AzIoTDeviceProvisioningServiceLinkedHub
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-IotHubConnectionString] <String>
   [-IotHubLocation] <String>
   [-AllocationWeight <Int32>]
   [-ApplyAllocationPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIoTDeviceProvisioningServiceLinkedHub
   [-DpsObject] <PSProvisioningServiceDescription>
   [-IotHubConnectionString] <String>
   [-IotHubLocation] <String>
   [-AllocationWeight <Int32>]
   [-ApplyAllocationPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzIoTDeviceProvisioningServiceLinkedHub
   [-ResourceId] <String>
   [-IotHubConnectionString] <String>
   [-IotHubLocation] <String>
   [-AllocationWeight <Int32>]
   [-ApplyAllocationPolicy]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

有关 Azure IoT 中心设备预配服务的简介,请参阅 https://learn.microsoft.com/azure/iot-dps/about-iot-dps

示例

示例 1

Add-AzIoTDeviceProvisioningServiceLinkedHub -ResourceGroupName "myresourcegroup" -Name "myiotdps" -IotHubConnectionString $hubConnectionString -IotHubLocation "eastus"

ResourceGroupName     : myresourcegroup
Name                  : myiotdps
LinkedHubName         : myiothub.azure-devices.net
ConnectionString      : HostName=myiothub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=****
AllocationWeight      : 
ApplyAllocationPolicy : 
Location              : eastus

将 IoT 中心链接到 Azure IoT 中心设备预配服务。

示例 2

Add-AzIoTDeviceProvisioningServiceLinkedHub -ResourceGroupName "myresourcegroup" -Name "myiotdps" -IotHubConnectionString $hubConnectionString -IotHubLocation "eastus" -AllocationWeight 10 -ApplyAllocationPolicy

LinkedHubName					Location	AllocationWeight	ApplyAllocationPolicy
-------------					--------	----------------	---------------------
myiothub1.azure-devices.net		eastus		2					true
myiothub2.azure-devices.net		westus2		10					false

使用 AllocationWeight 和 ApplyAllocationPolicy 将 IoT 中心链接到 Azure IoT 中心设备预配服务。

参数

-AllocationWeight

IoT 中心的分配权重

类型:Nullable<T>[Int32]
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ApplyAllocationPolicy

一个布尔值,指示是否将分配策略应用于 IoT 中心

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

-Confirm

在运行 cmdlet 之前,提示你进行确认。

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

-DefaultProfile

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

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

-DpsObject

IoT 设备预配服务对象

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

-IotHubConnectionString

IoT 中心资源的连接字符串。

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

-IotHubLocation

IoT 中心的位置

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

-Name

IoT 设备预配服务的名称

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

-ResourceGroupName

资源组的名称

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

-ResourceId

IoT 设备预配服务资源 ID

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

-WhatIf

显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。

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

输入

PSProvisioningServiceDescription

String

输出

PSIotHubDefinitionDescription

PSIotHubDefinitions