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=2018-04-01

URI 參數

名稱 位於 必要 類型 Description
resourceGroupName
path True

string

包含IoT中樞的資源群組名稱。

resourceName
path True

string

IoT 中樞的名稱。

subscriptionId
path True

string

訂用帳戶識別碼。

api-version
query True

string

API 的版本。

回應

名稱 類型 Description
200 OK

SharedAccessSignatureAuthorizationRuleListResult

這是同步作業。 本文包含 JSON 串行化的共用存取原則數位,包括可用來存取 IoT 中樞端點的密鑰。

Other Status Codes

ErrorDetails

DefaultErrorResponse

安全性

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

IotHubResource_ListKeys

Sample Request

POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/listkeys?api-version=2018-04-01

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"
    }
  ]
}

定義

名稱 Description
AccessRights

指派給共用存取原則的許可權。

ErrorDetails

錯誤詳細數據。

SharedAccessSignatureAuthorizationRule

IoT 中樞共用存取原則的屬性。

SharedAccessSignatureAuthorizationRuleListResult

具有下一個連結的共用存取原則清單。

AccessRights

指派給共用存取原則的許可權。

名稱 類型 Description
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

錯誤詳細數據。

名稱 類型 Description
code

string

錯誤碼。

details

string

錯誤詳細資料。

httpStatusCode

string

HTTP 狀態碼。

message

string

錯誤訊息。

SharedAccessSignatureAuthorizationRule

IoT 中樞共用存取原則的屬性。

名稱 類型 Description
keyName

string

共用存取原則的名稱。

primaryKey

string

主鍵。

rights

AccessRights

指派給共用存取原則的許可權。

secondaryKey

string

次要金鑰。

SharedAccessSignatureAuthorizationRuleListResult

具有下一個連結的共用存取原則清單。

名稱 類型 Description
nextLink

string

下一個連結。

value

SharedAccessSignatureAuthorizationRule[]

共用存取原則的清單。