diff --git a/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al b/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al index 6f964169b6..b798730298 100644 --- a/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al +++ b/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al @@ -62,6 +62,17 @@ codeunit 433 "Azure AD Tenant" exit(AzureADTenantImpl.GetPreferredLanguage()); end; + /// + /// Gets the verified domain names registered on the current Microsoft Entra tenant. + /// If the Microsoft Graph API cannot be reached, the error is displayed. + /// + /// A list of verified domain names (e.g. "contoso.com", "contoso.onmicrosoft.com"). + /// Cannot retrieve the Microsoft Entra tenant verified domains. + procedure GetVerifiedDomains(): List of [Text] + begin + exit(AzureADTenantImpl.GetVerifiedDomains()); + end; + /// /// Gets the Power Platform tenant URL. /// diff --git a/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al b/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al index 45a9bf27a0..7af4638ad4 100644 --- a/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al +++ b/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al @@ -21,6 +21,7 @@ codeunit 3705 "Azure AD Tenant Impl." TenantDomainNameErr: Label 'Failed to retrieve the Microsoft Entra tenant domain name.'; CountryLetterCodeErr: Label 'Failed to retrieve the Microsoft Entra tenant country letter code.'; PreferredLanguageErr: Label 'Failed to retrieve the Microsoft Entra tenant preferred language code.'; + VerifiedDomainsErr: Label 'Failed to retrieve the Microsoft Entra tenant verified domains.'; procedure GetAadTenantId(): Text var @@ -62,6 +63,20 @@ codeunit 3705 "Azure AD Tenant Impl." Error(PreferredLanguageErr); end; + procedure GetVerifiedDomains() Domains: List of [Text] + var + VerifiedDomain: DotNet VerifiedDomainInfo; + begin + Initialize(); + if IsNull(TenantInfo) then + Error(VerifiedDomainsErr); + + foreach VerifiedDomain in TenantInfo.VerifiedDomains() do + if not IsNull(VerifiedDomain) then + if VerifiedDomain.Name() <> '' then + Domains.Add(VerifiedDomain.Name()); + end; + procedure GetPowerPlatformTenantURL(): Text var PowerPlatformApiWrapper: dotnet "PowerPlatformApiWrapper"; diff --git a/src/System Application/App/DotNet Aliases/src/dotnet.al b/src/System Application/App/DotNet Aliases/src/dotnet.al index a926a78eb2..581faecc5f 100644 --- a/src/System Application/App/DotNet Aliases/src/dotnet.al +++ b/src/System Application/App/DotNet Aliases/src/dotnet.al @@ -572,6 +572,10 @@ dotnet type("Microsoft.Dynamics.Nav.LicensingService.Model.UserInfo"; "UserInfo") { } + + type("Microsoft.Dynamics.Nav.LicensingService.Model.VerifiedDomainInfo"; "VerifiedDomainInfo") + { + } } assembly("Microsoft.Dynamics.Nav.NavUserAccount")