---
id: object/codeunit/6300
type: object
title: Codeunit 6300 "Azure AD Mgt."
summary: Codeunit 6300 "Azure AD Mgt." in Base Application (System.Azure.Identity). 17 public procedures, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC28.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "28"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: ce943a50420bd8ba1fa157d3f5bd3d4d2e740102e577642cbccfd2a84d144d91
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Modules/System/AzureADAuthentication/AzureADMgt.Codeunit.al
    title: src/Layers/W1/BaseApp/Modules/System/AzureADAuthentication/AzureADMgt.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 6300
name: Azure AD Mgt.
namespace: System.Azure.Identity
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 23
  events: 0
  subscribers: 1
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 4
  called_by: 28
  implements: 0
---

# Codeunit 6300 "Azure AD Mgt."

> Codeunit 6300 "Azure AD Mgt." in Base Application (System.Azure.Identity). 17 public procedures, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC28.

Base Application · System.Azure.Identity · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Modules/System/AzureADAuthentication/AzureADMgt.Codeunit.al) · facts from BC29

## Event subscriptions

- OnGetUserToken subscribes to Codeunit "System Action Triggers" GetUserToken

## Procedures

- `GetAuthCodeUrl(ResourceName: Text): Text`
- `AcquireTokenByAuthorizationCodeAsSecretText(AuthorizationCode: SecretText; ResourceUrl: Text): SecretText`
- `GetAccessTokenAsSecretText(ResourceUrl: Text; ResourceName: Text; ShowDialog: Boolean): SecretText`
- `GetGuestAccessToken(ResourceUrl: Text; GuestTenantId: Text): Text`
- `GetOnBehalfAccessTokenAsSecretText(ResourceUrl: Text): SecretText`
- `GetOnBehalfAccessTokenAndTokenCacheState(ResourceUrl: Text; var TokenCacheState: Text): Text`
- `GetTokenFromTokenCacheState(ResourceId: Text; AadUserId: Text; TokenCacheState: Text; var NewTokenCacheState: Text): Text`
- `GetAzureADAuthEndpoint(): Text`
- `GetDefaultRedirectUrl(): Text[150]`
- `GetRedirectUrl(): Text[150]`
- `GetO365Resource(): Text`
- `GetO365ResourceName(): Text`
- `IsSaaS(): Boolean`
- `GetInitialTenantDomainName(): Text`
- `IsAzureADAppSetupDone(): Boolean`
- `CreateExchangeServiceWrapperWithToken(Token: SecretText; var Service: DotNet ExchangeServiceWrapper)`
- `GetLastErrorMessage(): Text`

Plus 5 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 6303 "Azure AD Auth Flow"](../codeunit/6303.md) (20 calls: `AcquireGuestToken → AcquireGuestToken`, `AcquireGuestToken → Initialize`, `AcquireToken → AcquireTokenFromCacheAsSecretText`, …)
- [Codeunit 9005 "Url Helper"](../codeunit/9005.md) (2 calls: `GetAzureADAuthEndpoint → GetAzureADAuthEndpoint`, `GetO365Resource → GetO365Resource`)
- [Codeunit 457 "Environment Information"](../codeunit/457.md) (1 call: `IsSaaS → IsSaaSInfrastructure`)
- [Page 6300 "Azure AD App Setup Wizard"](../page/6300.md) (1 call: `GetAccessTokenAsSecretText → (object)`)

## Called by

