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

New-AzIotHubKey

生成 Azure IoT 中心密钥。

语法

New-AzIotHubKey
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-KeyName] <String>
   [-RenewKey] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzIotHubKey
   [-HubId] <String>
   [-KeyName] <String>
   [-RenewKey] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

生成 Azure IoT 中心密钥。

示例

示例 1 重新生成主密钥

New-AzIotHubKey -ResourceGroupName "myresourcegroup" -Name "myiothub" -KeyName "testKey" -RenewKey "primary"

KeyName		PrimaryKey										SecondaryKey										Rights
-------		----------										------------										------
test		********************************            	********************************            		ServiceConnect

重新生成了 Azure iot 中心的授权策略“testKey”的主密钥。

示例 2 交换密钥

New-AzIotHubKey -ResourceGroupName "myresourcegroup" -Name "myiothub" -KeyName "testKey" -RenewKey "swap"

KeyName		PrimaryKey										SecondaryKey										Rights
-------		----------										------------										------
test		********************************            	********************************            		ServiceConnect

交换 Azure iot 中心的授权策略“testKey”的密钥。

参数

-Confirm

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

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

-DefaultProfile

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

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

-HubId

IotHub 资源 ID

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

-KeyName

密钥的名称

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

-Name

IotHub 的名称

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

-RenewKey

重新生成密钥。

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

-ResourceGroupName

资源组名称

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

-WhatIf

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

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

输入

String

输出

PSSharedAccessSignatureAuthorizationRule