def get_latest_playbook_run(
    access_token, subscription_id, resource_group, playbook_name
):
    """
    This function retrieves the latest playbook run in Azure
    Logic Apps. It makes a request to the Azure Management API, parses the
    response, and returns the JSON object containing details of the latest run.

    Parameters:
        - access_token (str): Azure access token for authentication
        - subscription_id (str): Azure subscription ID
        - resource_group (str): Azure resource group containing the playbook
        - playbook_name (str): Name of the playbook in the Logic App

    Returns:
        - dict: A JSON object containing details of the latest playbook run,
            or None if an error occurs
    """

    headers = {
        "Authorization": "Bearer " + access_token,
        "Content-Type": "application/json",
    }
    url = (
        "https://management.azure.com/subscriptions/{}/resourceGroups/{}/"
        "providers/Microsoft.Logic/workflows/{}/runs?api-version=2016-06-01"
        "&$top=1"
    ).format(subscription_id, resource_group, playbook_name)

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(
            f"An error occurred while retrieving the playbook run status: {e}"
        )
        return None

    This function retrieves the latest playbook run in Azure
    Logic Apps. It makes a request to the Azure Management API, parses the
    response, and returns the JSON object containing details of the latest run.

    Parameters:
        - access_token (str): Azure access token for authentication
        - subscription_id (str): Azure subscription ID
        - resource_group (str): Azure resource group containing the playbook
        - playbook_name (str): Name of the playbook in the Logic App

    Returns:
        - dict: A JSON object containing details of the latest playbook run,
            or None if an error occurs
    
Solutions/CohesitySecurity/Tests/az.py