az_account_show()
The Azure CLI’s current account, from az account show --output json.
Usage
az_account_show(timeout=_TIMEOUT)Parameters
timeout: float | None = _TIMEOUT-
Seconds to wait for
az;Nonewaits as long as it takes.
Returns
dict-
The account as
azprints it:id(the subscription),name,tenantId,user(withnameandtype) and the rest.
Raises
AzCliNotLoggedInError-
The CLI is not logged in.
AzCliNotFoundError-
There is no
azon PATH. AzCliTimeoutError-
azdid not finish withintimeoutseconds. AzCliError-
Any other failure, with what
azwrote to stderr.
Notes
Runs the az that shutil.which("az") finds, as a plain subprocess (ported from azr’s az_cli_*() helpers). For tokens from the CLI, use azure.identity.AzureCliCredential, which dazapiz does not wrap.
Examples
from dazapiz import az_account_show
account = az_account_show()
account["user"]["name"], account["tenantId"]