msticpy.auth.secret_settings module

Settings provider for secrets.

class msticpy.auth.secret_settings.SecretsClient(tenant_id: Optional[str] = None, use_keyring: bool = False)

Bases: object

Secrets client - manages Key Vault and keyring secrets.

Initialize SecretsClient instance.

Parameters
  • tenant_id (str, optional) – TenantID, by default None

  • use_keyring (bool, optional) – If True use keyring to cache secrets, by default False

Raises

MsticpyKeyVaultConfigError – Missing or invalid configuration settings.

Notes

Requires KeyVault settings to be defined in msticpyconfig.yaml

clear_keyring_secrets()

Clear any cached secrets from keyring.

static format_kv_name(setting_path)

Return normalized name for use as a KeyVault secret name.

get_secret_accessor(setting_path: str) Callable[[], Any]

Return accessor function for a secret.

Parameters

setting_path (str) – The msticpy configuration path (dot-separated)

Returns

Accessor function for the secret value.

Return type

Callable[[None], Any]

static read_secret(secret_object: Any) Any

Return the secret value.

Parameters

secret_object (Any) – If it is a func, call and return the return value of that func. Otherwise just return the object.

Returns

The secret value

Return type

Any

refresh_keyring()

Reload keyring values from Key Vault.