Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
585 stars 112 forks source link

swa login with Azure CLI requires double login #859

Open adrianhall opened 2 weeks ago

adrianhall commented 2 weeks ago

Describe the bug

To Reproduce

npm init -y
npm install -D @azure/static-web-apps-cli
az login
npx swa login

The swa login should not be needed if doing az login.

If you leave out the az login, then swa login will prompt for login TWICE.

Expected behavior

tslavik commented 1 week ago

In case of deployment, would be also good to support managed identity... just like this swa login --tenant-id 00000000-0000-0000-0000-000000000000 --client-id 00000000-0000-0000-0000-000000000000 --subscription-id mysubscriptionid and ideally if you are already logged through AZ Login with managed identity in the GH workflow

adrianhall commented 1 week ago

I think you will be able to do managed identity through using the Azure CLI login that was fixed in #774 (also will be in the 2.0.0 release).

Timothyw0 commented 1 week ago

Verified that this is a valid issue even with the latest merge in #774.

After performing az login, swa login will not prompt for login again but will ask the user to select a tenant and subscription which should have already been done in the az login stage. I am checking on how we can obtain the previously selected tenant and subscription to set as a default so the user can just hit "Enter" rather than sifting through all of the available tenants and subs.