# Configure a Webhook in Microsoft Azure

In Azure, a webhook is a trigger mechanism used to invoke background tasks such as:

* Runbooks in Azure Automation
* Web jobs in Web Apps or Service Fabric
* Serverless tasks via Azure Functions

A common use case involves triggering runbooks in [Azure Automation](https://knowledgebase.autorabit.com/product-guides/arm/integration-and-plugins/azure-devops). These runbooks can be started externally using HTTP POST requests to a webhook URI generated by Azure.

**Example:**\
A developer’s app running on Azure or any internet-enabled platform can POST to the webhook URI, initiating an automation runbook in Azure.

***

{% hint style="info" %}
After the 25.3.9 release, the structure of the webhook payload URL was updated. Customers need to update the webhook URL in the repository settings of their remote repo. Some customers are still using the old webhook URL containing **autorabitrest**, which should now be replaced with api.

Example:

Old URL: [https://na25.autorabit.com/**autorabitrest/**&#x77;ebhook/triggerSCMPushrequest](https://na25.autorabit.com/autorabitrest/webhook/triggerSCMPushrequest)

Updated URL: [https://na25.autorabit.com/api/webhook/v2/\<OrgName>/trigger-scm-push-request](https://na25.autorabit.com/api/webhook/v2/%3COrgName%3E/trigger-scm-push-request)

Unless you update the Payload URL, you might face pull request/trigger build-on-commit jobs triggering.
{% endhint %}

## Create a Webhook API Token from ARM

1. Log into ARM.
2. Navigate to **Admin Section > API Token**.
3. Click **Create API Token**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FujwKHQzfJpctiYWUpMBd%2Fimage.png?alt=media&#x26;token=d8385c54-8f05-4601-87c6-5ad8449ed48f" alt=""><figcaption></figcaption></figure>

4. Enter a **Token Name**.
5. Select **Type** as **webhook**.
6. (Optional) Add a **Description**.
7. Click **Create Option**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FeS2B7NitmMcgA7L4lSgm%2Fimage.png?alt=media&#x26;token=e3932e18-30b9-4fac-85bf-ede332387307" alt=""><figcaption></figcaption></figure>

8. Your webhook API token is now created.

***

### Create Webhook with Authentication on Azure

1. Sign in to <https://portal.azure.com/>.
2. Open the Service Hooks page of your project:

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FrS3dynPR9jKnnEqO5m5n%2Fimage.png?alt=media&#x26;token=da801a2e-5f66-43cc-b595-188a546f2124" alt=""><figcaption></figcaption></figure>

3. Click **Create Subscription**.
4. In the wizard, select the target service for integration.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F9Gj0F7Di0vuElozBjykc%2Fimage.png?alt=media&#x26;token=4b2872a9-df9b-4601-bb5d-a0e0f2bcca3f" alt=""><figcaption></figcaption></figure>

5. Click **Next** to select an event trigger and configure filters if needed.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F7Oznq8LdIHeWJt8gQuM5%2Fimage.png?alt=media&#x26;token=cc33451d-b911-480a-8394-311778ef4737" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FCxq4UVxplQV65IfaGqz1%2Fimage.png?alt=media&#x26;token=48e57169-580c-49be-b440-158211a3627c" alt=""><figcaption></figcaption></figure>

6. Enter the **Payload URL**:

Example:\
<https://login.autorabit.com/api/webhook/v2/autorabit.com/trigger-scm-push-request>

7. Configure **Basic Authentication**:

* **Username:** ARM login username
* **Password:** Webhook API token generated in ARM

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FFxD30tXWUraY71Y6xrDQ%2Fimage.png?alt=media&#x26;token=988e29a7-541f-4f6a-8d96-e8c4cf56c2e2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** To trigger webhooks for events like *Pull Request Created* or *Pull Request Updated*, use the same URL and authentication method described above.
{% endhint %}

8. Review and test the configuration, then complete the wizard.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F3zr9bRZdudcl5XLKr5yG%2Fimage.png?alt=media&#x26;token=c44ffb12-5273-445f-ad57-70aa6acadcef" alt=""><figcaption></figcaption></figure>

9. Click **Finish**. The configured webhook will appear under **Service Hooks**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FVYLFXGOUAkFVlyWAhjcR%2Fimage.png?alt=media&#x26;token=794b2811-8ca7-4c20-b3d5-39e3171ee8ce" alt=""><figcaption></figcaption></figure>

10. After the webhook triggers a build and it completes, refresh the **Service Hooks** tab to confirm success. Review webhook history for trigger count and success/failure status.

***

## For Enterprise Customers

Use the following endpoints: /api/webhook/v2//enterprise/trigger-scm-push-request /api/webhook/v2//enterprise/sync-alm-commits
