Skip to content

Commit

Permalink
Merge pull request #116 from Azure-Samples/keyvaultaudit
Browse files Browse the repository at this point in the history
Capture KeyVault Audit Events
  • Loading branch information
tonybaloney committed Jun 5, 2024
2 parents 901b9ce + d540730 commit 9ecba00
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/Azure-Samples/Azure-Python-Standardization-Template-Generator",
"commit": "75d8c04bda1e75ae989198d933a785ca153bd891",
"commit": "984454a27bd81d8d26794bd3464e9b1b5714ff66",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
15 changes: 15 additions & 0 deletions infra/core/security/keyvault.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
metadata description = 'Creates an Azure Key Vault.'
param name string
param location string = resourceGroup().location
param logAnalyticsWorkspaceId string
param tags object = {}

param principalId string = ''
Expand Down Expand Up @@ -35,6 +36,20 @@ resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = {
}
}

resource logs 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
name: 'logs'
scope: keyVault
properties: {
workspaceId: logAnalyticsWorkspaceId
logs: [
{
category: 'AuditEvent'
enabled: true
}
]
}
}

output endpoint string = keyVault.properties.vaultUri
output id string = keyVault.id
output name string = keyVault.name
1 change: 1 addition & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module keyVault './core/security/keyvault.bicep' = {
location: location
tags: tags
principalId: principalId
logAnalyticsWorkspaceId: monitoring.outputs.logAnalyticsWorkspaceId
}
}

Expand Down

0 comments on commit 9ecba00

Please sign in to comment.