add_azure_account_1.py 704 B

123456789101112
  1. def create_azure_account(env, admin_api_key, account_name, azure_ad_id, azure_app_id, azure_api_access_key, azure_subscription_id):
  2. """
  3. Creates an Azure Account in CloudCheckr. It will populate it with azure subscription credentials that were provided.
  4. """
  5. api_url = env + "/api/account.json/add_azure_inventory_account"
  6. add_azure_account_info = json.dumps({"account_name": account_name, "azure_ad_id": azure_ad_id, "azure_app_id": azure_app_id, "azure_api_access_key": azure_api_access_key, "azure_subscription_id": azure_subscription_id})
  7. r7 = requests.post(api_url, headers = {"Content-Type": "application/json", "access_key": admin_api_key}, data = add_azure_account_info)
  8. print(r7.json())