msticpy.auth.azure_auth module

Azure authentication handling.

msticpy.auth.azure_auth.az_connect(auth_methods: Optional[List[str]] = None, tenant_id: Optional[str] = None, silent: bool = False) AzCredentials

Connect to Azure SDK/API.

Parameters
  • auth_methods (List[str], optional) – List of authentication methods to try Possible options are: - “env” - to get authentication details from environment variables - “cli” - to use Azure CLI authentication details - “msi” - to user Managed Service Identity details - “interactive” - to prompt for interactive login - “vscode” - to use VSCode credentials - “powershell” - to use PowerShell credentials - “interactive” - to prompt for interactive login - “cache” - to use shared token cache credentials Default is [“env”, “msi”, “vscode”, “cli”, “powershell”, “interactive”]

  • tenant_id (str, optional) – The tenant to authenticate against. If not supplied, the default tenant for the identity will be used.

  • silent (bool, optional) – Set True to hide all output during connection, by default False

Returns

Named tuple of: - legacy (ADAL) credentials - modern (MSAL) credentials

Return type

AzCredentials

Raises

CloudError – If chained token credential creation fails.

msticpy.auth.azure_auth.az_user_connect(tenant_id: Optional[str] = None, silent: bool = False) AzCredentials

Authenticate to the SDK using user based authentication methods, Azure CLI or interactive logon.

Parameters
  • tenant_id (str, optional) – The tenant to authenticate against. If not supplied, the default tenant for the identity will be used.

  • silent (bool, optional) – Whether you want the auth process to display any output, by default False

Return type

AzCredentials

msticpy.auth.azure_auth.fallback_devicecode_creds(cloud: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs)

Authenticate using device code as a fallback method.

Parameters
  • cloud (str, optional) – What Azure cloud to connect to. By default it will attempt to use the cloud setting from config file. If this is not set it will default to Azure Public Cloud

  • tenant_id (str, optional) – The tenant to authenticate against. If not supplied, the tenant ID is read from configuration, or the default tenant for the identity.

Returns

Named tuple of: - legacy (ADAL) credentials - modern (MSAL) credentials

Return type

AzCredentials

Raises

CloudError – If chained token credential creation fails.