Skip to main content

Output a Key Vault Secrets report

Project description

azure-key-vault-report


Description

Generates a plain text report of secrets in the specified Key Vault.

Then table is generated and sorted (from top to bottom) by:

  • the oldest Expiration date, then by
  • the oldest Last Updated date

The table also contains a Comment columns, which may include info about:

  • Days to when the secret will expire
  • Days since the secret expired
  • Info if the secret has no expiration date set
  • Days since the Secret was last updated

The raw list, which is used to generate the report, is fetched by invoking the following shell command as subprocess:
az keyvault secret list --vault-name NAME-OF-THE-KEY-VAULT


Installation

pip install ops-py-azure-key-vault-report


Usage

Example code:

from azure_key_vault_report import azure_key_vault_report

name = "kv-super-secrets"
kv = azure_key_vault_report.AzureKeyVaultReport(name)
kv.az_cmd()
kv.parse_results()
kv.set_report_header()
report = kv.plaintext_report()
print(report)

---------------------------------------------------------------------------------------------------------------------------------------------
 Secret Name                                       | Last Updated      | Expiration        | Comment
---------------------------------------------------------------------------------------------------------------------------------------------
 CertificateRenewal                                | 2023-11-22        | 2025-11-22        | Will expire in 729 days. Updated 2 days ago. 
 ClientSecret                                      | 2023-10-31        | 2024-06-25        | Will expire in 214 days. Updated 24 days ago. 
 ClientId                                          | 2020-12-15        |                   | Has no expiration date. Updated 1074 days ago

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ops-py-azure-key-vault-report-0.0.3.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page