exam questions

Exam AZ-400 All Questions

View all questions & answers for the AZ-400 exam

Exam AZ-400 topic 2 question 38 discussion

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

You use Azure Pipelines to build and deploy an app named App1.

You plan to monitor App1 by using Application Insights.

You create an Application Insights instance named AI1.

You need to configure App1 to use AI1.

Which file should you modify?

  • A. appsettings.json
  • B. launchSettings.json
  • C. startup.cs
  • D. project.json
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
xRiot007
Highly Voted 1 year, 9 months ago
It can be either A or C. The type of application is not specified.
upvoted 6 times
...
Rabi3
Most Recent 2 weeks, 6 days ago
Selected Answer: A
Answer is A or C. However, the answer in this case is A, since the question didn't specify application type or runtime stack. It wouldn't make sense to configure startup.cs for a NodeJS app for example
upvoted 1 times
...
Mousavi
3 months ago
Selected Answer: A
To configure Application Insights for your application, the most common and recommended approach is to specify the Instrumentation Key in the appsettings.json file, which is used by the app to send telemetry data to the Application Insights instance.
upvoted 1 times
...
nikolayivanov
3 months, 2 weeks ago
Selected Answer: A
In modern .NET Core applications, Startup.cs is used to configure services and middleware, including Application Insights. However, the actual connection string or instrumentation key for Application Insights should not be hardcoded directly in Startup.cs. Instead, it is best practice to store such configuration values in external configuration files like appsettings.json or environment variables for flexibility and security. In Startup.cs, the Application Insights configuration typically reads values from the configuration system (e.g., appsettings.json). So the correct answer is A.
upvoted 1 times
...
PravinDhote
4 months, 2 weeks ago
Selected Answer: C
Example configuration in startup.cs: csharpCopypublic void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); } Therefore, option C (startup.cs) is the correct answer as it's the appropriate file for configuring Application Insights integration.
upvoted 1 times
...
Dankho
5 months ago
Selected Answer: C
After further review, I am concluding that it's startup.cs. The key word is 'configure'. Both appsettings.json and startup.cs files are involved in the process of setting up Application Insights for your app, but Startup.cs is where you actually configure the application to use Application Insights. The appsettings.json file holds the Instrumentation Key that you use to connect to your Application Insights instance (AI1). So, while you do configure the app in Startup.cs, you often retrieve the necessary values (like the instrumentation key) from appsettings.json.
upvoted 2 times
...
Dankho
5 months ago
Selected Answer: A
From ChatGPT: While the Startup.cs file is used to configure services like Application Insights, you usually need to specify the instrumentation key in the appsettings.json, and then in the Startup.cs file, you enable Application Insights with the key from appsettings.json.
upvoted 1 times
...
Gooldmember
5 months, 3 weeks ago
Selected Answer: A
I think it is A, since it does not say anything about if it is a normal or core application, then i assume it is a normal. First, you modify appsettings.json to store the key in a centralized location, which will be easier to change and secure. Then, you use Startup.cs to wire up Application Insights by reading the key and configuring telemetry collection in the application.
upvoted 2 times
...
ahmedmnassri
6 months, 4 weeks ago
Selected Answer: A
check chatgpt and gemini ai
upvoted 1 times
...
ozbonny
1 year, 2 months ago
Selected Answer: C
I think since the question says configuration rather than adding it would be C.
upvoted 3 times
...
Rod_DA
1 year, 7 months ago
Selected Answer: A
you enable application insight by adding code to the startup.cs but you actually point to the AI1 by adding either a instrumentation key or a connection string. and the right place for such config is in appsettings.json
upvoted 4 times
...
yana_b
1 year, 8 months ago
Selected Answer: C
https://learn.microsoft.com/en-us/azure/azure-monitor/app/tutorial-asp-net-core Enable Application Insights server-side telemetry The Application Insights for ASP.NET Core web applications NuGet package encapsulates features to enable sending server-side telemetry to the Application Insights resource in Azure. From the Visual Studio Solution Explorer, open the Program.cs file. Screenshot of the Visual Studio Solution Explorer with the Program.cs file highlighted. As addition, look at the comment of user renzoku below
upvoted 2 times
...
flafernan
1 year, 9 months ago
Selected Answer: C
C: Regardless of the application and runtime used, to configure Application Insights in an application, it is usually necessary to modify the startup.cs file. This file is commonly used to configure the request pipeline and configure initial application settings, including configuring Application Insights to send telemetry data.
upvoted 4 times
...
renzoku
1 year, 9 months ago
Selected Answer: C
startup.cs Configure it to establish the connection between Application Insights services with your .NET core app, enabling send telemetry data. appsettings.json Contains configuration for Application Insights.
upvoted 2 times
...
notsure1111
1 year, 10 months ago
for .net framework based web application, its AppSettings.json for .net core based web application, its Startup.cs file. Question does not talk about which .net application it is.
upvoted 4 times
...
Cervezerg
1 year, 10 months ago
Selected Answer: C
ChatGPT answer: C. startup.cs In a typical .NET application, such as App1, the startup.cs file contains the configuration and initialization code for the application. This file is responsible for configuring various services and middleware during the application's startup. To enable and configure Application Insights, you would modify the startup.cs file and add the necessary code to set up Application Insights for your app. This typically involves adding services and configuring the Application Insights instrumentation key, which connects your app to the AI1 instance.
upvoted 2 times
...
d33ma
1 year, 10 months ago
Selected Answer: C
Should be C
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago