AZ-204 practice question 34 of 35
You are preparing to deploy an ASP.NET Core website to an Azure Web App from a GitHub repository. The website includes static content generated by a…
Full set: 489 questionsDomain Develop Azure compute solutions
To run a script before an ASP.NET Core website starts during an Azure App Service continuous deployment, you can customize the build and deployment process managed by Kudu, the App Service deployment engine.
1. Creating a .deployment file in the repository's root allows you to specify a custom deployment script. Within this script, you can add commands to generate static content before the standard build and deployment steps are executed.
2. Adding a PreBuild target to the .csproj project file integrates the script execution directly into the MSBuild process. Since Kudu uses MSBuild to build .NET applications, the script will run on the build server, and its output will be included in the final deployment package.
C. The run.cmd file is used for defining Azure WebJobs, which are background processes, not for customizing the main website's deployment workflow.
D. WEBSITERUNFROMPACKAGE is an application setting for running an app from a zip package. host.json is a configuration file for Azure Functions, not Web Apps.
1. Answer A: Microsoft Docs. (2023). Customize deployments - Azure App Service. Section: "Deployment script". This document explains that you can create a .deployment file to point to a custom deployment script, allowing you to add custom logic like pre-build steps.
Reference: https://learn.microsoft.com/en-us/azure/app-service/deploy-customize-scripts#deployment-script
2. Answer A & General Kudu Process: Kudu Project Wiki. (n.d.). Customizing deployments. This official wiki for the Kudu engine details how to use the .deployment file and deploy.cmd/.sh to hook into and modify the deployment process, including adding steps before the build.
Reference: https://github.com/projectkudu/kudu/wiki/Customizing-deployments
3. Answer B: Microsoft Docs. (2023). MSBuild targets. This document describes how to use MSBuild targets like PreBuildEvent or custom targets with BeforeTargets="Build" to execute commands before the main build process, which is leveraged by Kudu during deployment.
Reference: https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2022 (See section "Use the BeforeTargets and AfterTargets attributes").
4. Answer C (Incorrect): Microsoft Docs. (2023). Run background tasks with WebJobs in Azure App Service. This page shows that run.{cmd|bat|exe|ps1|sh|php|py|js} is the convention for executable scripts within a WebJob, not for the main site deployment.
5. Answer D (Incorrect): Microsoft Docs. (2023). Run your app in Azure App Service directly from a ZIP package. This document clarifies that WEBSITERUNFROMPACKAGE is an application setting for mounting a package, not executing a script.
Reference: https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package
Keep practicing
Take the free AZ-204 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AZ-204 practice questions
- Question 3Note: This question is part of a series of questions that present the same scenario. Each…
- Question 7Note: This question is part of a series of questions that present the same scenario. Each…
- Question 8You are developing several microservices to run on Azure Container Apps. External HTTP in…
- Question 10You develop and deploy an Azure App Service web app named App1. You create a new Azure Ke…
- Question 14You are developing an ASP.NET Core Web API web service. The web service uses Azure Applic…
- Question 17Note: This question is part of a series of questions that present the same scenario. Each…
