Can we define parameters in the azure pipeline yaml file and use those parameter values in workflow.json for Logic apps in VS Code?
Or, is it possible to define value in azure pipeline yaml file that goes and sits into appsettings which I guess should be a once time activity
Please provide a way where I can set a value to appsettings from Visual Studio code
I have a requirement where this has to be done from Visual Studio Code
2
Answers
The Microsoft approach is to have a secondary parameters file for each environment deployment.
Unfortunately for you, there’s no example of that in the Azure DecOps samples …
https://github.com/Azure/logicapps/tree/master/azure-devops-sample/.pipelines
… but there is in the GitHub samples …
https://github.com/Azure/logicapps/blob/master/github-sample/.github/workflows/logicapp_deploy.yml
… look at the final step called
Swap parameter files
.That’s the approach you need to take.
Alternatively, point all of your parameters to
appsettings.json
and you can manage it that way.You can use the following approach:
Instead of using actual values in your files e.g. in the app settings JSON, use placeholders like this:
Set variables with same names as the placeholders (without the __ prefix and suffix) in your YAML pipeline e.g.
variables:
value: ‘First variable value’
value: ‘Second variable value’
Use the Replace tokens task (
qetza.replacetokens.replacetokens-task.replacetokens@6
) in your YAML pipeline to replace the placeholders in your files with the actual values of YAML variables. It will transform your file like this:Bingo – you’ve just "defined values in the azure pipeline YAML file that went directly into appsettings".
The same approach can be used with any text files.