Closed andreacassioli closed 6 years ago
bump....
@andreacassioli - Sorry about the delayed response. The Azure CLI task logs-in automatically using the service principal specified in selected the Service Connection. So you don't need to login again. The above error is expected since you have specified 'az login' without specifying the credentials (say service principal id & key).
Can you try running some other az cli command such as 'az account show'?
If it still fails, can you provide the following details?
I think I have not been clear: the log you see is the Azure CLI log (you see that it actually log in and show details.
Then the task calls my inline bash script
2018-10-22T19:27:49.3932706Z [command]/bin/bash /tmp/azureclitaskscript1540236450401.sh
That script does not call az login but other commands: at that point I am asked to login again!
@andreacassioli Looking at the logs, the task did actually authenticate successfully
2018-10-22T19:27:38.4487224Z [command]/usr/bin/az login --service-principal -u -p --tenant 2018-10-22T19:27:48.6830164Z [ 2018-10-22T19:27:48.6831124Z { 2018-10-22T19:27:48.6831646Z "cloudName": "AzureCloud", 2018-10-22T19:27:48.6835021Z "id": "e44f8ea3-f70b-4734-877a-504f2ee64f14", 2018-10-22T19:27:48.6835685Z "isDefault": true, 2018-10-22T19:27:48.6836410Z "name": "Maersk Line Self-Managed DynamicNet 01 ARM", 2018-10-22T19:27:48.6838316Z "state": "Enabled", 2018-10-22T19:27:48.6839132Z "tenantId": "", 2018-10-22T19:27:48.6839783Z "user": { 2018-10-22T19:27:48.6840373Z "name": "***", 2018-10-22T19:27:48.6840981Z "type": "servicePrincipal" 2018-10-22T19:27:48.6841381Z } 2018-10-22T19:27:48.6841732Z } 2018-10-22T19:27:48.6842001Z ]
can you paste the logs for the case when your script did not contains az login
and task failed to authenticate.
Hi, thank you for the reply. Digging more into the issue, it turned out to be an issue related with the command I am trying to run in the Azure CLI. It seems it does not support service principals!
So the tasks works fine, I have tried to run commands like az account show
and had no issue.
Thanks again!
I am using AzureDevOps in a cloud subscription. In a build pipeline I want to use a bash task that must use some az cli command.
In my understanding the Azure CLI task is supposed to authenticate using
az login
so that I can run commands for theaz
cli. Note that we have a service principal setup and all permissions are fine. A colleague of mine has set up similar tasks using power shell, and it works fine.Now, I want to use an inline script (basically I want to use make files). But to my surprise the the cli fails to authenticate, proposing me to login using
az login
.OK, If I include an
az login
, then the task gets stuck waiting for a browser to open! Here is the output:The script
only contains
az login
. My suspicion is that running bash does not propagate the whole environment and therefore the login is lost.Any help is appreciated.