Iot Hub Resource - List Keys

Obtenha os metadados de segurança para um hub IoT. Para obter mais informações, consulte: 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

Parâmetros de URI

Nome Em Obrigatório Tipo Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

O nome do grupo de recursos. O nome não diferencia maiúsculas de minúsculas.

resourceName
path True

string

O nome do hub IoT.

subscriptionId
path True

string (uuid)

O ID da assinatura de destino. O valor deve ser uma UUID.

api-version
query True

string

minLength: 1

A versão da API a ser usada para esta operação.

Respostas

Nome Tipo Description
200 OK

SharedAccessSignatureAuthorizationRuleListResult

A operação do Azure foi concluída com êxito.

Other Status Codes

ErrorDetails

Uma resposta de erro inesperada.

Segurança

azure_auth

Fluxo do OAuth2 do Azure Active Directory.

Tipo: oauth2
Flow: implicit
URL de Autorização: https://login.microsoftonline.com/common/oauth2/authorize

Escopos

Nome Description
user_impersonation se passar pela sua conta de usuário

Exemplos

IotHubResource_ListKeys

Solicitação de exemplo

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

Resposta de exemplo

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

Definições

Nome Description
AccessRights

As permissões atribuídas à política de acesso compartilhado.

ErrorDetails

Detalhes do erro.

SharedAccessSignatureAuthorizationRule

As propriedades de uma política de acesso compartilhado do hub IoT.

SharedAccessSignatureAuthorizationRuleListResult

A lista de políticas de acesso compartilhado com um próximo link.

AccessRights

As permissões atribuídas à política de acesso compartilhado.

Valor 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

Detalhes do erro.

Nome Tipo Description
code

string

O código de erro.

details

string

Os detalhes do erro.

httpStatusCode

string

O código de status do HTTP.

message

string

A mensagem de erro.

SharedAccessSignatureAuthorizationRule

As propriedades de uma política de acesso compartilhado do hub IoT.

Nome Tipo Description
keyName

string

O nome da política de acesso compartilhado.

primaryKey

string

A chave primária.

rights

AccessRights

As permissões atribuídas à política de acesso compartilhado.

secondaryKey

string

A chave secundária.

SharedAccessSignatureAuthorizationRuleListResult

A lista de políticas de acesso compartilhado com um próximo link.

Nome Tipo Description
nextLink

string (uri)

Link para a próxima página de itens

value

SharedAccessSignatureAuthorizationRule[]

Os itens da Regra de AutorizaçãoAssinaturaCompartilhada nesta página