i am trying to run the below az run command but facing the error
command :
az vm run-command invoke --command-id RunPowerShellScript -g "XXXXXX" -n "XXXX" --scripts "winrm set winrm/config/service/auth '@{Kerberos="true"}'"
error:
i am trying to run the below az run command but facing the error
command :
az vm run-command invoke --command-id RunPowerShellScript -g "XXXXXX" -n "XXXX" --scripts "winrm set winrm/config/service/auth '@{Kerberos="true"}'"
error:
I understand you are trying to use RunPowerShellScript from azure CLI but it is failing.
I believe the issue is with the quotations inside your script. You can see Quoting issues with PowerShell page for more explicit info. I was able to run the command via Portal without issue.
You don't need to worry about escaping characters if running the script from a file.
Please give this a try to see if it works for you. Let me know if you are still running into issues.
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.
Hi @VedanthPulipati-4457 ! @deherman-MSFT is right that it is the quotes that is probably giving you issues. Both of his solutions should work, but if you need to have it in inline on your PowerShell, its the double-quotes (") specifically causing problems and you can escape them in PowerShell by doubling up on your double-quotes (""):
az vm run-command invoke --command-id RunPowerShellScript -g "XXXXXX" -n "XXXX" --scripts "winrm set winrm/config/service/auth '@{Kerberos=""true""}'"
41 people are following this question.