Deploying Azure App Service API with Deployment Slots | AZ-204 Exam Solution

Enable Auto Swap for Testing Slot

Question

Note: This question is part of a series of questions that present the same scenario.

Each question in the series contains a unique solution that might meet the stated goals.

Some question sets might have more than one correct solution, while others might not have a correct solution.

After you answer a question in this section, you will NOT be able to return to it.

As a result, these questions will not appear in the review screen.

You develop and deploy an Azure App Service API app to a Windows-hosted deployment slot named Development.

You create additional deployment slots named Testing and Production.

You enable auto swap on the Production deployment slot.

You need to ensure that scripts run and resources are available before a swap operation occurs.

Solution: Enable auto swap for the Testing slot.

Deploy the app to the Testing slot.

Does the solution meet the goal?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B.

B.

Instead update the web.config file to include the applicationInitialization configuration element.

Specify custom initialization actions to run the scripts.

Note: Some apps might require custom warm-up actions before the swap.

The applicationInitialization configuration element in web.config lets you specify custom initialization actions.

The swap operation waits for this custom warm-up to finish before swapping with the target slot.

Here's a sample web.config fragment.

<system.webServer> <applicationInitialization> <add initializationPage="/" hostName="[app hostname]" /> <add initializationPage="/Home/About" hostName="[app hostname]" /> </applicationInitialization> </system.webServer> Reference: https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#troubleshoot-swaps.

The solution of enabling auto swap for the Testing slot and deploying the app to the Testing slot can meet the stated goal of ensuring that scripts run and resources are available before a swap operation occurs.

Auto swap is a feature in Azure App Service that allows for the automatic swapping of two deployment slots. In this scenario, auto swap has been enabled for the Production deployment slot, which means that any changes made to the app in the Development slot will be automatically swapped into the Production slot once the changes have passed testing in the Testing slot.

Enabling auto swap for the Testing slot and deploying the app to the Testing slot will ensure that any scripts that need to run or resources that need to be available before the swap operation occurs will be available and ready for use. This is because when auto swap is enabled for a deployment slot, the app in that slot is warmed up before the swap occurs. This means that any initialization scripts and resources are executed and loaded into memory before the swap occurs, ensuring that the app is ready to handle traffic immediately after the swap.

Therefore, the solution of enabling auto swap for the Testing slot and deploying the app to the Testing slot is a valid solution to meet the stated goal.