static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

swa login with Azure CLI requires double login

Open adrianhall opened this issue 1 year ago • 1 comments

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

  • When using az login - no auth prompts
  • When not using az login - one auth prompt

adrianhall avatar Jul 01 '24 18:07 adrianhall

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

tslavik avatar Jul 04 '24 14:07 tslavik

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).

adrianhall avatar Jul 05 '24 16:07 adrianhall

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.

Timothyw0 avatar Jul 08 '24 16:07 Timothyw0