Condividi tramite


Iot Hub Resource - List Keys

Ottenere i metadati di sicurezza per un hub IoT. Per altre informazioni, vedere: 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=2023-06-30

Parametri dell'URI

Nome In Necessario Tipo Descrizione
resourceGroupName
path True

string

Nome del gruppo di risorse che contiene l'hub IoT.

resourceName
path True

string

Nome dell'hub IoT.

subscriptionId
path True

string

L'identificatore della sottoscrizione.

api-version
query True

string

Versione dell'API.

Risposte

Nome Tipo Descrizione
200 OK

SharedAccessSignatureAuthorizationRuleListResult

Si tratta di un'operazione sincrona. Il corpo contiene una matrice serializzata JSON di criteri di accesso condiviso, incluse le chiavi, che è possibile usare per accedere agli endpoint dell'hub IoT.

Other Status Codes

ErrorDetails

DefaultErrorResponse

Sicurezza

azure_auth

Flusso OAuth2 di Azure Active Directory

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

Scopes

Nome Descrizione
user_impersonation rappresentare l'account utente

Esempio

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=2023-06-30

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

Definizioni

Nome Descrizione
AccessRights

Autorizzazioni assegnate ai criteri di accesso condiviso.

ErrorDetails

Dettagli errore.

SharedAccessSignatureAuthorizationRule

Proprietà di un criterio di accesso condiviso dell'hub IoT.

SharedAccessSignatureAuthorizationRuleListResult

Elenco dei criteri di accesso condiviso con un collegamento successivo.

AccessRights

Autorizzazioni assegnate ai criteri di accesso condiviso.

Nome Tipo Descrizione
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

Dettagli errore.

Nome Tipo Descrizione
code

string

Codice di errore.

details

string

Dettagli dell'errore.

httpStatusCode

string

Codice di stato HTTP.

message

string

Messaggio di errore.

SharedAccessSignatureAuthorizationRule

Proprietà di un criterio di accesso condiviso dell'hub IoT.

Nome Tipo Descrizione
keyName

string

Nome dei criteri di accesso condiviso.

primaryKey

string

Chiave primaria.

rights

AccessRights

Autorizzazioni assegnate ai criteri di accesso condiviso.

secondaryKey

string

Chiave secondaria.

SharedAccessSignatureAuthorizationRuleListResult

Elenco dei criteri di accesso condiviso con un collegamento successivo.

Nome Tipo Descrizione
nextLink

string

Collegamento successivo.

value

SharedAccessSignatureAuthorizationRule[]

Elenco dei criteri di accesso condiviso.