Troubleshoot 403 Forbidden When Using Managed Identity to Access Azure Key Vault from App Service
You are configuring a managed identity for an Azure App Service to access Azure Key Vault. The identity has been assigned, but the app receives a 403 Forbidden when trying to retrieve a secret. What is the most likely cause?
Quick Answer
The answer is that the managed identity lacks an access policy or RBAC role in Key Vault. Simply assigning a managed identity to an App Service does not automatically grant it permission to read secrets; you must explicitly authorize that identity within Key Vault’s permission model, either through an access policy (using the vault’s legacy permissions) or by assigning an Azure RBAC role like “Key Vault Secrets User” at the vault scope. On the AZ-204 exam, this question tests your understanding that identity assignment and authorization are separate steps—a common trap is assuming the identity is “active” as soon as it’s enabled. Remember the mnemonic: “Assign then allow”—first assign the identity, then allow it with a policy or role, or you’ll hit a 403.
⚠ Common exam trap
Candidates often confuse a 403 Forbidden with a network-level firewall block, but in Azure Key Vault, a 403 typically indicates an authorization failure (missing access policy or RBAC role), not a firewall issue, especially when using a managed identity.
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
✓
The managed identity lacks an access policy or RBAC role in Key Vault
Azure Key Vault uses either access policies or Azure RBAC to authorize requests. When a managed identity is assigned to an App Service but no corresponding access policy or RBAC role (e.g., 'Key Vault Secrets User') is granted in Key Vault, the identity has no permissions to read secrets, resulting in a 403 Forbidden response. The 403 indicates the request reached Key Vault but was denied due to missing authorization.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The app is using the wrong endpoint
Why it's wrong here
If the endpoint is wrong, the error would be different (e.g., 404).
- ✗
The managed identity is not enabled in the App Service
Why it's wrong here
If the identity is assigned but not enabled, the app would get a different error.
- ✓
The managed identity lacks an access policy or RBAC role in Key Vault
Why this is correct
Access policies or RBAC roles are required to authorize the identity to read secrets.
- ✗
The Key Vault firewall is blocking the request
Why it's wrong here
A firewall block would typically result in a timeout or connection refused, not a 403.
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
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.
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.
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 →
Same concept, more angles
1 more way this is tested on AZ-204
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Your Azure App Service app must access Azure Key Vault secrets without storing credentials in code. Which service should you use to manage identities?
easy- A.Service principal with client secret
- ✓ B.Managed identity
- C.Storage account access key
- D.Client certificate
Why B: Managed identity (B) is correct because it provides an automatically managed Azure AD identity for your App Service app, allowing it to authenticate to Azure Key Vault without storing any credentials in code or configuration. The identity is tied to the app's lifecycle and can be used with Azure RBAC to grant access to secrets, eliminating the need for manual credential management.
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.