This post goes with the series of my posts under the Azure Key Vault.
I assume that you know about Azure Key Vault and have used it, and continue this article. If you’re new to Azure Key Vault, please review the below links.
Enabling Logging Diagnostics for Azure Key Vault
Recently Azure Key Vault team has announced the logging feature for the Key Vault (which is one of the highly required features).
Logs are written to a storage account in the Azure. So first create a storage account. Then in the PowerShell execute the following commands. Assuming that you have a vault and storage account.
It is good keep the storage account in the same Resource Group of the Key Vault as management would be easy.
We have the vault and storage details in variables, now time to setup the diagnostics
Logs are saved as JSON documents in the blob storage of the provided storage account. Do some activities which perform some operations in the Key Vault and get the JSON.
The below is log snippet for retrieving the vault. Note the operation name as VaultGet also the log provides information like the duration and client IP addresses. In the identity section it also provides the used identity information (the Azure Active Directory Identity name) for the specified operation.
The below is another JSON document snippet for the SecretGet operation. Along with the other information the request Uri property gives the details of which secret and the version information.
Disabling the logging Diagnostics
Execute the following line to disable the logging. (assuming the $vault and $storage variables are set as shown above)