简体   繁体   中英

Error in Powershell Azure calls from Jenkins but not Powershell ISE?

I run the following in PowerShell ISE Connect-AzAccount and it works fine , but within Jenkins when run as a Powershell command I get the following error:

The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Why would this happen ?

Couple of things to try out:

  • You do not install AZ and Azure RM side by side , if you have it in the machine , please uninstall the Azure RM

  • Please try running the following command in order:

    Install-Module Az Import-Module Az Connect-AzAccount

Additional reference:

https://docs.microsoft.com/en-us/azure/jenkins/execute-cli-jenkins-pipeline

Using Azure CLI in Jenkins pipeline

https://wiki.jenkins.io/display/JENKINS/Azure+CLI+Plugin

Hope it helps.

Can your verify the powershell module installed in your Jenkins machine?

What exactly you're trying to do with this Azure connection request?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM