Delen via


Iot Hub Resource - List Keys

Haal de beveiligingsmetagegevens voor een IoT-hub op. Zie https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security voor meer informatie.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys?api-version=2023-06-30

URI-parameters

Name In Vereist Type Description
resourceGroupName
path True

string

De naam van de resourcegroep die de IoT-hub bevat.

resourceName
path True

string

De naam van de IoT-hub.

subscriptionId
path True

string

De abonnement-ID.

api-version
query True

string

De versie van de API.

Antwoorden

Name Type Description
200 OK

SharedAccessSignatureAuthorizationRuleListResult

Dit is een synchrone bewerking. De hoofdtekst bevat een door JSON geserialiseerde matrix met beleid voor gedeelde toegang, inclusief sleutels, die u kunt gebruiken voor toegang tot de IoT Hub-eindpunten.

Other Status Codes

ErrorDetails

DefaultErrorResponse

Beveiliging

azure_auth

Azure Active Directory OAuth2-stroom

Type: oauth2
Stroom: implicit
Autorisatie-URL: https://login.microsoftonline.com/common/oauth2/authorize

Bereiken

Name Description
user_impersonation Uw gebruikersaccount imiteren

Voorbeelden

IotHubResource_ListKeys

Voorbeeldaanvraag

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

Voorbeeldrespons

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

Definities

Name Description
AccessRights

De machtigingen die zijn toegewezen aan het beleid voor gedeelde toegang.

ErrorDetails

Foutdetails.

SharedAccessSignatureAuthorizationRule

De eigenschappen van een gedeeld toegangsbeleid voor IoT Hub.

SharedAccessSignatureAuthorizationRuleListResult

De lijst met beleid voor gedeelde toegang met een volgende koppeling.

AccessRights

De machtigingen die zijn toegewezen aan het beleid voor gedeelde toegang.

Waarde Description
RegistryRead
RegistryWrite
ServiceConnect
DeviceConnect
RegistryRead, RegistryWrite
RegistryRead, ServiceConnect
RegistryRead, DeviceConnect
RegistryWrite, ServiceConnect
RegistryWrite, DeviceConnect
ServiceConnect, DeviceConnect
RegistryRead, RegistryWrite, ServiceConnect
RegistryRead, RegistryWrite, DeviceConnect
RegistryRead, ServiceConnect, DeviceConnect
RegistryWrite, ServiceConnect, DeviceConnect
RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect

ErrorDetails

Foutdetails.

Name Type Description
code

string

De foutcode.

details

string

De foutdetails.

httpStatusCode

string

De HTTP-statuscode.

message

string

Het foutbericht.

SharedAccessSignatureAuthorizationRule

De eigenschappen van een gedeeld toegangsbeleid voor IoT Hub.

Name Type Description
keyName

string

De naam van het beleid voor gedeelde toegang.

primaryKey

string

De primaire sleutel.

rights

AccessRights

De machtigingen die zijn toegewezen aan het beleid voor gedeelde toegang.

secondaryKey

string

De secundaire sleutel.

SharedAccessSignatureAuthorizationRuleListResult

De lijst met beleid voor gedeelde toegang met een volgende koppeling.

Name Type Description
nextLink

string

De volgende koppeling.

value

SharedAccessSignatureAuthorizationRule[]

De lijst met beleid voor gedeelde toegang.