Jump to content

Featured Replies

Posted

Azure Static Web App offers two types of preview environments: branch environment and named environment. Both of these methods offer isolated environments for testing and deploying changes to your Azure Static Web App, allowing you to test and validate changes without affecting the main production environment.

 

 

 

Here are the steps to create a preview environment:

 

 

 

1. After deploying the production branch to the main site, create a new branch based on the main branch and name it "dev".

 

782x340vv2.png.274b4be92a0919018c06121fb1284e73.png

 

724x556vv2.png.be7f40b184ba32e52728636087688475.png

 

 

 

2. Modify your YAML file in the dev branch to include "dev" in the trigger to track any changes in the dev branch.

 

773x396vv2.png.cefc879a45b00b1b8280a8a8376daf23.png

 

 

 

3. Set "production_branch" to the name of your production branch. This action will ensure the deploy task in the dev branch creates a new preview environment.

 

738x441vv2.png.36ff2d2c643a5de20fcfa360322700c7.png

 

 

 

4. Save the changes and after deployment, you can see a new environment named 'dev' for the dev branch.

 

813x305vv2.png.8025e4220499bfb3c314ae381cbd177a.png

 

 

 

5. If you want to name a preview environment separately (instead of using the branch name), set the "deployment_environment" to the desired name, and it will create a named environment.

 

813x447vv2.png.8e3a1a5026e8b2f370e612a55ca65c11.png

 

 

 

904x384vv2.png.45010353257929a355c329dc0d87c6a8.png

 

 

 

The main difference between branch and named environments is that branch environments are created automatically based on the branch name, whereas named environments are custom-named.

 

 

 

Overall, both branch and named environments provide isolated environments for testing and deploying changes to your Azure Static Web App, allowing you to test and validate changes without affecting the main production environment. The choice of environment type typically depends on the specific needs and development process of your project.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...