Azure / static-web-apps-cli

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

Support reusing credentials from azure/login action #751

Closed rhuanbarreto closed 4 days ago

rhuanbarreto commented 9 months ago

Is your feature request related to a problem? Please describe.

I'm trying to use the SWA CLI in order to have more control over the the build and deployment of multiple environments in GitHub. So I'm not using the GitHub action. I normally use the federated login from Github in order to perform tasks in workflows and the azure/login action. Doing this, I don't need to setup client secrets. But this fails:

... Build steps ...
- name: Azure login
  uses: azure/login@v1
  with:
    client-id: ${{ vars.APP_CLIENT_ID }}
    tenant-id: ${{ vars.APP_TENANT_ID }}
    allow-no-subscriptions: true
- name: Deploy
  run: |
    npm i -g @azure/static-web-apps-cli
    swa deploy --no-use-keychain --config-name ${{matrix.environment}} --env Production

It gets stuck trying to open a browser and wait for a device code login. SWA CLI only accepts client secrets as an identity.

Describe the solution you'd like

I wanted the SWA CLI to reuse the credentials already set in the azure/login action so it doesn't need to use client secrets.

Describe alternatives you've considered

So far only alternative today is to use client secrets

Additional context

rhuanbarreto commented 6 months ago

Thanks for the PR @shibayan! Do you know if the team can accept the PR and put it on the CLI?