0

When you create an Azure Static Web-app you specify the GIT repository during configuration. GitHub and Azure Devops are the popular options.

I can't seem to find an option to change the repo once it's created.

I'm going to have this repository hooked up to several static web-apps using different custom domain names and suspect I may need to modify the webpages shown for each custom domain at some point in the future.

If that happens I could delete and re-create the web-app or use branching and modify the build config in the branch's YML file, but would probably prefer to spin up a new GIT Repo and point the web-app at that.

Is it possible?

Related question:

More info on Static Web Apps:

Anthony
  • 1,776
  • 17
  • 29

1 Answers1

1

You should be able to do it by following steps

If need to change repository

  1. Get the workflow yml file from the existing repo
  2. And add it to new. Add the secret to the new repo with the same key (secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_...) and the deployment token.
  3. Grab the Deployment token from the Azure static web app, Manage deployment token link.

Refer Below screen shot for deployment token

enter image description here

If need to change branch

you can just edit the branch in the yml file, e.g. azure-static-web-apps-xxx.yml

    on:
      push:
        branches:
          - main
      pull_request:
        types: [opened, synchronize, reopened, closed]
        branches:
          - main
[...]

Click on this For More Details

Pradeep Kumar
  • 1,193
  • 1
  • 9
  • 21
  • That works. I found it best to reset the deployment token on Azure then apply it to the new repo on GitHub (settings>secrets>actions) so only 1 repo targeted the web-app. I pushed changes via Git to update the live site and up they went. – Anthony Dec 01 '22 at 11:13