AZ-204 Develop Azure compute solutions Practice Question
You are developing a microservices application on Azure Kubernetes Service (AKS). One of the services needs to securely access Azure SQL Database without storing connection strings in the application code. You need to use managed identities. What should you do?
⚠ Common exam trap
Many candidates confuse the AKS cluster's managed identity (which is for cluster-level operations like load balancers) with pod-level managed identities, leading them to incorrectly select Option B.
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 Azure AD Pod Identity and assign a managed identity to the pod.
Azure AD Pod Identity allows you to assign an Azure Active Directory (Azure AD) managed identity directly to a pod in AKS. The pod can then use that identity to authenticate to Azure SQL Database without storing any connection strings or secrets in the code. This is the recommended approach for pod-level managed identity access to Azure resources.
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 connection string in Azure Key Vault and use the Key Vault FlexVolume driver.
Why it's wrong here
Storing a connection string in Azure Key Vault and injecting it via the Key Vault FlexVolume (or CSI) driver, while securing the secret at rest, still results in the connection string being exposed within the pod's environment. The application code would still retrieve and utilize this credential-containing string to connect to Azure SQL. This approach fails to meet the requirement of avoiding any storage or handling of connection strings or secrets by the application code itself, as the code still processes the secret at runtime.
- ✗
Use the AKS cluster's managed identity to access Azure SQL.
Why it's wrong here
The AKS cluster's managed identity is primarily intended for the cluster's control plane to interact with other Azure resources, such as creating network resources or managing storage accounts. This identity is distinct from application-level identities and is not automatically available or suitable for individual application pods to authenticate to services like Azure SQL. Using the cluster's identity for application pods would violate the principle of least privilege and prevent fine-grained access control for individual microservices.
- ✗
Create a service principal and use its credentials in the pod.
Why it's wrong here
Using a service principal requires managing its credentials—secrets or certificates—which must still be injected into the pod, thereby failing the stem’s requirement to avoid storing connection strings or any secrets in application code. This approach is tempting because service principals are the traditional method for non-user authentication in Azure, and they would be correct in scenarios where managed identities are unavailable, such as when the resource (e.g., an on-premises service) cannot be hosted in an Azure resource that supports managed identities.
- ✓
Enable Azure AD Pod Identity and assign a managed identity to the pod.
Why this is correct
Enabling Azure AD Pod Identity (or its successor, Azure AD Workload Identity) allows individual pods within an AKS cluster to acquire and use an Azure Active Directory managed identity. By assigning a specific managed identity to a pod, that pod can then authenticate directly with Azure SQL Database using its identity, completely eliminating the need for connection strings, usernames, or passwords in the application code or configuration files. This method provides secure, credential-less authentication, aligning with best practices for microservices security.
Go deeper
Related to this question
Learn chapter
Azure Functions Development
Key term
Key Vault Secrets
Key Vault Secrets are secure containers in Microsoft Azure that store sensitive information like passwords, connection strings, and API keys, keeping them encrypted and accessible only to authorized applications and users.
Key term
Managed identity
A managed identity is an automatically managed service principal in Azure that allows your code to authenticate to any service that supports Azure AD authentication without storing credentials.
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.