question

OriPoria-8477 avatar image
0 Votes"
OriPoria-8477 asked AndreasBaumgarten edited

azure vm run command script

I try to run the simple command of 'az version' from a VM with the Run Command Script but I get this error: "The term 'az' is not recognized as the name of a cmdlet...".

But when I run this command from the VM that I connect it with Remote Desktop Connection it works.

What should I do in order to operate 'az' commands from the Run Command Script?

azure-virtual-machines
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered

Hi @OriPoria-8477 ,

you are right. My fault sorry. It's the path that is missing to run Azure CLI ;-)

Here you go:

 Write-Output "First option"
 $env:Path += ";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
 az version
    
 Write-Output "Second option"
 & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" version

141425-image.png


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten



image.png (78.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered OriPoria-8477 commented

Hi @OriPoria-8477 ,

az is an Azure CLI command. Is AZ CLI installed on the VM?


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

if I success to run 'az veriosn' on the VM, I think it means that it is installed, isn't it?
The problem is that from the Run Command Script it doesn't work

0 Votes 0 ·