Azure Dev Ops Webhook Setup for Contentful
Trigger an Azure Dev Ops pipeline with a webhook from Contentful
It was a little bit of a pain to get Azure’s webhook system integrated with contentful. Hopefully this will help someone out in the future
Head over to your organization
in contentful. Once there go to Settings -> Webooks
and create a new webhook
For the URL, go to your build inside of Azure Dev Ops. Open it up until you get to this screen
Once at this screen copy the url, it should look something like this
https://dev.azure.com/**YOUR ORG/Your Project**/_apis/build/builds?definitionId=7
Paste that into the contentful URL
section and then append this at the end &api-version=6.1-preview.6
If done correctly, your URL
should look like https://dev.azure.com/**YOUR ORG/Your Project**/_apis/build/builds?definitionId=7&api-version=6.1-preview.6.
Next up we want a token. Go to this page to generate a PAT https://dev.azure.com/**Your Org**/_usersSettings/tokens.
Click on New Token
and fill out the form. Pick a memorable name, as for expiration you can set it to be infinite but thats not secure. I usually set my tokens for Contentful to expire every 90 days.
As for the Scope
, you want Build - Read and Execute
as options.
For Azure, we need to use basic authentication which requires a Base64 encoded string. The format is usually Basic user:password
. For azure there is no user, just a token. The format will be Basic :TOKEN
. You can use your encoder of choice, I use this online one here
https://www.base64encode.org
Go to that link, hit Encode
at the top, input this in the field - ":TOKEN"
, be sure to remove the "
. Copy this value to your clipboard
Scroll down to the Headers
section and add a Secret Header
. The Header
name will be Authorization
and the value will be Basic ENCODED_TOKEN
where ENCODED_TOKEN
is the string we copied to our clipboard from the step above
After this, select whichever triggers you want for this webhook and then you should be good to send triggers to start your pipeline