Azure DevOps: How to pass a parameter from a build to a release?
In case anyone ever finds this question: I didn't find a satisfying answer. My workaround was to write my variables to a text file in the build and then publish it, download it in the deployment and publish the values as output variables to a bash task. Looks something like this:
source file_containing_your_vars.txt
echo &quot;##vso[task.setvariable variable=var1;isoutput=true]$var1&quot;

the output variables parameters of this bash would need some reference name, for example job_out and you would then be able to reference the variables from other jobs in that stage like this:
variables['job_out.var1']

If you are running a yaml deployment pipeline (instead of one made in the portal) you can even use job output variable between stages.
For portal pipelines that want to share variables between stages this exists and seems to have helped some people but I didn't get it to work:
https://stackoverflow.com/questions/53042605/how-to-modify-azure-devops-release-definition-variable-from-a-release-task/53060141#53060141