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

Support reusing credentials from azure/login action

Open rhuanbarreto opened this issue 2 years ago • 1 comments

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 avatar Sep 29 '23 11:09 rhuanbarreto

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

rhuanbarreto avatar Dec 29 '23 07:12 rhuanbarreto