Using Azure Key Vault for app secrets
Azure Key Vault for app secrets in Business Central extensions: how to set up app key vaults for online and on-premises, read secrets from AL code, and monitor retrieval with telemetry. It answers setup, permission, app.json, and troubleshooting questions.
Path: Development > Programming in the AL language > Handling security > Using Azure Key Vault for app secrets · tier official · system development · narrative reviewed (checked by Opus)
Overview
App key vaults give extensions a central, secure place to keep secrets they need when making authenticated web service calls to external services. The section covers both online and on-premises deployments, the AL code that reads secrets, and the telemetry that shows whether retrieval worked.
Start with the overview page, Azure Key Vaults with Business Central. Then follow the setup page for your deployment. For online, this means provisioning the Dynamics 365 Business Central ISV key vault Reader application and granting it permissions. For on-premises, it means setting up the key vault, registering a Microsoft Entra application, granting permissions, and configuring the server instance with a certificate and client credentials.
Once the vault is ready, the page on using key vault secrets in extensions shows how to list key vault URLs in app.json and retrieve secrets with the App Key Vault Secret Provider codeunit. The telemetry page helps you analyze failures afterward.
Key points
- Extensions retrieve secrets from Azure Key Vaults for authenticated calls to external services, in online and on-premises deployments.
- Online setup supports Marketplace apps by provisioning the Dynamics 365 Business Central ISV key vault Reader application and granting permissions. It uses role-based access control and an AllowedBusinessCentralAppIds secret.
- Online setup supports multiple key vaults and the Embed App program.
- On-premises setup needs an Azure Key Vault, a Microsoft Entra app registration, permissions (RBAC or access policy), and server configuration with a certificate thumbprint and client credentials.
- On-premises options include self-signed certificates, private key access control, and a container-based configuration script.
- In AL, configure keyVaultUrls in app.json, then call TryInitializeFromCurrentApp and GetSecret on the App Key Vault Secret Provider codeunit. Secrets are returned as the SecretText type.
- Publisher validation applies to secrets, and extensions can use multiple key vaults.
- App key vault telemetry in Application Insights records initialization and retrieval successes and failures, including failure reasons, to help with monitoring and troubleshooting.
Learn pages
- Analyzing App Key Vault Secret Trace Telemetry: Analyze app key vault telemetry in Business Central to troubleshoot extension initialization failures and secret retrieval errors in Azure Key Vault.
- App key vault telemetry is sent to extension’s Application Insights resource, not environment’s
- RT0014 successful initialization, RT0015 initialization failure, RT0016 retrieval success, RT0017 retrieval failure
- Initialization stage verifies app.json configuration and Azure Key Vault Client Identity settings
- Retrieval stage occurs after successful initialization to get secrets from specified key vault
- Failure reasons include missing extension specification, incorrect client ID, missing permissions, or invalid secret names
- Telemetry captures key vault URI, secret name, extension details, and stack trace for troubleshooting
- Azure Key Vaults with Business Central: Learn how Business Central extensions use Azure Key Vault to securely retrieve secrets in online and on-premises environments.
- Set up app key vaults for Business Central online: Learn how to set up Azure key vaults for Business Central online extensions. Follow step-by-step instructions to securely manage secrets for your Marketplace apps.
- Limit: App key vaults only supported with Marketplace apps on Business Central online, not with per-tenant extensions or dev extensions.
- Extensions can use up to two key vaults for storing secrets needed in Azure.
- Step: Create Azure key vault and add secrets through Azure portal, Azure CLI, or other methods.
- Step: Provision Dynamics 365 Business Central ISV key vault Reader application in Microsoft Entra tenant using Microsoft Graph PowerShell SDK modules.
- Step: Grant key vault reader application permission to read secrets using Access policies or Azure Role-Based Access Control.
- Step: Create AllowedBusinessCentralAppIds secret in key vault containing app IDs separated by comma or semicolon.
- Key vault URLs in app.json must belong to same Microsoft Entra tenant as the key vault itself.
- Limit: Link between Marketplace app and key vault registered on submission and cannot be removed as breaking change; access cannot be deregistered once established.
- Setting up App Key Vaults for Business Central on-premises: Describes how to set up App Key Vault with Business Central on-premises.
- Prerequisite: Azure subscription with Active Directory tenant required to set up key vaults for Business Central on-premises.
- Prerequisite: Security certificate required for registering application in Microsoft Entra ID; self-signed certificate acceptable for test environments.
- Step: Create one or more Azure Key Vaults and add secrets using Azure portal, Azure CLI, or other methods; extension can use one or two vaults.
- Step: Register Microsoft Entra application for reading key vault secrets with certificate and specify Accounts in this organizational directory only.
- Step: Grant key vault reader application permission to read secrets by adding Get secret permission or assigning Key Vault Secrets User role.
- Step: Configure Server instance with certificate store location, name, thumbprint, client ID, and publisher validation setting for key vault access.
- Enable Publisher Validation to block extensions from reading secrets from other publishers’ key vaults; extensions need tenant ID from Publish-NAVApp.
- Permissions: Service account running Server instance must have permission to access certificate private key for successful key vault authentication.
- Use Key Vault Secrets in Business Central Extensions: Learn how to configure Azure Key Vault in an extension, retrieve secrets securely with SecretText, and monitor key vault operations.
- In the observatory: Codeunit 3800 “App Key Vault Secret Provider”
Key facts from Microsoft Learn (CC BY 4.0), in our own words (D106); open the page for the full text.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #12557 Implement first-party app authentication for Microsoft Fabric Export (code change): “Implement first-party app authentication for Microsoft Fabric Export”
- #13326 [Fabric] Clean up test events, app naming, authentication and telemetry (code change): “removed the unused Key Vault first-party client-ID lookup”
- #8999 Migrate Recommended Apps & Connectivity Apps to Official Marketplace Catalog API (code change): “Integrated Azure Key Vault for secure API key management”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 5 Learn pages
- learnAnalyzing App Key Vault Secret Trace Telemetry2026-11-17
- learnAzure Key Vaults with Business Central2026-10-08
- learnSet up app key vaults for Business Central online2026-01-27
- learnSetting up App Key Vaults for Business Central on-premises2021-04-01
- learnUse Key Vault Secrets in Business Central Extensions2026-10-09