code: def _get_default_azure_credential(
      *,
      managed_identity_client_id: str | None = None,
      workload_identity_tenant_id: str | None = None,
      use_async: bool = False,
  ) -> DefaultAzureCredential | AsyncDefaultAzureCredential:
      """Get DefaultAzureCredential based on provided arguments.
  
      If managed_identity_client_id and workload_identity_tenant_id are provided, this function returns
      DefaultAzureCredential with managed identity.
      """
      credential_cls: type[AsyncDefaultAzureCredential] | type[
          DefaultAzureCredential
      ] = (
          AsyncDefaultAzureCredential
          if use_async
          else DefaultAzureCredential
      )
      if managed_identity_client_id and workload_identity_tenant_id:
          return credential_cls(
              managed_identity_client_id=managed_identity_client_id,
              workload_identity_tenant_id=workload_identity_tenant_id,
              additionally_allowed_tenants=[
                  workload_identity_tenant_id
              ],
          )
      else:
          return credential_cls()
  
file_path: airflow/airflow/providers/microsoft/azure/utils.py
imports: from __future__ import annotations
  import warnings
  from functools import partial, wraps
  from azure.core.pipeline import PipelineContext, PipelineRequest
  from azure.core.pipeline.policies import BearerTokenCredentialPolicy
  from azure.core.pipeline.transport import HttpRequest
  from azure.identity import DefaultAzureCredential
  from azure.identity.aio import DefaultAzureCredential
  from msrest.authentication import BasicTokenAuthentication
label_desc: Use image node_id 2 for calling a global function with example usage: _get_default_azure_credential() and returns: credential_cls, credential_cls