Iot Hub Resource - List Keys
Obtenez les métadonnées de sécurité d’un hub IoT. Pour plus d’informations, consultez : 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
Paramètres URI
| Nom | Dans | Obligatoire | Type | Description |
|---|---|---|---|---|
|
resource
|
path | True |
string |
Nom du groupe de ressources qui contient le hub IoT. |
|
resource
|
path | True |
string |
Nom du hub IoT. |
|
subscription
|
path | True |
string |
Identificateur d’abonnement. |
|
api-version
|
query | True |
string |
Version de l’API. |
Réponses
| Nom | Type | Description |
|---|---|---|
| 200 OK |
Il s’agit d’une opération synchrone. Le corps contient un tableau json sérialisé de stratégies d’accès partagé, y compris des clés, que vous pouvez utiliser pour accéder aux points de terminaison IoT Hub. |
|
| Other Status Codes |
DefaultErrorResponse |
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
| Nom | Description |
|---|---|
| user_impersonation | emprunter l’identité de votre compte d’utilisateur |
Exemples
IotHubResource_ListKeys
Exemple de requête
POST https://management.azure.com/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/testHub/listkeys?api-version=2023-06-30
Exemple de réponse
{
"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"
}
]
}
Définitions
| Nom | Description |
|---|---|
|
Access |
Autorisations affectées à la stratégie d’accès partagé. |
|
Error |
Détails de l’erreur. |
|
Shared |
Propriétés d’une stratégie d’accès partagé IoT Hub. |
|
Shared |
Liste des stratégies d’accès partagé avec un lien suivant. |
AccessRights
Autorisations affectées à la stratégie d’accès partagé.
| Valeur | 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
Détails de l’erreur.
| Nom | Type | Description |
|---|---|---|
| code |
string |
Code d’erreur. |
| details |
string |
Détails de l’erreur. |
| httpStatusCode |
string |
Code d’état HTTP. |
| message |
string |
Message d’erreur. |
SharedAccessSignatureAuthorizationRule
Propriétés d’une stratégie d’accès partagé IoT Hub.
| Nom | Type | Description |
|---|---|---|
| keyName |
string |
Nom de la stratégie d’accès partagé. |
| primaryKey |
string |
Clé primaire. |
| rights |
Autorisations affectées à la stratégie d’accès partagé. |
|
| secondaryKey |
string |
Clé secondaire. |
SharedAccessSignatureAuthorizationRuleListResult
Liste des stratégies d’accès partagé avec un lien suivant.
| Nom | Type | Description |
|---|---|---|
| nextLink |
string |
Lien suivant. |
| value |
Liste des stratégies d’accès partagé. |