Iot Hub Resource - Get Keys For Key Name
从 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}/IotHubKeys/{keyName}/listkeys?api-version=2023-06-30
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
key
|
path | True |
string |
共享访问策略的名称。 |
|
resource
|
path | True |
string |
包含 IoT 中心的资源组的名称。 |
|
resource
|
path | True |
string |
IoT 中心的名称。 |
|
subscription
|
path | True |
string |
订阅标识符。 |
|
api-version
|
query | True |
string |
API 的版本。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
这是一个同步作。 正文包含 JSON 序列化的共享访问策略,包括可用于访问一个或多个 IoT 中心终结点的密钥。 |
|
| Other Status Codes |
DefaultErrorResponse |
安全性
azure_auth
Azure Active Directory OAuth2 流
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
IotHubResource_GetKeysForKeyName
示例请求
POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/IotHubKeys/iothubowner/listkeys?api-version=2023-06-30
示例响应
{
"keyName": "iothubowner",
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>",
"rights": "RegistryWrite, ServiceConnect, DeviceConnect"
}
定义
| 名称 | 说明 |
|---|---|
|
Access |
分配给共享访问策略的权限。 |
|
Error |
错误详细信息。 |
|
Shared |
IoT 中心共享访问策略的属性。 |
AccessRights
分配给共享访问策略的权限。
| 值 | 说明 |
|---|---|
| RegistryRead | |
| RegistryWrite | |
| ServiceConnect | |
| DeviceConnect | |
| RegistryRead, RegistryWrite | |
| RegistryRead, ServiceConnect | |
| RegistryRead, DeviceConnect | |
| RegistryWrite, ServiceConnect | |
| RegistryWrite, DeviceConnect | |
| ServiceConnect, DeviceConnect | |
| RegistryRead, RegistryWrite, ServiceConnect | |
| RegistryRead, RegistryWrite, DeviceConnect | |
| RegistryRead, ServiceConnect, DeviceConnect | |
| RegistryWrite, ServiceConnect, DeviceConnect | |
| RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect |
ErrorDetails
错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码。 |
| details |
string |
错误详细信息。 |
| httpStatusCode |
string |
HTTP 状态代码。 |
| message |
string |
错误消息。 |
SharedAccessSignatureAuthorizationRule
IoT 中心共享访问策略的属性。
| 名称 | 类型 | 说明 |
|---|---|---|
| keyName |
string |
共享访问策略的名称。 |
| primaryKey |
string |
主键。 |
| rights |
分配给共享访问策略的权限。 |
|
| secondaryKey |
string |
辅助密钥。 |