AZ-204 Implement Azure security Practice Question
You are developing an Azure Function that processes messages from an Azure Service Bus queue. The function must use a managed identity to authenticate to the Service Bus to avoid managing secrets. Which configuration step is essential for this setup?
⚠ Common exam trap
Test-takers frequently think storing secrets in Key Vault (Option B) is sufficient for secretless authentication, but Key Vault references still involve retrieving a secret at runtime, whereas managed identity completely removes the need for any secret.
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
✓
Enable system-assigned managed identity on the function app and assign the 'Azure Service Bus Data Receiver' role to the identity
Using a managed identity eliminates the need to manage secrets or connection strings. By enabling a system-assigned managed identity on the function app and assigning the 'Azure Service Bus Data Receiver' role to that identity, the function can authenticate to Azure Service Bus via Azure AD (OAuth 2.0) without any stored credentials. This is the recommended approach for secure, secretless authentication in Azure Functions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Store the Service Bus connection string in the function app settings
Why it's wrong here
Storing the Service Bus connection string directly in the function app settings is a significant security vulnerability. This method embeds sensitive credentials directly into the application configuration, making them susceptible to exposure if the application settings are ever compromised or improperly accessed. It completely bypasses best practices for secure secret management and rotation, increasing the risk of unauthorized access to the Service Bus namespace.
- ✗
Create a Key Vault reference to the connection string
Why it's wrong here
While Azure Key Vault is a robust solution for securely storing secrets, creating a Key Vault reference to a connection string still involves managing a secret, albeit in a more secure location. The function app would still need permissions to access Key Vault, which ideally would be granted via a Managed Identity. However, the connection string itself remains a secret that requires lifecycle management, rotation, and careful access control within Key Vault, which is less ideal than direct authentication.
- ✓
Enable system-assigned managed identity on the function app and assign the 'Azure Service Bus Data Receiver' role to the identity
Why this is correct
Enabling a system-assigned managed identity on the function app and assigning the 'Azure Service Bus Data Receiver' role is the most secure and recommended approach. This method allows the Azure Function to authenticate directly with Azure Active Directory (Azure AD) and subsequently authorize against Azure Service Bus without needing any connection strings, keys, or secrets stored within the function app or Key Vault. Azure automatically manages the identity's lifecycle, eliminating the burden of credential management and rotation for developers.
- ✗
Use the Service Bus SDK with a SharedAccessSignatureToken
Why it's wrong here
Using the Service Bus SDK with a SharedAccessSignatureToken (SAS token) requires generating, storing, and managing a secret. Although SAS tokens offer granular control over permissions and have an expiry, they are still credentials that must be securely handled, rotated before expiration, and protected from unauthorized disclosure. This approach introduces operational overhead and potential security risks if the tokens are compromised or not managed diligently, unlike the secret-less authentication provided by Managed Identities.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
Learn chapter
Azure Functions Development
Key term
Azure Relay
Azure Relay is a cloud service that securely exposes on-premises web services to the public internet or other cloud applications without opening firewall ports.
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.
About these practice questions
One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.