Skip to content

[Bug]: Hardcoded Azure OpenAI API version prevents using latest models #6243

@SchulzOli

Description

@SchulzOli

Describe the issue

The System Application Azure OpenAI integration uses a hardcoded API version 2024-06-01 that cannot be configured or overridden by developers. This prevents Business Central extensions from using:

  • Latest GPT-4o models (require API version 2024-12-01-preview or later)
  • o1-series reasoning models (o1-mini, o1-preview, o1)
  • Azure AI Foundry endpoints (*.inference.ml.azure.com)
  • New content filter policies and API features

Code Location: System Application 27.0, Codeunit 7767 "AOAI Authorization"

UrlFormatTxt: Label 'https://%1.openai.azure.com/openai/models?api-version=2024-06-01', Locked = true;

The codeunit is marked Access = Internal, the procedure is local, and the label is Locked = true, making it impossible to extend or override from AL code.

Critical Compatibility Gap (January 2026):
Models compatible with API version 2024-06-01 (gpt-35-turbo, gpt-4 turbo-2024-04-09) have been deprecated/retired as of September 2025. New models require API versions that BC doesn't support, creating a blocker for AI development.

Expected behavior

Business Central should support modern Azure OpenAI deployments through one of these approaches:

Option 1: Update API Version
Update the hardcoded API version to the latest stable version (2024-10-21 or newer) to support current model generations.

Option 2: Make API Version Configurable (Preferred)
Add a public method to allow developers to specify the API version:

procedure SetApiVersion(ApiVersion: Text)

This would provide backward compatibility while enabling access to latest features without waiting for platform updates.

Option 3: Support Multiple Endpoint Formats
Allow Azure AI Foundry and legacy endpoint formats in addition to the current .openai.azure.com restriction.

Steps to reproduce

  1. Create Azure OpenAI Resource:

    • Navigate to Azure Portal
    • Create Azure OpenAI Service resource
    • Deploy model: gpt-4o (version 2024-11-20) or o1-mini
    • Note the endpoint URL and deployment name
  2. Configure Business Central:

    • Create AL extension using System Application Azure OpenAI codeunits
    • Use SetAuthorization() with endpoint, deployment name, and API key
    • Set capability with SetCopilotCapability()
  3. Attempt API Call:

    AOAIChatMessages.AddSystemMessage('Test');
    AOAIChatMessages.AddUserMessage('Hello');
    AzureOpenAI.GenerateChatCompletion(AOAIChatMessages, AOAIChatCompletionParams, AOAIOperationResponse);
  4. Observe Result:

    • Status Code: 400
    • Error: "invalid content filter policy" or similar API version incompatibility error
  5. Verification with Python SDK:

    # Same Azure resource, deployment, and API key with api_version="2024-12-01-preview"
    # Result: Works successfully

The issue is confirmed to be the hardcoded API version, not deployment configuration.

Additional context

Environment:

  • Business Central: 27.0.38460.44704 (also affects earlier versions)
  • System Application: 27.0.0.0
  • Deployment: Both SaaS and On-Premises
  • Azure OpenAI: All regions

Microsoft Documentation:

Source Code Reference (Verified):

  • Repository: microsoft/BCApps
  • File: src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
  • Line 168: UrlFormatTxt: Label 'https://%1.openai.azure.com/openai/models?api-version=2024-06-01', Locked = true;
  • Codeunit 7767 marked Access = Internal
  • Procedure PerformAOAIAccountVerification is local

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    IntegrationGitHub request for Integration area

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions