ERROR: Please run ‘az login’ to setup account

Hello Team,

I’m getting the below error while creating resources in Azure using terraform with Jenkins Pipeline

Error building ARM Config: obtain subscription() from Azure CLI: parsing json result from the Azure CLI: waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account.

The Azure_Credentials variable under Jenkins credentials shows me as successfully verified.

I’m able to run Terraform Init and Plan locally on RHEL 9 Box.

Kindly Help,

Rahul

Hi Rahul,

not sure that I will be of any help but I add the same problem here and solved it by using the same agent for the sh steps :
https://github.com/jenkins-infra/kubernetes-management/blob/06862f5b12f26e3e26383b5f45c6f225deaf599c/Jenkinsfile_updatecli#L36-L39

(for us the updatecli process was dealt with by a shared library that was spawning a new agent … so the az login was kind of lost)

Good luck,
Stéphane

1 Like