msticpy.auth.keyvault_settings module

Keyvault client settings.

class msticpy.auth.keyvault_settings.KeyVaultSettings

Bases: object

KeyVaultSettings class - reads settings from msticpyconfig.

Notes

The KeyVault section in msticpyconfig.yaml can contain the following:

KeyVault:
    TenantId: {tenantid-to-use-for-authentication}
    SubscriptionId: {subscriptionid-containing-vault}
    ResourceGroup: {resource-group-containing-vault}
    AzureRegion: {region-for-vault}
    VaultName: {vault-name}
    UseKeyring: True
    Authority: global

SubscriptionId, ResourceGroup and AzureRegion are only used when creating new vaults. UseKeyring instructs the SecretsClient to cache Keyvault secrets locally using Python keyring. Authority is one of ‘global’, ‘usgov’, ‘cn’ Alternatively, you can specify AuthorityURI with the value pointing to the URI for logon requests.

Initialize new instance of KeyVault Settings.

Raises:

MsticpyKeyVaultConfigError – If no Key Vault settings are found in msticpyconfig.yaml.

CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46'
property authority_uri: str

Return authority URI for cloud.

Returns:

Authority URI

Return type:

str

property cloud: str

Return the cloud for the settings.

get(key: str, default: Any | None = None) Any

Return dict value or default.

get_tenant_authority_host(authority_uri: str | None = None, tenant: str | None = None) str

Return tenant authority URI with no leading scheme.

Parameters:
  • authority_uri (str, optional) – The authority URI - otherwise try to retrieve from settings

  • tenant (str, optional) – TenantID or name, by default None. If not passed as a parameter try to get tenant from KeyVault configuration in msticpyconfig.yaml

Returns:

Tenant Authority

Return type:

str

Raises:

KeyVaultConfigException – If tenant is not defined.

get_tenant_authority_uri(authority_uri: str | None = None, tenant: str | None = None) str

Return authority URI for tenant.

Parameters:
  • authority_uri (str, optional) – The authority URI - otherwise try to retrieve from settings

  • tenant (str, optional) – TenantID or name, by default None. If not passed as a parameter try to get tenant from KeyVault configuration in msticpyconfig.yaml

Returns:

Tenant Authority

Return type:

str

Raises:

KeyVaultConfigException – If tenant is not defined.

property keyvault_uri: str | None

Return KeyVault URI template for current cloud.

property mgmt_uri: str | None

Return Azure management URI template for current cloud.