Skip to main content

orbitra.commons.auth.azure

Functions

complete_device_code_login

complete_device_code_login(scope: str, environment: str = 'prod') -> AuthenticationRecord
Complete a two-step device code login previously started with :func:start_device_code_login. Args:
  • scope: The scope to authenticate for.
  • environment: The environment to authenticate against.
Returns:
  • The authentication record persisted on success.

get_azure_access_token

get_azure_access_token(scope: str, environment: str = 'prod') -> str
Get an access token for the given scope and environment. Args:
  • scope: The scope to get an access token for.
  • environment: The environment to get an access token for.
Returns:
  • An access token for the given scope and environment.

get_azure_credential

get_azure_credential(scope: str, environment: str = 'prod', use_device_code: Optional[bool] = None) -> TokenCredential
Get a credential for the given scope and environment. Args:
  • scope: The scope to get a credential for.
  • environment: The environment to get a credential for.
  • use_device_code: If True, use device code flow. If False, use interactive browser. If None, use env var.
Returns:
  • A credential for the given scope and environment.

start_device_code_login

start_device_code_login(scope: str, environment: str = 'prod') -> dict
Start a two-step device code login without blocking. Args:
  • scope: The scope to authenticate for.
  • environment: The environment to authenticate against.
Returns:
  • The MSAL device flow, including user_code, verification_uri and message.