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=2026-11-01

URI 參數

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

string

minLength: 1
maxLength: 90

資源群組的名稱。 名稱不區分大小寫。

resourceName
path True

string

IoT 中樞的名稱。

subscriptionId
path True

string (uuid)

目標訂用帳戶的標識碼。 此值必須是 UUID。

api-version
query True

string

minLength: 1

用於此作業的 API 版本。

回覆

名稱 類型 Description
200 OK

SharedAccessSignatureAuthorizationRuleListResult

Azure 運作順利完成。

Other Status Codes

ErrorDetails

未預期的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 冒用您的使用者帳戶

範例

IotHubResource_ListKeys

範例要求

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

範例回覆

{
  "value": [
    {
      "keyName": "iothubowner",
      "primaryKey": "<primaryKey>",
      "rights": "RegistryWrite, ServiceConnect, DeviceConnect",
      "secondaryKey": "<secondaryKey>"
    },
    {
      "keyName": "service",
      "primaryKey": "<primaryKey>",
      "rights": "ServiceConnect",
      "secondaryKey": "<secondaryKey>"
    },
    {
      "keyName": "device",
      "primaryKey": "<primaryKey>",
      "rights": "DeviceConnect",
      "secondaryKey": "<secondaryKey>"
    },
    {
      "keyName": "registryRead",
      "primaryKey": "<primaryKey>",
      "rights": "RegistryRead",
      "secondaryKey": "<secondaryKey>"
    },
    {
      "keyName": "registryReadWrite",
      "primaryKey": "<primaryKey>",
      "rights": "RegistryWrite",
      "secondaryKey": "<secondaryKey>"
    }
  ]
}

定義

名稱 Description
AccessRights

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

ErrorDetails

錯誤詳細數據。

SharedAccessSignatureAuthorizationRule

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

SharedAccessSignatureAuthorizationRuleListResult

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

AccessRights

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

值 Description
RegistryRead

註冊閱讀

RegistryWrite

登錄檔寫入

ServiceConnect

ServiceConnect

DeviceConnect

DeviceConnect

RegistryRead, RegistryWrite

登錄檔讀取、登錄檔寫入

RegistryRead, ServiceConnect

RegistryRead、ServiceConnect

RegistryRead, DeviceConnect

RegistryRead、DeviceConnect

RegistryWrite, ServiceConnect

RegistryWrite, ServiceConnect

RegistryWrite, DeviceConnect

RegistryWrite, DeviceConnect

ServiceConnect, DeviceConnect

ServiceConnect、DeviceConnect

RegistryRead, RegistryWrite, ServiceConnect

RegistryRead, RegistryWrite, ServiceConnect

RegistryRead, RegistryWrite, DeviceConnect

RegistryRead, RegistryWrite, DeviceConnect

RegistryRead, ServiceConnect, DeviceConnect

RegistryRead、ServiceConnect、DeviceConnect

RegistryWrite, ServiceConnect, DeviceConnect

登錄寫、服務連接、裝置連接

RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect

登錄檔讀取、登錄寫入、服務連接、裝置連接

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 (uri)

項目下一頁的連結

value

SharedAccessSignatureAuthorizationRule[]

本頁上的 SharedAccessSignatureAuthorizationRule 項目