Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 2 question 27 discussion

Actual exam question from Microsoft's AZ-204
Question #: 27
Topic #: 2
[All AZ-204 Questions]

You are preparing to deploy a website to an Azure Web App from a GitHub repository. The website includes static content generated by a script.
You plan to use the Azure Web App continuous deployment feature.
You need to run the static generation script before the website starts serving traffic.
What are two possible ways to achieve this goal? Each correct answer presents a complete solution.
NOTE: Each correct selection is worth one point.

  • A. Add the path to the static content generation tool to WEBSITE_RUN_FROM_PACKAGE setting in the host.json file.
  • B. Add a PreBuild target in the websites csproj project file that runs the static content generation script.
  • C. Create a file named run.cmd in the folder /run that calls a script which generates the static content and deploys the website.
  • D. Create a file named .deployment in the root of the repository that calls a script which generates the static content and deploys the website.
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️
A: In Azure, you can run your functions directly from a deployment package file in your function app. The other option is to deploy your files in the d:\home\site
\wwwroot directory of your function app (see A above).
To enable your function app to run from a package, you just add a WEBSITE_RUN_FROM_PACKAGE setting to your function app settings.
Note: The host.json metadata file contains global configuration options that affect all functions for a function app.
D: To customize your deployment, include a .deployment file in the repository root.
You just need to add a file to the root of your repository with the name .deployment and the content:
[config]
command = YOUR COMMAND TO RUN FOR DEPLOYMENT
this command can be just running a script (batch file) that has all that is required for your deployment, like copying files from the repository to the web root directory for example.
Reference:
https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script https://docs.microsoft.com/bs-latn-ba/azure/azure-functions/run-functions-from-deployment-package

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
minsma
Highly Voted 3 years, 7 months ago
I think it is B and D
upvoted 74 times
ZodiaC
3 years, 2 months ago
1000000% CORRECT !!!!!
upvoted 2 times
...
rdemontis
3 years, 6 months ago
I think you're correct: in fact - run.cmd is used only to start a project as a dll file https://www.sohaibtariq.com/console-webjob/%C3%ACndex/ - WEBSITE_RUN_FROM_PACKAGE doesn't consent the execution of any script. You can only run your web project from a package (.zip file tipically) https://docs.microsoft.com/bs-latn-ba/azure/azure-functions/run-functions-from-deployment-package https://github.com/Azure/app-service-announcements/issues/84 - Instead in .csproj file PreBuild Event Target you can specify any command to execute before the compilation and the application execution. https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2019 https://stackoverflow.com/questions/44818730/is-there-a-net-core-cli-pre-before-build-task https://stackoverflow.com/questions/28916414/visual-studio-add-pre-build-event-that-always-runs-c-project
upvoted 10 times
Vegetta95
2 years, 6 months ago
If the solution is built on the local machine, you can add target before build and do operations like copy files, run .bat(which can generate script content). However, if the repository is hosted on GitHub, any target will not work, because GitHub does not build apps
upvoted 2 times
...
Arrrqqq
3 years, 2 months ago
More direct info https://docs.microsoft.com/en-us/azure/app-service/deploy-best-practices#net "By default, Kudu executes the build steps for your .NET application (dotnet build)" - so pre-build step should work there. There is similar note for node.js
upvoted 3 times
...
[Removed]
1 year, 11 months ago
Me: Do I need to know .Net shit to pass AZ-204? Microsoft: No, it is only concept you need to know. It does not check your knowledge of .Net (or whatever it is) Questions: .csproj file PreBuild Event Target Me: Microsoft oh Microsoft.
upvoted 36 times
dimsok
1 year, 7 months ago
This is not .NET shit
upvoted 6 times
...
...
...
...
rolandcha
Highly Voted 3 years, 7 months ago
the answer is : C,D
upvoted 30 times
Drgn
3 years, 7 months ago
I agree C and D. The explanation of the Answers point to a Azure Function App, either the question was entered wrong (as they meant Azure Function App) into ExamTopics or the answers they chose were wrong.
upvoted 8 times
ACCP1
3 years, 7 months ago
It could be A. It is used here for a web app. https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package
upvoted 5 times
Robert12345Robert
3 years, 2 months ago
Why is this upvoted? When you check the link you can read yourself that this will not run any scripts for you.
upvoted 10 times
[Removed]
1 year, 11 months ago
But the repository could have a script and that will be run automatically by kudu ... Sorry, I do not know it myself whether kudu will be applied when it is from github. There are a lot of permutation combination and ways in which something can be done. To expect someone to remember all the unfortunate choices Microsoft made in these choices is ridiculous. But then it is my mistake I chose to do this certification from Microsoft
upvoted 1 times
...
...
...
...
Kitkit
3 years, 7 months ago
Can you explain why you think c is the answer?
upvoted 3 times
clarionprogrammer
3 years, 5 months ago
'C' makes no sense. Nothing exists on the Azure website in regard to a "run.cmd".
upvoted 6 times
dreamcoder
2 years, 9 months ago
C, D is correct. To customize your deployment, include a .deployment file in the repository root. For more information, see Customize deployments and Custom deployment script. https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment?tabs=github https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script
upvoted 3 times
...
...
...
...
Faolba
Most Recent 4 days, 7 hours ago
Selected Answer: CD
ChatGPT says C and D
upvoted 1 times
...
HariB1992
4 months, 3 weeks ago
Selected Answer: BD
Copilot Says B and D
upvoted 1 times
...
Isoldhe
7 months ago
Selected Answer: BD
Copilot AI says B and D: Option B is correct because you can use the PreBuild target in the csproj file to execute a custom command or script before the project is built. This way, you can run the static content generation script and include the generated files in the project output. Option D is correct because you can use the .deployment file in the root of the repository to customize the deployment process and specify a custom deployment script. This way, you can run the static content generation script and deploy the website using the custom script.
upvoted 3 times
...
Jass1nonly
7 months ago
A could NOT be the solution, since WEBSITE_RUN_FROM_PACKAGE is strictly used for running an app from a zip package. It doesn't involve any pre-build script support. It has to be B & D IMO.
upvoted 1 times
...
manopeydakon
8 months, 2 weeks ago
The correct answers are C and D. C. Creating a file named run.cmd in the folder /run that calls a script which generates the static content and deploys the website is a valid approach. You can use this file to run any pre-processing or setup steps before the website starts serving traffic. D. Creating a file named .deployment in the root of the repository that calls a script which generates the static content and deploys the website is also a valid approach. The .deployment file can be used to specify custom deployment steps, including running scripts before the deployment process. Both options allow you to execute custom scripts or commands before the website starts serving traffic, making them suitable for running the static content generation script.
upvoted 1 times
...
aragones
1 year, 4 months ago
Got this 2023-05-12. Had cases: case: You need to configure authorization. case: You need to ensure the app does not time out and processes the blob data case study: VanArsdel Inc Canada
upvoted 4 times
...
aragones
1 year, 4 months ago
Got this 2023-05-12. FYI: case: You need to configure authorization. case: You need to ensure the app does not time out and processes the blob data case study: VanArsdel Inc Canada
upvoted 1 times
...
[Removed]
1 year, 5 months ago
Got this in exam today (5 April 2023)
upvoted 7 times
notedo
1 year, 5 months ago
Thanks for commenting
upvoted 1 times
...
...
Saluk_DE
1 year, 5 months ago
Question was in Exam 2023-03-30
upvoted 2 times
...
PP2015
1 year, 5 months ago
Did my exam on 3/29/2023. This question was on it. I Selected B and D. Score 850
upvoted 3 times
...
adilkhan
1 year, 6 months ago
C D chatGPT
upvoted 1 times
DonH
1 year, 3 months ago
without any additional comment this answer is useless. Just typing it in ChatGPT doesn't mean it's helpfull.
upvoted 6 times
...
macobuzi
1 year, 1 month ago
ChatGPT is not always right, actually
upvoted 3 times
...
...
uffuchsi
1 year, 7 months ago
Selected Answer: CD
It has to be C, or DIf you want to customize the deployment process, for example you want to run your tests before deploying (or after) and cancel the deployment if they fail? Any of these commands will generate the files required to deploy your site, mainly: .deployment - Contains the command to run for deploying your site. deploy.cmd - Contains the deployment script (or deploy.sh if running on Mac/Linux)
upvoted 2 times
...
NombreFalso
1 year, 7 months ago
Selected Answer: BD
A is wrong, it's never mentioned to be an Azure Function. There is nothing wrong with B and D.
upvoted 1 times
...
JamieS
1 year, 7 months ago
Selected Answer: BD
Without research I thought A and D, but static files (from what I can tell) are housed in wwwroot, but https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package states that "When you run from a package, the wwwroot folder becomes read-only and you'll receive an error when writing files to this directory. Files are also read-only in the Azure portal." so unless it has been reconfigured not to use wwwroot for content, this can't be right. I'd then lean towards B and D like the majority, but then this is assuming msbuild for the website, but what if it's another technology like Ruby? It wouldn't have a .csproj. Unfortunately we're not given a big enough world view, so we'll have to make assumptions, if we're making assumptions I think it must be B & D, B would certainly work if was an MSBuild project.
upvoted 4 times
...
rotimislaw
1 year, 8 months ago
Selected Answer: BD
As stated by others here, B&D
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...