2

Please I am trying to pass a html string as value to the below powershell function "set-content" from azure cli but I don't think I am escaping the double quotes correctly. The value parameter only accepts strings, somehow, it does not get executed at the target machine with the double quote. I get the below error. please help!

az vm extension set --name CustomScriptExtension --vm-name MyWindowsVM -g TestsandRG --publisher Microsoft.Compute --settings '{"commandToExecute": "powershell set-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value \"<html><body><h2>Welcome to Azure! My name is $($env:computername) .<\/h2><\/body><\/html>\""}'

enter image description here

1

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.