Integrating AI in Business Central: A Step-by-Step Guide
Step-by-step guide to building a custom AI-powered Copilot agent in Business Central that automates customer address extraction from unstructured text using Azure OpenAI. Covers Azure setup, AL code development including isolated storage for secrets, prompt engineering with system and user prompts, and integration with the Customer card.

post Aardvark Labs
"Business Central has something called Isolated Storage. This is storage that is only accessible to the extension that created it."
Key points
- Azure OpenAI resources and credentials (endpoint, deployment, API key) must be securely stored in Isolated Storage to protect sensitive authentication data
- Copilot capabilities must be registered during extension installation and added to the Copilot & agent capabilities management page
- System prompts define AI behavior and expected output format (JSON recommended), while user prompts provide the actual data to process
- Chat completion parameters like max tokens, temperature (0 for deterministic results), and JSON mode control response quality and cost
- Retry logic with up to 5 attempts handles cases where the AI may not respond successfully on the first try
Quotes
- “Business Central has something called Isolated Storage. This is storage that is only accessible to the extension that created it.” (Explains the recommended secure storage mechanism for secrets and authentication credentials in Business Central extensions)
- “If we wanted to describe something, we would use a higher number to allow for more creative expressions. The max value is 2.” (Clarifies how temperature parameter controls AI creativity and determinism, essential for tuning response quality)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- codeunit “ARD_IsolatedStorageWrapper”
- page “ARD_CopilotSettings”
- enum “Copilot Capability”
- codeunit “ARD_CopilotSetup”
- codeunit “ARD_CopilotJob”
- page “ARD_AddressPrompt”
- page 21 “Customer Card”
Not found in BC28-30: codeunit “ARD_IsolatedStorageWrapper”, page “ARD_CopilotSettings”, enum “Copilot Capability”, codeunit “ARD_CopilotSetup”, codeunit “ARD_CopilotJob”, page “ARD_AddressPrompt”.
Context
- Features: Azure OpenAI integration, Copilot capability registration, Isolated storage for secrets management, Chat completion with JSON responses, Prompt dialog page type, Custom Copilot agents, Address extraction automation
Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.