Iot Hub Resource - List Keys

Get the security metadata for an IoT hub. For more information, see: 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 Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

resourceName
path True

string

The name of the IoT hub.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Responses

Name Type Description
200 OK

SharedAccessSignatureAuthorizationRuleListResult

Azure operation completed successfully.

Other Status Codes

ErrorDetails

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

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

Scopes

Name Description
user_impersonation impersonate your user account

Examples

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

Sample response

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

Definitions

Name Description
AccessRights

The permissions assigned to the shared access policy.

ErrorDetails

Error details.

SharedAccessSignatureAuthorizationRule

The properties of an IoT hub shared access policy.

SharedAccessSignatureAuthorizationRuleListResult

The list of shared access policies with a next link.

AccessRights

The permissions assigned to the shared access policy.

Value Description
RegistryRead

RegistryRead

RegistryWrite

RegistryWrite

ServiceConnect

ServiceConnect

DeviceConnect

DeviceConnect

RegistryRead, RegistryWrite

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

RegistryWrite, ServiceConnect, DeviceConnect

RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect

RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect

ErrorDetails

Error details.

Name Type Description
code

string

The error code.

details

string

The error details.

httpStatusCode

string

The HTTP status code.

message

string

The error message.

SharedAccessSignatureAuthorizationRule

The properties of an IoT hub shared access policy.

Name Type Description
keyName

string

The name of the shared access policy.

primaryKey

string

The primary key.

rights

AccessRights

The permissions assigned to the shared access policy.

secondaryKey

string

The secondary key.

SharedAccessSignatureAuthorizationRuleListResult

The list of shared access policies with a next link.

Name Type Description
nextLink

string (uri)

The link to the next page of items

value

SharedAccessSignatureAuthorizationRule[]

The SharedAccessSignatureAuthorizationRule items on this page