Securely Store API Keys in Azure Key Vault for Logic Apps
Your company uses Azure Logic Apps to automate workflows. A workflow must call an external REST API that requires an API key in the header. You need to securely store the API key and reference it in the Logic App without exposing it in the workflow definition. What should you do?
Quick Answer
The correct answer is to store the API key in Azure Key Vault and use the Key Vault connector to retrieve it dynamically in the Logic App. This approach is correct because Azure Key Vault acts as a secure, centralized secrets store, and the Logic App’s built-in Key Vault connector retrieves the secret at runtime via a managed identity, ensuring the API key never appears in plain text within the workflow’s JSON definition or source control. On the AZ-204 exam, this scenario tests your understanding of securing sensitive configuration data in serverless workflows, often paired with questions about managed identities or access policies. A common trap is to hardcode the key in a Logic App parameter or use an environment variable, both of which expose the secret in the definition. Remember the mnemonic “KV-LA-MI” — Key Vault, Logic App, Managed Identity — to recall the secure chain for runtime secret retrieval.
⚠ Common exam trap
Many exam-takers confuse App Service application settings (Option C) with Logic App environment variables, but Logic Apps do not support the 'appsetting' expression, and Azure Key Vault is the only secure, native way to inject secrets into Logic Apps without exposing them in the definition.
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
✓
Store the API key in Azure Key Vault and use the Key Vault connector to retrieve it dynamically in the Logic App.
Azure Key Vault provides a secure, centralized store for secrets like API keys, and the Logic App Key Vault connector retrieves the key at runtime without exposing it in the workflow definition. This approach ensures the secret is never stored in plain text within the Logic App's JSON definition or source control, aligning with Azure security best practices for managed identities and access policies.
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 API key in plain text directly in the Logic App HTTP action header.
Why it's wrong here
This exposes the API key in the workflow definition, which is insecure and violates security best practices.
- ✓
Store the API key in Azure Key Vault and use the Key Vault connector to retrieve it dynamically in the Logic App.
Why this is correct
This securely stores the key in Key Vault and allows the Logic App to reference it at runtime without exposing it in the definition.
- ✗
Store the API key in an App Service application setting and reference it using the 'appsetting' expression.
Why it's wrong here
Application settings are for App Service, not Logic Apps. Logic Apps cannot directly access App Service application settings.
- ✗
Create an Azure Function with the API key hardcoded as an environment variable and call it from the Logic App.
Why it's wrong here
This adds unnecessary complexity and still requires storing the key somewhere. Azure Functions also need secure key management.
Go deeper
Related to this question
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 →
Same concept, more angles
3 more ways 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 company uses Azure Logic Apps to automate a business process. The process needs to call an external REST API that requires an API key passed in the Authorization header. You need to store the API key securely and reference it in the Logic App. Which approach should you use?
medium- A.Store the API key in the Logic App's definition as a constant
- ✓ B.Use an Azure Key Vault secret and a managed identity
- C.Hardcode the API key in a parameter file
- D.Use an Azure Storage account table to store the key
Why B: Azure Key Vault securely stores secrets like API keys, and using a managed identity allows the Logic App to authenticate to Key Vault without embedding credentials in code or configuration. This follows the principle of least privilege and eliminates the need to manage secrets in connection strings or parameter files.
Variation 2. A company uses Azure Logic Apps to integrate with a third-party CRM system. The CRM API requires OAuth 2.0 authentication. The developer needs to securely store the client secret and refresh token. Which Azure service should the developer use?
medium- A.Azure App Configuration
- ✓ B.Azure Key Vault
- C.Azure Managed Identity
- D.Azure SQL Database
Why B: Azure Key Vault is the correct service because it provides a secure, centralized store for secrets such as client secrets and refresh tokens. By storing these sensitive values in Key Vault, the developer can reference them in the Logic App workflow using the Key Vault connector, ensuring that secrets are never exposed in code or configuration. This aligns with the OAuth 2.0 requirement to protect long-lived credentials like refresh tokens.
Variation 3. You are using Azure Logic Apps to integrate with a third-party CRM. The CRM API requires OAuth 2.0 authentication with a client secret. The secret must be stored securely and rotated automatically. What should you do?
medium- A.Use a system-assigned managed identity without storing the secret
- ✓ B.Store the secret in Azure Key Vault and use a managed identity to access it
- C.Store the secret in the Logic App definition as a string parameter
- D.Store the secret in Azure App Configuration with encryption
Why B: The CRM API requires OAuth 2.0 with a client secret, so the secret must be stored securely and support automatic rotation. Azure Key Vault is the appropriate service for storing secrets, and using a managed identity allows secure access without hardcoding credentials. Option A is incorrect because a managed identity alone does not store the secret; the secret must be kept in a vault. Option C is wrong because storing secrets directly in a Logic App definition is insecure and does not support rotation. Option D is wrong because Azure App Configuration is designed for application settings, not secrets; it lacks automatic secret rotation capabilities.
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.