Azure Registry Trigger

Learn how to trigger Codefresh pipelines from Azure Registry events

It is possible to define and manage Azure Registrypipeline triggers with the Codefresh UI.

This allows you to trigger Codefresh pipelines when an Azure Registy event happens (e.g. a new Docker image is uploaded).

Manage Azure Triggers with Codefresh UI

The process involves two parts

  1. Creating a trigger in Codefresh. This will result in a special Codefresh webhook URL
  2. Creating a new notification in the Azure Registry that will use this URL to call Codefresh

Make sure that you have an Azure cloud account and have already created a registry.

Create a new Azure Trigger

To add a new Azure trigger, navigate to a Codefresh Pipeline Configuration view and expand the Triggers section. Press the Add Trigger button and select a Registry trigger type to add.

Adding new Trigger dialog

Fill the following information:

  • Registry Provider - select Azure
  • Namespace - put Azure name of registry (without .azurecr.io)
  • Name - Azure image repository name
  • Action - select Push Image action
  • Filter - optional filter to specify which image tags will trigger pipeline execution: Re2 regular expression

Azure Registry settings

Click next and a new Dialog will appear that shows you the Codefresh webhook URL. Copy it to your clipboard.

Codefresh webhook URL

Now we must set Azure to call this URL when an event takes place.

Setup Azure Notification

The easiest way to create an Azure trigger is with the Azure CLI (Also available in the Azure portal)

Here is the command

az acr webhook create -n MyWebhook -r kostisregistry --uri "https://g.codefresh.io/nomios/azure?account=409f15bdd444&secret=7zyg5Zhb8xYBn4ms" --actions push delete

The name can be anything you want. The URI is the Codefresh URL that was created in the previous step.

Triggering a Codefresh pipeline with Azure push

Now, every time you push a new Docker image to the selected Azure Docker repository, manually, with Codefresh or any other CI/CD tool, Codefresh will trigger execution of all pipelines associated with that Azure Push trigger event.