Pipeline: 6.1.4 Ensure that logging for Azure Key Vault is 'Enabled'
Description
Enable AuditEvent logging for key vault instances to ensure interactions with key vaults are logged and available.
Monitoring how and when key vaults are accessed, and by whom, enables an audit trail of interactions with confidential information, keys, and certificates managed by Azure Key Vault. Enabling logging for Key Vault saves information in a user provided destination of either an Azure storage account or Log Analytics workspace. The same destination can be used for collecting logs for multiple Key Vaults.
Remediation
From Azure Portal
- Go to
Key vaults. - Select a Key vault.
- Under
Monitoring, selectDiagnostic settings. - Click
Edit settingto update an existing diagnostic setting, orAdd diagnostic settingto create a new one. - If creating a new diagnostic setting, provide a name.
- Configure an appropriate destination.
- Under
Category groups, checkauditandallLogs. - Click
Save.
From Azure CLI
To update an existing Diagnostic Settings
az monitor diagnostic-settings update --name "<diagnostic_setting_name>" --resource <key_vault_id>To create a new Diagnostic Settings
az monitor diagnostic-settings create --name "<diagnostic_setting_name>" --resource <key_vault_id> --logs "[{category:audit,enabled:true},{category:allLogs,enabled:true}]" --metrics "[{category:AllMetrics,enabled:true}]" <[--event-hub <event_hub_ID> --event-hub-rule <event_hub_auth_rule_ID> | --storage-account <storage_account_ID> |--workspace <log_analytics_workspace_ID> | --marketplace-partner-id <solution_resource_ID>]>From PowerShell
Create the Log settings object
$logSettings = @()$logSettings += New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category audit$logSettings += New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category allLogsCreate the Metric settings object
$metricSettings = @()$metricSettings += New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetricsCreate the Diagnostic Settings for each Key Vault
New-AzDiagnosticSetting -Name "<diagnostic_setting_name>" -ResourceId <key_vault_id> -Log $logSettings -Metric $metricSettings [-StorageAccountId <storage_account_ID> | -EventHubName <event_hub_name> -EventHubAuthorizationRuleId <event_hub_auth_rule_ID> | -WorkSpaceId <log analytics workspace ID> | -MarketPlacePartnerId <full resource ID for third-party solution>]Default Value
By default, Diagnostic AuditEvent logging is not enabled for Key Vault instances.
Run the pipeline
To run this pipeline from your terminal:
flowpipe pipeline run azure_cis.pipeline.cis_v300_6_1_4Use this pipeline
To call this pipeline from your pipeline, use a step:
step "pipeline" "step_name" { pipeline = azure_cis.pipeline.cis_v300_6_1_4 }Params
| Name | Type | Required | Description | Default |
|---|---|---|---|---|
| database | connection.steampipe | Yes | Database connection string. | connection.steampipe.default |
| notifier | notifier | Yes | The name of the notifier to use for sending notification messages. | notifier.default |
| notification_level | string | Yes | The verbosity level of notification messages to send. Valid options are 'verbose', 'info', 'error'. | info |
Outputs
This pipeline has no outputs.