msticpy.common.wsconfig module

Module for Log Analytics-related configuration.

class msticpy.common.wsconfig.WorkspaceConfig(workspace: Optional[str] = None, config_file: Optional[str] = None, interactive: bool = True)

Bases: object

Workspace configuration class.

Load current Azure Notebooks configuration for Log Analytics.

Parameters
  • config_file (Optional[str], optional) – path to a configuration file, If not specified, the defaults is to use a configured msticpyconfig.yaml If this isn’t configured, it will search for (first) a config.json and (second) a msticpyconfig.yaml in (first) the current directory and (second) the parent directory and subfolders.

  • workspace (str, Optional[str]) – Workspace name (where multiple workspaces are configured), by default the Default workspace will be used.

  • interactive (bool, optional) – If this is False, initializing the class will not raise an exception if no configuration is found. By default, True.

CONF_RES_GROUP_KEY = 'resource_group'
CONF_SUB_ID_KEY = 'subscription_id'
CONF_TENANT_ID_KEY = 'tenant_id'
CONF_WS_ID_KEY = 'workspace_id'
CONF_WS_NAME_KEY = 'workspace_name'
PKG_CONF_NAME_KEY = 'WorkspaceName'
PKG_CONF_RES_GROUP_KEY = 'ResourceGroup'
PKG_CONF_SUB_KEY = 'SubscriptionId'
PKG_CONF_TENANT_KEY = 'TenantId'
PKG_CONF_WS_KEY = 'WorkspaceId'
RESOURCE_GROUP = '{{cookiecutter.resource_group}}'
SUBSCRIPTION_ID = '{{cookiecutter.subscription_id}}'
TENANT_ID = '{{cookiecutter.tenant_id}}'
WORKSPACE_ID = '{{cookiecutter.workspace_id}}'
WORKSPACE_NAME = '{{cookiecutter.workspace_name}}'
property code_connect_str: str

Return the Log Analytics connection string for dev code auth.

Returns

Connection string

Return type

str

property config_loaded: bool

Return True if workspace id and tenant id have values.

Returns

True if configuration loaded.

Return type

bool

classmethod list_workspaces() Dict

Return list of available workspaces.

Returns

Dictionary of workspaces with workspace and tenantIds.

Return type

Dict

prompt_for_ws()

Display an interactive prompt for Workspace details.