Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Problem

The AcquireToken procedure references AzureADAppSetup.FindFirst() without a guard, which fails on-prem when no setup record exists.

Investigation Result

The code snippet does not exist in this repository. After exhaustive search:

  • AzureADAppSetup table — not found
  • AzureADAuthFlow codeunit — not found
  • AcquireTokenFromCacheAsSecretText() — not found
  • AcquireTokenFromCacheWithCredentialsAsSecretText() — not found

This code appears to be from the Base Application, not BCApps/System Application.

Recommended Fix

If located, change:

else begin
    AzureADAppSetup.FindFirst();  // Fails if record doesn't exist
    AccessToken := ...
end;

To:

else begin
    if not AzureADAppSetup.FindFirst() then
        exit;
    AccessToken := ...
end;

Action Required

Please provide the file path or confirm if this should be addressed in a different repository.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix AcquireToken procedure for on-prem environment Fix AcquireToken procedure for on-prem environment Jan 29, 2026
Copilot AI requested a review from Groenbech96 January 29, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants