def update_job_schema()

in modules/azure-identity/azure-id-lifecycle/scripts/azad_sync_job_schema_modify.py [0:0]


def update_job_schema(service_principal_id, job_id, headers, payload):
    job_schema_url = "https://graph.microsoft.com/v1.0/servicePrincipals/{}/synchronization/jobs/{}/schema".format(
        service_principal_id, job_id)
    try:
        update_response = requests.put(job_schema_url, json=payload, headers=headers)
        update_response.raise_for_status()
        if update_response.status_code == 204:
            print('schema updated successfully')
        else:
            print('schema updated failed with code: ', update_response.status_code, ' \nerror body: ',
                  update_response.content)
    except requests.exceptions.HTTPError as e:
        print(e.args[0])