Chapter 6: Chaos Engineering
Activity 7: Chaos Experiment to Check the Resilience to Loss of a Function App
Delete the OrdersApi function in the portal and observe the issue on the orders.html page by submitting orders. The errors will become visible in the developer tools of your browser:
Create a backup OrdersApi.
Create a backup connection string on the orders.html file by using the JavaScript mentioned.
Navigate to the builds page in Azure DevOps. Click on the build definition you already have, click on the ellipses, and click Clone:
You will be taken to your new build pipeline. Click on Pipeline and change the Path to solution or packages.config field to point to the path of the OrdersApi function, Lesson6/Activity7/OrdersApi/*.csproj:
Click Save & queue and Save and Queue again. Click the build number to view the build progress:
Open the Releases page. Click the ellipses next to the existing release and click Clone:
You will be taken to your pipeline screen. Open the Production stage. Modify the –appName value in the template parameters field on the Azure Deployment task to advancedserverlessorderapi:
Right-click on the Azure deployment task and clone it:
Again, modify the –appName value in the template parameters field on the Azure Deployment cloned task to advancedserverlessorderapibackup:
Right-click on the Deploy Azure App Service task and click Remove Selected Tasks:
Click the + button and search for "Azure App Service Deploy". Click Add:
Set the Azure subscription to advancedserverless, the App Service type to Function App on Windows, and the App Service name to advancedserverlessorderapi:
Right-click the Azure App Service Deploy task and click Clone task(s):
Modify the App Service Name on the cloned task to advancedserverlessorderapibackup:
Click on Pipeline and click on the Add option next to Artifacts. Set the Source (build pipeline) to the cloned build pipeline:
Click Add. Select the other artifact and click Delete:
Change the Source alias field to remove the -clone on the end. This ensures all the tasks are looking in the correct place for the code:
Click Save. Click Release, and then Create a Release:
Click the Continuous Chaos stage to remove it from the automated release, as we haven't configured that stage. Select the latest build artifact. Click Create:
Click the link to the release that will appear at the top left of the screen. Click Deploy on the production stage. Click Deploy again. The release will start:
Now delete the advancedserverlessorderapi function app and visit the order.html page. Submit an order, and see it succeed: