Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

AADApplication: Unable to configure desired configuration for PreAuthorizedApplications

Open abhisri13 opened this issue 1 year ago • 0 comments

Description of the issue

DSC bypassing desired value specified for PreAuthorizedApplications during app registration creation/update.

Looking at source code <here> it seems like during Set-TargetResource operation the parameter is being ignored.

Microsoft 365 DSC Version

V1.25.521.1

Which workloads are affected

Azure Active Directory (Entra ID)

The DSC configuration

AADApplication 'AADApplication-APPLICATION' {
    DependsOn                          = @(
        '[AADApplication]AADApplication-Microsoft365DSC'
    )
    AuthenticationBehaviors = @() ### L1|Security: Empty array ensures default authentication behaviors used.
    DisplayName             = 'APPLICATION_NAME'
    Ensure                  = 'Present'
    Api                     = MSFT_MicrosoftGraphapiApplication {
        Oauth2PermissionScopes = @(
            MSFT_MicrosoftGraphApiOauth2PermissionScopes{
                id = 'SCOPE-RANDOM-ID'
                userConsentDescription = 'SOME_USER_DESCRIPTION'
                adminConsentDescription = 'SOME_ADMIN_DESCRIPTION'
                type = 'User'
                value = 'access_as_user'
                isEnabled = $True
                userConsentDisplayName = 'SOME_USER_DISPLAY_NAME'
                adminConsentDisplayName = 'SOME_ADMIN_DISPLAY_NAME'
            }
        )
        PreAuthorizedApplications = @(
            MSFT_MicrosoftGraphPreAuthorizedApplication{
                AppId = 'SOME-RANDOM-ID'
                PermissionIds = @('SCOPE-RANDOM-ID')
            }
        )
    }
    IdentifierUris          = 'IDENTIFIER-URIS'
    KnownClientApplications = @()
    IsFallbackPublicClient  = $False
    Owners                  = @()
    Permissions             = @(
        MSFT_AADApplicationPermission{
            Name                = 'Calendars.Read'
            Type                = 'Delegated'
            SourceAPI           = 'Microsoft Graph'
        }
    )
    PublicClient            = $False
    ReplyURLs               = @()
    SignInAudience          = 'AzureADMyOrg'
    Spa                     = MSFT_AADApplicationSpa{
        RedirectUris = 'REDIRECT/URIS'
    }
    ApplicationId           = $ApplicationId
    TenantId                = $TenantId
    CertificateThumbprint   = $Thumbprint
}

Verbose logs showing the problem

N/A

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

abhisri13 avatar Jun 17 '25 02:06 abhisri13