AZ-204 Implement Azure security Practice Question
You are developing a serverless function using Azure Functions that needs to write logs to a Log Analytics workspace. The function uses a managed identity. Which RBAC role should you assign to the function's managed identity?
⚠ Common exam trap
It's easy for candidates to confuse the Log Analytics Contributor role with the Monitoring Contributor role, mistakenly thinking the latter covers log ingestion, but Monitoring Contributor lacks the specific write permissions to the Log Analytics workspace data plane.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Log Analytics Contributor
The Log Analytics Contributor role is required because it grants the managed identity the necessary permissions to send data to a Log Analytics workspace, including the ability to create and manage data collection rules and write log data. This role is specifically designed for scenarios where an Azure resource, such as an Azure Function, needs to ingest logs into Log Analytics via the Data Collection API.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Log Analytics Reader
Why it's wrong here
The Log Analytics Reader role grants permissions primarily for viewing data, running queries, and accessing saved searches within a Log Analytics workspace. It explicitly lacks the necessary data plane write actions, such as `Microsoft.OperationalInsights/workspaces/write` or `Microsoft.OperationalInsights/workspaces/tables/write`, which are essential for an Azure Function to ingest new log data. Therefore, assigning this role would prevent the function from successfully sending its telemetry to the workspace.
- ✗
Monitoring Contributor
Why it's wrong here
The Monitoring Contributor role is designed to manage monitoring solutions and configurations across Azure resources, including creating diagnostic settings, configuring alerts, and managing metric definitions. While it provides broad permissions related to setting up monitoring, it specifically does not include the data plane write permissions required for directly ingesting logs into a Log Analytics workspace. Its scope is focused on configuring *how* monitoring data is collected and processed, rather than the act of writing the data itself.
- ✓
Log Analytics Contributor
Why this is correct
The Log Analytics Contributor role provides comprehensive permissions to manage and write data to a Log Analytics workspace. This role includes the crucial `Microsoft.OperationalInsights/workspaces/write` and `Microsoft.OperationalInsights/workspaces/tables/write` actions, enabling an Azure Function to ingest its operational logs, custom metrics, and other telemetry directly into the workspace for analysis and visualization. This role is specifically tailored for scenarios requiring data ingestion into Log Analytics, aligning with the principle of least privilege.
- ✗
Storage Blob Data Contributor
Why it's wrong here
The Storage Blob Data Contributor role grants permissions to perform read, write, and delete operations on Azure Storage blobs and containers. This role is entirely scoped to Azure Blob Storage services and has no relevance or permissions within an Azure Log Analytics workspace. Attempting to use this role for logging to Log Analytics would fail because it does not provide any of the required `Microsoft.OperationalInsights` permissions necessary for data ingestion into that specific service.
Quick reference
Access Control Model Comparison
| Model | Acronym | Who Controls Access? | Best For |
|---|---|---|---|
| Discretionary Access Control | DAC | Resource owner | Small teams, file shares |
| Mandatory Access Control | MAC | System / security labels | Classified govt / military |
| Role-Based Access Control | RBAC | Administrator (via roles) | Enterprise environments |
| Attribute-Based Access Control | ABAC | Policy engine (user + resource attributes) | Fine-grained, dynamic policies |
| Rule-Based Access Control | RuBAC | System rules / ACLs | Firewall rules, network ACLs |
Go deeper
Related to this question
Learn chapter
Azure Functions Development
Key term
Azure Functions Bindings
Azure Functions Bindings are declarative connections that link your serverless function code to Azure services or external resources, handling input and output data automatically without writing extra networking or authentication code.
Key term
Durable Functions
Durable Functions is an extension of Azure Functions that lets you write stateful workflows in code, managing complex sequences of tasks, retries, and delays automatically.
About these practice questions
This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.