Assign a Variable to Shell inline script of Azure release

1.2k Views Asked by At

I have an inline script where one of the command is the below one. How can i Replace LINUX_PASSWD with a variable in Azure release.

I have added LINUX_PASSWD and FILENAME as variable in Azure release pipeline but they are empty after release

sed -i 's/password/$(LINUX_PASSWD)/g' FILENAME

1

There are 1 best solutions below

0
On BEST ANSWER

If you want to replace your variables with their values, use $(varable_name) template. In your case:

sed -i 's/password/$(LINUX_PASSWD)/g' $(FILENAME)

Check the documentation: Understand variable syntax, Using custom variables

To use custom variables in your build and release tasks, simply enclose the variable name in parentheses and precede it with a $ character. For example, if you have a variable named adminUserName, you can insert the current value of that variable into a parameter of a task as $(adminUserName).