I cannot run Azure CLI commands from jenkins pipeline

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

I cannot run Azure CLI commands from jenkins pipeline

jesus fernandez
I am trying to run some az commands from a Jenkins pipeline which (running in Windows 10) I already used in my laptop´s Jenkins, but when trying to use it on another computer (also running w10) I get this error : 
```
11:12:47  powershell.exe : az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3 char:1
11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
11:12:47  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:12:47      + CategoryInfo          : NotSpecified: (az : The term '...ram. Check the :String) [], RemoteException
11:12:47      + FullyQualifiedErrorId : NativeCommandError
11:12:47   
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3 char:25
11:12:47  +                         az devops configure --defaults organization=h ...
11:12:47  +                         ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
11:12:47   
11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4 char:35
11:12:47  +                         $output = az boards work-item show --id=89609 ...
11:12:47  +                                   ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
```
However running any command from the cmd / powershell works fine. I have set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any hint of what is going wrong

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5b733163-a0c1-40c5-b747-2ba12bd09f2en%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: I cannot run Azure CLI commands from jenkins pipeline

Martin Schmude
Maybe az has not been installed on the system where the job is executed.
Or az is not part of the PATH variable in the context of the job execution.
Let the job execute "echo $env:path" before any "az ..." commands, so that it prints out its path environment variable.

[hidden email] schrieb am Dienstag, 6. April 2021 um 13:21:16 UTC+2:
I am trying to run some az commands from a Jenkins pipeline which (running in Windows 10) I already used in my laptop´s Jenkins, but when trying to use it on another computer (also running w10) I get this error : 
```
11:12:47  powershell.exe : az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3 char:1
11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
11:12:47  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:12:47      + CategoryInfo          : NotSpecified: (az : The term '...ram. Check the :String) [], RemoteException
11:12:47      + FullyQualifiedErrorId : NativeCommandError
11:12:47   
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3 char:25
11:12:47  +                         az devops configure --defaults organization=h ...
11:12:47  +                         ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
11:12:47   
11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4 char:35
11:12:47  +                         $output = az boards work-item show --id=89609 ...
11:12:47  +                                   ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
```
However running any command from the cmd / powershell works fine. I have set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any hint of what is going wrong

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c0d50cf9-303a-4c81-b735-d5989714336cn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: I cannot run Azure CLI commands from jenkins pipeline

jesus fernandez
az is installed as it runs from the cmd, and it also runs if I start jenkins from a non administrator prompt, it just do not work when starting Jenkins from a admin prompt (which I need to)

El martes, 6 de abril de 2021 a las 21:22:06 UTC+2, Martin Schmude escribió:
Maybe az has not been installed on the system where the job is executed.
Or az is not part of the PATH variable in the context of the job execution.
Let the job execute "echo $env:path" before any "az ..." commands, so that it prints out its path environment variable.

[hidden email] schrieb am Dienstag, 6. April 2021 um 13:21:16 UTC+2:
I am trying to run some az commands from a Jenkins pipeline which (running in Windows 10) I already used in my laptop´s Jenkins, but when trying to use it on another computer (also running w10) I get this error : 
```
11:12:47  powershell.exe : az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3 char:1
11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
11:12:47  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:12:47      + CategoryInfo          : NotSpecified: (az : The term '...ram. Check the :String) [], RemoteException
11:12:47      + FullyQualifiedErrorId : NativeCommandError
11:12:47   
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3 char:25
11:12:47  +                         az devops configure --defaults organization=h ...
11:12:47  +                         ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
11:12:47   
11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4 char:35
11:12:47  +                         $output = az boards work-item show --id=89609 ...
11:12:47  +                                   ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
```
However running any command from the cmd / powershell works fine. I have set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any hint of what is going wrong

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/63896e4c-2dd0-42b6-8778-5ad554637512n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: I cannot run Azure CLI commands from jenkins pipeline

jesus fernandez
it happened to be an issue with the path, as jenkins uses its own path for its user I have not declared the path for the right user

El miércoles, 7 de abril de 2021 a las 9:24:44 UTC+2, jesus fernandez escribió:
az is installed as it runs from the cmd, and it also runs if I start jenkins from a non administrator prompt, it just do not work when starting Jenkins from a admin prompt (which I need to)

El martes, 6 de abril de 2021 a las 21:22:06 UTC+2, Martin Schmude escribió:
Maybe az has not been installed on the system where the job is executed.
Or az is not part of the PATH variable in the context of the job execution.
Let the job execute "echo $env:path" before any "az ..." commands, so that it prints out its path environment variable.

[hidden email] schrieb am Dienstag, 6. April 2021 um 13:21:16 UTC+2:
I am trying to run some az commands from a Jenkins pipeline which (running in Windows 10) I already used in my laptop´s Jenkins, but when trying to use it on another computer (also running w10) I get this error : 
```
11:12:47  powershell.exe : az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3 char:1
11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
11:12:47  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:12:47      + CategoryInfo          : NotSpecified: (az : The term '...ram. Check the :String) [], RemoteException
11:12:47      + FullyQualifiedErrorId : NativeCommandError
11:12:47   
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3 char:25
11:12:47  +                         az devops configure --defaults organization=h ...
11:12:47  +                         ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
11:12:47   
11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
11:12:47  spelling of the name, or if a path was included, verify that the path is correct and try again.
11:12:47  At C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4 char:35
11:12:47  +                         $output = az boards work-item show --id=89609 ...
11:12:47  +                                   ~~
11:12:47      + CategoryInfo          : ObjectNotFound: (az:String) [], CommandNotFoundException
11:12:47      + FullyQualifiedErrorId : CommandNotFoundException
```
However running any command from the cmd / powershell works fine. I have set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any hint of what is going wrong

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5bcb14dd-b50c-4fe8-a8af-967fb502720an%40googlegroups.com.