Obtenir l'état d'un audit

Cette page explique comment obtenir l'état d'un audit en cours dans Audit Manager. Les audits sont des opérations de longue durée. Il peut être utile d'obtenir l'état d'un audit pendant son exécution.

Avant de commencer

Obtenir l'état d'un audit en cours

Console

  1. Dans la console Google Cloud , accédez à la page Audit Manager.

    Accéder au Gestionnaire d'audit

  2. Dans la section Audits de conformité, cliquez sur Afficher les audits.

  3. Sur la page Afficher les évaluations, vous pouvez consulter l'état actuel d'un audit en cours ou obtenir plus d'informations sur un audit terminé.

  4. Pour en savoir plus sur l'audit, cliquez sur le lien dans la colonne État.

gcloud

La commande gcloud audit-manager operations describe décrit une opération d'audit.

Avant d'utiliser les données de la commande ci-dessous, effectuez les remplacements suivants :

  • RESOURCE_TYPE : type de ressource (projet ou dossier). Exemple : folder.
  • RESOURCE_ID : ID de ressource du projet ou du dossier. Exemple : 8767234.
  • LOCATION : emplacement du point de terminaison de l'API Audit Manager. Pour obtenir la liste des points de terminaison disponibles, consultez Emplacements. Par exemple : us-central1.
  • AUDIT_OPERATION_ID : ID unique de l'opération en cours qui a été inclus dans le corps de la réponse lorsque vous avez exécuté l'audit. Par exemple, 098234.

Exécutez la commande suivante :

Linux, macOS ou Cloud Shell

gcloud audit-manager operations describe AUDIT_OPERATION_ID \
    --RESOURCE_TYPE=RESOURCE_ID \
    --location=LOCATION

Windows (PowerShell)

gcloud audit-manager operations describe AUDIT_OPERATION_ID `
    --RESOURCE_TYPE=RESOURCE_ID `
    --location=LOCATION

Windows (cmd.exe)

gcloud audit-manager operations describe AUDIT_OPERATION_ID ^
    --RESOURCE_TYPE=RESOURCE_ID ^
    --location=LOCATION

REST

Avant d'utiliser les données de requête, effectuez les remplacements suivants :

  • RESOURCE_TYPE : type de ressource (projet ou dossier). Exemple : folder.
  • RESOURCE_ID : ID de ressource du projet ou du dossier. Exemple : 8767234.
  • LOCATION : emplacement du point de terminaison de l'API Audit Manager. Pour obtenir la liste des points de terminaison disponibles, consultez Emplacements. Par exemple : us-central1.
  • AUDIT_OPERATION_ID : ID unique de l'opération en cours qui a été inclus dans le corps de la réponse lorsque vous avez exécuté l'audit. Par exemple, 098234.

Méthode HTTP et URL :

GET https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID

Pour envoyer votre requête, choisissez l'une des options suivantes :

curl

Exécutez la commande suivante :

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID"

PowerShell

Exécutez la commande suivante :

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID" | Select-Object -Expand Content
Une réponse réussie inclut l'un des types d'état d'exécution suivants :
Status type Description
OPERATION_STATE_UNSPECIFIED An invalid state.
OPERATION_STATE_NOT_STARTED The audit report generation process has not yet started.
OPERATION_STATE_EVALUATION_IN_PROGRESS Audit Manager is evaluating the resources against compliance controls.
OPERATION_STATE_EVALUATION_DONE Audit Manager has completed compliance evaluation.
OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS Audit Manager is creating an audit report from the evaluated data.
OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE Audit Manager has completed the generation of the audit report.
OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS Audit Manager is uploading the audit report and evidence to the destination.
OPERATION_STATE_DONE The audit report generation process is completed.
OPERATION_STATE_FAILED The audit report generation process has failed.

Each of the execution status types might provide any of the following additional information, when applicable:

Additional status Description
failure_reason If the audit assessment fails, this field provides the reason for the failure.
evaluation_percent_complete If evaluation has started, this field provides the percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.
report_generation_percent_complete If the report generation has started, this field provides percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.
report_uploading_percent_complete If the report uploading has started, this field provides percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.

Lorsqu'un rapport d'audit est terminé et importé, un lien vers le rapport est renvoyé.

Étapes suivantes