sempy_labs.key_vault package

Module contents

sempy_labs.key_vault.backup_secret(key_vault_uri: str, secret: str) bytes

Backs up a secret from the specified Azure Key Vault.

This is a wrapper function for the following API: Backup Secret - Backup Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the secret to be backed up in the Key Vault.

Returns:

The backup blob of the secret.

Return type:

bytes

sempy_labs.key_vault.delete_secret(key_vault_uri: str, secret: str)

Deletes a secret in the specified Azure Key Vault.

This is a wrapper function for the following API: Delete Secret - Delete Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the secret to be deleted in the Key Vault.

sempy_labs.key_vault.get_secret(key_vault_uri: str, secret: str) Any

Retrieves the latest version of a secret from the specified Azure Key Vault.

This is a wrapper function for the following API: Get Secret - Get Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the secret in the Key Vault.

Returns:

The value of the latest version of the secret.

Return type:

Any

sempy_labs.key_vault.list_deleted_secrets(key_vault_uri: str) DataFrame

Lists all deleted secrets in the specified Azure Key Vault.

This is a wrapper function for the following API: Get Deleted Secrets - GetDeleted Secrets.

Parameters:

key_vault_uri (str) – Azure Key Vault URI.

Returns:

A pandas DataFrame containing details of all secrets in the Key Vault.

Return type:

pandas.DataFrame

sempy_labs.key_vault.list_secret_versions(key_vault_uri: str, secret: str) DataFrame

Lists all versions of a specific secret in the specified Azure Key Vault.

This is a wrapper function for the following API: Get Secret Versions - Get Secret Versions.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the secret.

Returns:

A pandas DataFrame containing details of all versions of the secret in the Key Vault.

Return type:

pandas.DataFrame

sempy_labs.key_vault.list_secrets(key_vault_uri: str) DataFrame

Lists all secrets in the specified Azure Key Vault.

This is a wrapper function for the following API: Get Secrets - Get Secrets.

Parameters:

key_vault_uri (str) – Azure Key Vault URI.

Returns:

A pandas DataFrame containing details of all secrets in the Key Vault.

Return type:

pandas.DataFrame

sempy_labs.key_vault.purge_deleted_secret(key_vault_uri: str, secret: str)

Permanently deletes the specified secret. The purge deleted secret operation removes the secret permanently, without the possibility of recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the secrets/purge permission.

This is a wrapper function for the following API: Purge Deleted Secret - Purge Deleted Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the deleted secret to be recovered in the Key Vault.

sempy_labs.key_vault.recover_deleted_secret(key_vault_uri: str, secret: str)

Recovers a deleted secret in the specified Azure Key Vault.

This is a wrapper function for the following API: Recover Deleted Secret - Recover Deleted Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the deleted secret to be recovered in the Key Vault.

sempy_labs.key_vault.restore_secret(key_vault_uri: str, backup_blob: bytes) dict

Restores a backed up secret to the specified Azure Key Vault.

This is a wrapper function for the following API: Restore Secret - Restore Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • backup_blob (bytes) – The backup blob of the secret to be restored.

Returns:

The restored secret details.

Return type:

dict

sempy_labs.key_vault.set_secret(key_vault_uri: str, name: str, value: Any)

Sets a secret in the specified Azure Key Vault.

This is a wrapper function for the following API: Set Secret - Set Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • name (str) – Name of the secret to be set in the Key Vault.

  • value (Any) – Value of the secret to be set in the Key Vault.

sempy_labs.key_vault.update_secret(key_vault_uri: str, secret: str, version: str, enabled: bool = None) dict

Updates the attributes of a secret in the specified Azure Key Vault.

This is a wrapper function for the following API: Update Secret - Update Secret.

Parameters:
  • key_vault_uri (str) – Azure Key Vault URI.

  • secret (str) – Name of the secret to be updated in the Key Vault.

  • version (str) – Version of the secret to be updated in the Key Vault.

  • enabled (bool, optional) – Specifies whether the secret is enabled or disabled.

Returns:

The updated secret attributes.

Return type:

dict