Iot Hub Resource - Get Keys For Key Name
Obtenha uma política de acesso compartilhado por nome de 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}/IotHubKeys/{keyName}/listkeys?api-version=2026-11-01
Parâmetros de URI
| Nome | Em | Obrigatório | Tipo | Descrição |
|---|---|---|---|---|
|
key
|
path | True |
string |
O nome da política de acesso compartilhado. |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
O nome do grupo de recursos. O nome não diferencia maiúsculas de minúsculas. |
|
resource
|
path | True |
string |
O nome do hub IoT. |
|
subscription
|
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 | Descrição |
|---|---|---|
| 200 OK |
A operação do Azure foi concluída com êxito. |
|
| Other Status Codes |
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 | Descrição |
|---|---|
| user_impersonation | se passar pela sua conta de usuário |
Exemplos
IotHubResource_GetKeysForKeyName
Solicitação de exemplo
POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/IotHubKeys/iothubowner/listkeys?api-version=2026-11-01
Resposta de exemplo
{
"keyName": "iothubowner",
"primaryKey": "<primaryKey>",
"rights": "RegistryWrite, ServiceConnect, DeviceConnect",
"secondaryKey": "<secondaryKey>"
}
Definições
| Nome | Descrição |
|---|---|
|
Access |
As permissões atribuídas à política de acesso compartilhado. |
|
Error |
Detalhes do erro. |
|
Shared |
As propriedades de uma política de acesso compartilhado do hub IoT. |
AccessRights
As permissões atribuídas à política de acesso compartilhado.
| Valor | Descrição |
|---|---|
| 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 | Descrição |
|---|---|---|
| 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 | Descrição |
|---|---|---|
| keyName |
string |
O nome da política de acesso compartilhado. |
| primaryKey |
string |
A chave primária. |
| rights |
As permissões atribuídas à política de acesso compartilhado. |
|
| secondaryKey |
string |
A chave secundária. |