Change Azure DevOps Variables from Within the Build

Koen van Zeijl
October 21, 2020 5 min read
Koen van Zeijl


In my previous blog 'Embed Your Instagram Feed in 2020', I found out that the Instagram API for fetching your feed was changed. What a bummer! So I found a way to fetch your Instagram feed (The subject of my next blog). Unfortunately, this requires you to use a token that is only valid for 60 days. You can request a new token in the Facebook portal but this has another downside. You’ll need to do a commit every 60 days to keep your feed working. This made me curious if it was possible to automatically fetch a new token during a build so that your feed stays alive.

A disadvantage of this method is that the token that is returned from the Facebook portal must be saved, as it must be used again to retrieve the next (new) token. After all, the currently valid token cannot be used to generate a new token after 60 days. I will do this by adding a variable to my Azure DevOps pipeline that I will update on every build that gets triggered.

In this blog, I’ll explain how you can adjust Azure DevOps pipeline variables from within the pipeline. To clarify my method, I‘ll use the Instagram example.

By the way, if you want to read more about home automation, I would like to refer you to my other site hope to see you there soon.