-1

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

2
  • Can you change the example to a different ENV VAR than *_PASSWD? If you do I'll upvote. Commented May 18, 2023 at 19:09
  • The task I'm working on now might make a better example: the fully qualified domain name and replacing that in kubernetes Ingress YAML file. Commented May 18, 2023 at 19:10

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.