你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Iot Hub Resource - List Keys
获取 IoT 中心的安全元数据。 有关详细信息,请参阅:https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys?api-version=2023-06-30
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
resource
|
path | True |
string |
包含 IoT 中心的资源组的名称。 |
resource
|
path | True |
string |
IoT 中心的名称。 |
subscription
|
path | True |
string |
订阅标识符。 |
api-version
|
query | True |
string |
API 的版本。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
这是一个同步操作。 正文包含可用于访问 IoT 中心终结点的共享访问策略(包括密钥)的 JSON 序列化数组。 |
|
Other Status Codes |
DefaultErrorResponse |
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
IotHubResource_ListKeys
Sample Request
Sample Response
{
"value": [
{
"keyName": "iothubowner",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "RegistryWrite, ServiceConnect, DeviceConnect"
},
{
"keyName": "service",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "ServiceConnect"
},
{
"keyName": "device",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "DeviceConnect"
},
{
"keyName": "registryRead",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "RegistryRead"
},
{
"keyName": "registryReadWrite",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "RegistryWrite"
}
]
}
定义
名称 | 说明 |
---|---|
Access |
分配给共享访问策略的权限。 |
Error |
错误详细信息。 |
Shared |
IoT 中心共享访问策略的属性。 |
Shared |
包含下一个链接的共享访问策略列表。 |
AccessRights
分配给共享访问策略的权限。
名称 | 类型 | 说明 |
---|---|---|
DeviceConnect |
string |
|
RegistryRead |
string |
|
RegistryRead, DeviceConnect |
string |
|
RegistryRead, RegistryWrite |
string |
|
RegistryRead, RegistryWrite, DeviceConnect |
string |
|
RegistryRead, RegistryWrite, ServiceConnect |
string |
|
RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect |
string |
|
RegistryRead, ServiceConnect |
string |
|
RegistryRead, ServiceConnect, DeviceConnect |
string |
|
RegistryWrite |
string |
|
RegistryWrite, DeviceConnect |
string |
|
RegistryWrite, ServiceConnect |
string |
|
RegistryWrite, ServiceConnect, DeviceConnect |
string |
|
ServiceConnect |
string |
|
ServiceConnect, DeviceConnect |
string |
ErrorDetails
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
details |
string |
错误详细信息。 |
httpStatusCode |
string |
HTTP 状态代码。 |
message |
string |
错误消息。 |
SharedAccessSignatureAuthorizationRule
IoT 中心共享访问策略的属性。
名称 | 类型 | 说明 |
---|---|---|
keyName |
string |
共享访问策略的名称。 |
primaryKey |
string |
主键。 |
rights |
分配给共享访问策略的权限。 |
|
secondaryKey |
string |
辅助密钥。 |
SharedAccessSignatureAuthorizationRuleListResult
包含下一个链接的共享访问策略列表。
名称 | 类型 | 说明 |
---|---|---|
nextLink |
string |
下一个链接。 |
value |
共享访问策略的列表。 |