I tried executing a command that takes a file path, like
az group deployment validate --template-file template.json --parameters @parameters.json
But I kept getting
{
"stderr": "ERROR: [Errno 2] No such file or directory: 'template.json'\r\n",
"stdout": ""
}
I was somewhat surprised when I ran dir from the editor, that it returned the contents of ~\AppData\Local\Programs\Microsoft VS Code (this is Windows obv).
Do I always have to provide a full path to a file, or is there a way to make a relative path work?
Then, as a workaround, I ran the above command in the terminal (which is Powershell) after ensuring it was in the right directory, and got a different error related to the @ sign required by the --parameters option:
The splatting operator '@' cannot be used to reference variables in an expression. '@parameters' can be used only as an argument to a command. To reference variables in an expression use '$parameters'.
I was able to get around this by quoting the value, so I guess YMMV from one shell to another. Which is a little disappointing from a cross-platform perspective but not really your problem.
So to sum up, in order to run an az command that takes a file, it seems like currently I either have to provide a full path, or:
open the terminal and ensure I'm in the correct directory
if Powershell, make sure any values starting with @ are quoted
I tried executing a command that takes a file path, like
But I kept getting
I was somewhat surprised when I ran
dir
from the editor, that it returned the contents of~\AppData\Local\Programs\Microsoft VS Code
(this is Windows obv).Do I always have to provide a full path to a file, or is there a way to make a relative path work?
Then, as a workaround, I ran the above command in the terminal (which is Powershell) after ensuring it was in the right directory, and got a different error related to the
@
sign required by the--parameters
option:I was able to get around this by quoting the value, so I guess YMMV from one shell to another. Which is a little disappointing from a cross-platform perspective but not really your problem.
So to sum up, in order to run an
az
command that takes a file, it seems like currently I either have to provide a full path, or:@
are quoted