- [Codeunit 4516 "OAuth2 SMTP Authentication"](../codeunit/4516.md) (9 calls: `AuthenticateWithOAuth2 → AcquireTokenByAuthorizationCodeAsSecretText`, `AuthenticateWithOAuth2 → GetO365Resource`, `AuthenticateWithOAuth2 → GetO365ResourceName`, …)
- [Codeunit 9510 "Document Service Management"](../codeunit/9510.md) (6 calls: `GetAccessToken → GetAccessTokenAsSecretText`, `GetAccessToken → GetOnBehalfAccessTokenAsSecretText`, `GetDefaultLocation → GetOnBehalfAccessTokenAsSecretText`, …)
- [Codeunit 6301 "Power BI Service Mgt."](../codeunit/6301.md) (4 calls: `CreateServiceProvider → GetAccessTokenAsSecretText`, `InitializeAddinToken → GetAccessTokenAsSecretText`, `IsUserReadyForPowerBI → GetAccessTokenAsSecretText`, …)
- [Codeunit 5052 "AttachmentManagement"](../codeunit/5052.md) (3 calls: `InitializeExchangeWithToken → GetAccessTokenAsSecretText`, `InitializeExchangeWithToken → GetO365Resource`, `InitializeExchangeWithToken → GetO365ResourceName`)
- [Codeunit 5323 "Exchange Add-in Setup"](../codeunit/5323.md) (3 calls: `Initialize → GetAccessTokenAsSecretText`, `Initialize → GetO365Resource`, `Initialize → GetO365ResourceName`)
- [Codeunit 6700 "O365 Sync. Management"](../codeunit/6700.md) (3 calls: `GetPasswordOrToken → GetAccessTokenAsSecretText`, `GetPasswordOrToken → GetO365Resource`, `GetPasswordOrToken → GetO365ResourceName`)
- [Page 6700 "Exchange Sync. Setup"](../page/6700.md) (3 calls: `EvaluatePasswordRequired → GetAccessTokenAsSecretText`, `EvaluatePasswordRequired → GetO365Resource`, `EvaluatePasswordRequired → GetO365ResourceName`)
- [Table 5080 "To-do"](../table/5080.md) (3 calls: `Initialize → GetAccessTokenAsSecretText`, `Initialize → GetO365Resource`, `Initialize → GetO365ResourceName`)
- [Codeunit 4507 "Email - OAuth Client"](../codeunit/4507.md) (2 calls: `TryGetAccessTokenInternal → GetAccessTokenAsSecretText`, `TryGetAccessTokenInternal → GetLastErrorMessage`)
- [Codeunit 7108 "O365 Graph Authentication"](../codeunit/7108.md) (2 calls: `GetAccessToken → GetAccessTokenAsSecretText`, `GetAccessToken → GetO365ResourceName`)
- [Page 6301 "Azure AD App Setup Part"](../page/6301.md) (2 calls: `OnOpenPage → GetRedirectUrl`, `SetReplyURLWithDefault → GetDefaultRedirectUrl`)
- [Page 9553 "Document Service Setup"](../page/9553.md) (2 calls: `AppendOAuthChangeToSummaryList → IsAzureADAppSetupDone`, `TestConnection → GetAccessTokenAsSecretText`)
- [Codeunit 1164 "COHUB API Request"](../codeunit/1164.md) (1 call: `GetGuestAccessToken → GetGuestAccessToken`)
- [Codeunit 1686 "Email Logging OAuth Client"](../codeunit/1686.md) (1 call: `TryGetAccessTokenInternal → GetAccessTokenAsSecretText`)
- [Codeunit 2752 "Universal Print Graph Helper"](../codeunit/2752.md) (1 call: `TryGetAccessToken → GetAccessTokenAsSecretText`)
- [Codeunit 4586 "SOA Dispatcher"](../codeunit/4586.md) (1 call: `AddTask → GetAccessTokenAsSecretText`)
- [Codeunit 5321 "Exchange Web Services Server"](../codeunit/5321.md) (1 call: `InitializeWithOAuthToken → CreateExchangeServiceWrapperWithToken`)
- [Codeunit 6334 "Power BI Upload Step Runner"](../codeunit/6334.md) (1 call: `UpdateParameters → GetAccessTokenAsSecretText`)
- [Codeunit 6400 "Flow Service Management"](../codeunit/6400.md) (1 call: `GetEnvironments → GetAccessTokenAsSecretText`)
- [Codeunit 6710 "ODataUtility"](../codeunit/6710.md) (1 call: `CreateMetadataWebRequest → GetAccessTokenAsSecretText`)
- [Codeunit 6722 "Booking Manager Handler"](../codeunit/6722.md) (1 call: `OnRegisterAppointmentConnection → GetAccessTokenAsSecretText`)
- [Codeunit 6938 "EA Agent Dispatcher"](../codeunit/6938.md) (1 call: `AddTask → GetAccessTokenAsSecretText`)
- [Codeunit 6941 "EA Http Client"](../codeunit/6941.md) (1 call: `TryGetAccessToken → GetAccessTokenAsSecretText`)
- [Codeunit 9033 "Invite External Accountant"](../codeunit/9033.md) (1 call: `InvokeRequest → GetGuestAccessToken`)
- [Page 1803 "Assisted Company Setup Wizard"](../page/1803.md) (1 call: `TryDownloadCompanyDetailsFromMicrosoft365 → GetAccessTokenAsSecretText`)
- [Page 6302 "Azure AD Access Dialog"](../page/6302.md) (1 call: `GetAuthorizationCodeAsSecretText → IsAzureADAppSetupDone`)
- [Page 6327 "Power BI Embed Setup Wizard"](../page/6327.md) (1 call: `TryAzureAdMgtGetAccessToken → GetAccessTokenAsSecretText`)
- [Page 9033 "Invite External Accountant"](../page/9033.md) (1 call: `GetWebClientUrl → GetInitialTenantDomainName`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25, BC28

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Azure AD Mgt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
