exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 19 question 4 discussion

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

DRAG DROP -
You need to ensure that PolicyLib requirements are met.
How should you complete the code segment? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:

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
[Removed]
Highly Voted 3 years, 7 months ago
* EventId is held by class EventGridController * You can add properties to telemetry by implementing ITelemetryInitializer which defines the Initialize method. * ITelemetry.Context.Properties is correct, but shouldnt be used any more as obsoloete public class IncludeEventId : ITelemetryInitializer { public void Initialize (ITelemetry telemetry) { telemetry.Context.Properties["EventId"] = EventgridController.EventId.Value; } } https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#sampling-filtering-and-processing-telemetry https://docs.microsoft.com/en-us/dotnet/api/microsoft.applicationinsights.datacontracts.telemetrycontext.properties?view=azure-dotnet#Microsoft_ApplicationInsights_DataContracts_TelemetryContext_Properties
upvoted 48 times
Rakeshpro
2 years, 4 months ago
good job buddy!
upvoted 2 times
...
Knightie
2 years ago
the default answer's last line doesn't make sense... it use the property value to put inside it's context.property value within itself... a meaningful piece of code is to set the propertie value with another Global Object value (that the only sense making value calling inside a local method of a class)... so setting the Eventgrid's value to the pass-by-reference argument is the only sensible piece of code.
upvoted 2 times
...
...
uffuchsi
Highly Voted 1 year, 10 months ago
Box 1: ITelemetryInitializer Box 2: Initialize Box 3: Telemetry.Context Box 4: EventGridController.EventId.Value Scenario: The application reacts to events from Azure Event Grid and performs policy actions based on those events. The application must include the Event Grid Event ID field in all Application Insights telemetry. \You can add properties to telemetry by implementing ITelemetryInitializer which defines the Initialize method. https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#sampling-filtering-and-processing-telemetry
upvoted 11 times
warchoon
1 year, 8 months ago
"Telemetry initializers are called before calling telemetry processors". So EventId.Value is not initialized by Process method yet.
upvoted 1 times
...
...
james2033
Most Recent 9 months, 1 week ago
1. public class IncludeEventId: ITelemetryInitializer 2. public void Initialize (ITelemetry telemetry) 3. telemetry.Context.Properties["EventId"] 4. EventGridController.EventId.Value
upvoted 1 times
...
OPT_001122
2 years ago
Box 1: ITelemetryInitializer Box 2: Initialize Box 3: Telemetry.Context Box 4: ((EventTelemetry)telemetry).Properties["EventID"]
upvoted 3 times
...
OPT_001122
2 years, 1 month ago
anyone got this case study in exam?
upvoted 2 times
...
AzureDJ
2 years, 9 months ago
The given answer is correct. Box 4 is inside a function which takes in a parameter called: telemetry. The telemetry parameter, serves a purpose: to be used in the function in: ((EventTelemetry)telemetry).Properties["EventID"].
upvoted 2 times
AzureDJ
2 years, 9 months ago
The given answer is correct, except Box 4 should be: EventGridController.EventId.Value
upvoted 3 times
Ciupaz
1 year, 1 month ago
Correct
upvoted 2 times
...
...
...
UnknowMan
3 years, 6 months ago
Not correct. = > Use the EventId static prop of EventgridController
upvoted 4 times
...
Frakandel
3 years, 7 months ago
How static is the content of Event Grid Event ID... I agree with atomicicebreaker, bt doubt between "IProcess, Process, Context & EventHub" and "IInitialise, Initialise, Context & EventHub"
upvoted 1 times
...
Kuna_Lambo
3 years, 9 months ago
Box #4 is ok?
upvoted 4 times
rdemontis
3 years, 8 months ago
No, in my opinion it has no sense assign event id to telemetry object from the same object itself. you should take in from other objects, and in this case the only option possible seems to be EventGridController class.
upvoted 18 times
MrZoom
3 years, 8 months ago
Agreed. It states that "The application must include the Event Grid Event ID field in all Application Insights telemetry.".
upvoted 4 times
atomicicebreaker
3 years, 8 months ago
Yup, and the property is indeed set in a controller
upvoted 3 times
MiraA
3 years, 2 months ago
Yes, it is set here. Controller accepts JSON with the set of the events. The events are processed using foreach() and this is the place where EventGridController.EventId is set. The trick is the EventId is defined as: public static AsyncLocal<string> EventId = ... and AsyncLocal "represents ambient data that is local to a given asynchronous control flow, such as an asynchronous method.". https://docs.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?view=net-5.0
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 ...