Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

AADConditionalAccessPolicy: Add ServicePrincipalRiskLevels

Open MarzelLaning42 opened this issue 1 year ago • 0 comments

Description of the issue

Conditional Access for workload identity allows for selecting ServicePrincipalRiskLevels, but Microsoft365DSC does not.

Microsoft 365 DSC Version

1.25.611.1

Which workloads are affected

Azure Active Directory (Entra ID)

The DSC configuration


Verbose logs showing the problem

AADConditionalAccessPolicy "AADConditionalAccessPolicy-9999-test-workload"
        {
            ApplicationEnforcedRestrictionsIsEnabled = $False;
            ApplicationId                            = $ConfigurationData.NonNodeData.ApplicationId;
            AuthenticationContexts                   = @();
            BuiltInControls                          = @("block");
            CertificateThumbprint                    = $ConfigurationData.NonNodeData.CertificateThumbprint;
            ClientAppTypes                           = @("all");
            CloudAppSecurityIsEnabled                = $False;
            CloudAppSecurityType                     = "";
            CustomAuthenticationFactors              = @();
            DeviceFilterRule                         = "";
            DisableResilienceDefaultsIsEnabled       = $False;
            DisplayName                              = "9999-test-workload";
            Ensure                                   = "Present";
            ExcludeApplications                      = @();
            ExcludeExternalTenantsMembers            = @();
            ExcludeExternalTenantsMembershipKind     = "";
            ExcludeGroups                            = @();
            ExcludeLocations                         = @();
            ExcludePlatforms                         = @();
            ExcludeRoles                             = @();
            ExcludeServicePrincipals                 = @();
            ExcludeUsers                             = @();
            GrantControlOperator                     = "OR";
            Id                                       = "xxxx-2c653034b4e0";
            IncludeApplications                      = @("All");
            IncludeExternalTenantsMembers            = @();
            IncludeExternalTenantsMembershipKind     = "";
            IncludeGroups                            = @();
            IncludeLocations                         = @();
            IncludePlatforms                         = @();
            IncludeRoles                             = @();
            IncludeServicePrincipals                 = @("xxxx-9cd966b76c98");
            IncludeUserActions                       = @();
            IncludeUsers                             = @("None");
            PersistentBrowserIsEnabled               = $False;
            PersistentBrowserMode                    = "";
            SignInFrequencyIsEnabled                 = $False;
            SignInFrequencyType                      = "";
            SignInRiskLevels                         = @();
            State                                    = "enabledForReportingButNotEnforced";
            TenantId                                 = $OrganizationName;
            TransferMethods                          = "";
            UserRiskLevels                           = @();
        }

Exporting the CA policy with Graph shows the risk levels: 

(Get-MgIdentityConditionalAccessPolicy | where {$_.displayname -eq "9999-test-workload"}).conditions | fl

Applications               : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessApplications
ClientAppTypes             : {all}
ClientApplications         : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessClientApplications
Devices                    : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessDevices
InsiderRiskLevels          : 
Locations                  : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessLocations
Platforms                  : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessPlatforms
ServicePrincipalRiskLevels : {high, medium, low}
SignInRiskLevels           : {}
UserRiskLevels             : {}
Users                      : Microsoft.Graph.PowerShell.Models.MicrosoftGraphConditionalAccessUsers
AdditionalProperties       : {}

Environment Information + PowerShell Version

not relevant

MarzelLaning42 avatar Jun 18 '25 11:06 MarzelLaning42