msticpy.auth.cred_wrapper module

Credential wrapper to expose ADAL and MSAL credentials.

class msticpy.auth.cred_wrapper.CredentialWrapper(*args: Any, **kwargs: Any)

Bases: BasicTokenAuthentication

Class for handling legacy auth conversion.

Wrap azure-identity credential to work with SDK that needs ADAL.

Parameters:
  • credential (Any, optional) – Any azure-identity credential, by default DefaultAzureCredential

  • resource_id (str, optional) – The scope used to get the token, by default “https://management.azure.com/.default

set_token()

Ask the azure-core BearerTokenCredentialPolicy policy to get a token.

Using the policy gives us for free the caching system of azure-core. We could make this code simpler by using private method, but by definition I can’t assure they will be there forever, so mocking a fake call to the policy to extract the token, using 100% public API.

signed_session(session=None)

Wrap signed session object.