code: def azure_service_principal() -> Optional[TypeDict[str, str]]:
      sp_json = {}
      if not os.path.exists(AZURE_SERVICE_PRINCIPAL_PATH):
          raise AzureException(
              "No service principal so we need to create one first"
          )
      with open(AZURE_SERVICE_PRINCIPAL_PATH) as f:
          sp_json = json.loads(f.read())
  
      required_keys = [
          "appId",
          "displayName",
          "name",
          "password",
          "tenant",
      ]
      for key in required_keys:
          if key not in sp_json:
              raise AzureException(
                  f"{key} missing from {AZURE_SERVICE_PRINCIPAL_PATH}"
              )
      return sp_json
  
file_path: PySyft/packages/hagrid/hagrid/azure.py
imports: import json
  import os
  import subprocess
  from typing import Dict
  from typing import Optional
  from azure.identity import ClientSecretCredential
  from azure.mgmt.resource import ResourceManagementClient
  from .file import user_hagrid_profile
label_desc: Use image node_id 3 for calling a global function with example usage: azure_service_principal() and returns: sp_json