code: def get_aad_token(endpoint, no_verify):
      #pylint: disable-msg=too-many-locals
      
      from azure.servicefabric.service_fabric_client_ap_is import (
          ServiceFabricClientAPIs
      )
      from sfctl.auth import ClientCertAuthentication
      from sfctl.config import set_aad_metadata
  
      auth = ClientCertAuthentication(None, None, no_verify)
  
      client = ServiceFabricClientAPIs(auth, base_url=endpoint)
      aad_metadata = client.get_aad_metadata()
  
      if aad_metadata.type != "aad":
          raise CLIError("Not AAD cluster")
  
      aad_resource = aad_metadata.metadata
  
      tenant_id = aad_resource.tenant
      authority_uri = aad_resource.login + '/' + tenant_id
      context = adal.AuthenticationContext(authority_uri,
                                           api_version=None)
      cluster_id = aad_resource.cluster
      client_id = aad_resource.client
  
      set_aad_metadata(authority_uri, cluster_id, client_id)
  
      code = context.acquire_user_code(cluster_id, client_id)
      print(code['message'])
      token = context.acquire_token_with_device_code(
          cluster_id, code, client_id)
      print("Succeed!")
      return token, context.cache
docs: Get AAD token