Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Not able to fetch Azure Artifacts using Service Pricipal #24329

Open owaiskhanafridi opened 1 year ago

owaiskhanafridi commented 1 year ago

I am trying to fetch Azure Artifacts through Service Principal in PowerShell but not able to do it. Reproduction step:

az login --service-principal --username "" -p="" --tenant "" Above command works fine and returns the following output: image

Then I ran the following command to download the artifacts:

az artifacts universal download --organization "" --project "" --scope project --feed "" --name "" --version "" --path .

Error: image

I am able to download the artifacts when I simply run az login, then pass the authentication through browser and then run the az artifact download command. But I want to automate this process through code so I need to login programmatically.

Please let me know what can I do? I have already spent a lot of days for this issue. Thanks

ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

yonzhan commented 1 year ago

route to CXP team

PramodValavala-MSFT commented 1 year ago

@owaiskhanafridi According to the docs, az login using service principal isn't supported for devops login and you would still have to use a PAT (Personal Access Token) with az devops login to get Azure DevOps commands to work.

owaiskhanafridi commented 1 year ago

Thanks for responding Pramod. When I try az devops login into my powershell (on admin mode), it keeps on running the command and never ends the process. I see on the docs that it is supposed to ask for token but it does not.

image

PramodValavala-MSFT commented 1 year ago

@owaiskhanafridi Could you run the command with the --debug flag and share that output?

owaiskhanafridi commented 1 year ago

Sure image