1

I have install azure cli plugins in jenkins after that i setup Azure Service Principal and got Successfully verified the Microsoft Azure Service Principal after that i create a new job and added az version to check az is installed or not in it and got failed error below is the screenshot of that error

Note:- My Jenkins is having v2.332.1 and installed in AKS Cluster as a Helm chat my jenkins is running

enter image description here

Here is the screenshot of plugin installed enter image description here

Here is the my job new create in freestylejob enter image description here

Please help out with this issue

Mohd Rashid
  • 101
  • 2
  • 9

1 Answers1

0

You need to install azure cli in the Jenkins Host as well.

from https://plugins.jenkins.io/azure-cli/ - Prerequisites

To use this plugin, first you need to have an Azure Service Principal in your Jenkins instance.

1.Create an Azure Service Principal through Azure CLI or Azure portal.

2.Open Jenkins dashboard, go to Credentials, add a new Microsoft Azure Service Principal with the credential information you just created.

3.Install Azure CLI in the Jenkins Host

from your description, I can see you have 1,2 steps completed and possibly 3 is missing.

Vineesh Vijayan
  • 570
  • 4
  • 15
  • Where is Jenkins Host i dont know it and i have one cluster in azure in that i have install jenkins – Mohd Rashid Apr 06 '22 at 07:03
  • The Container instance where you installed your Jenkins. Can you share , how did you install jenkins, May be share your helm spec. There is a provision in Helm to run commands post install . There you can install azure cli . – Vineesh Vijayan Apr 06 '22 at 09:06
  • i have install Jenkins using through this link https://bitnami.com/stack/jenkins/helm and i have create new cluster in azure in that i install Jenkins using helm..after that i browser the Jenkins start using it...i install plugin of azure-cli then setup azure service principal after that i create a new job using freestyle in that i select azure service principal after that i selected command i added az version to check whether its install or not got failed with above error on my question – Mohd Rashid Apr 06 '22 at 10:47
  • i login into pod of jenkins its not install az in pod ..im using apt update and then install azure-cli none work into pod – Mohd Rashid Apr 06 '22 at 10:58
  • login to the machine and try this curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash . More details on how to install az cli can be found here : https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt – Vineesh Vijayan Apr 06 '22 at 11:47
  • getting error "I have no name!@my-release-jenkins-6b5cc48f49-6926p:/$ curl -sL aka.ms/InstallAzureCLIDeb | bash Reading package lists... Done E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)" – Mohd Rashid Apr 06 '22 at 14:02
  • This is because , you do not have permission. Mostly you will be using a non root container image. Refer here and see if that helps : https://stackoverflow.com/questions/56579468/list-directory-var-lib-apt-lists-partial-is-missing-acquire-20-not-a-direc – Vineesh Vijayan Apr 06 '22 at 15:02
  • above one is for docker i need in Kubernetes pod to how to do that – Mohd Rashid Apr 07 '22 at 10:49
  • https://stackoverflow.com/questions/42793382/exec-commands-on-kubernetes-pods-with-root-access – Vineesh Vijayan Apr 07 '22 at 10:53
  • im getting struck o root ID because when i login into nodes i run docker ps or docker images its return docker not found and i cannot ssh after that because of root ID issue – Mohd Rashid Apr 08 '22 at 07:13
  • are there any different and easy method to install azure cli in jenkins host..or can i install jenkins with different method like not through helm chart – Mohd Rashid Apr 08 '22 at 07:14
  • https://jenkins-x.io/docs/install-setup/ – Vineesh Vijayan Apr 08 '22 at 07:30
  • https://cloudblogs.microsoft.com/opensource/2019/03/06/jenkins-x-azure-kubernetes-service-setup/ – Vineesh Vijayan Apr 08 '22 at 07:30