Errors with empty arrays on diffs and test-resource
Description of the issue
I'm getting errors when running the new DSC update in regards to conditional access policies. It doesn't seem to like empty arrays for properties. They also appear on the delta reports as empty diffs.
eg. IncludeUsers, ExcludeUsers on "AADConditionalAccessPolicy"
This seems to stem from the change done here: https://github.com/Microsoft365DSC/Microsoft365DSC/pull/7090/changes#diff-f40dfa06c560855c0fcb1d9f70f889ffca30a53863d7993c1de903ff5c126630R146
When reverting Write-Output -InputObject $array -NoEnumerate back to the old ,$array it runs through without the issue.
Microsoft 365 DSC Version
1.26.506.1
Which workloads are affected
other
The DSC configuration
# Generated with Microsoft365DSC version 1.26.506.1
# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC
param (
)
Configuration M365TenantConfig
{
param (
)
$OrganizationName = $ConfigurationData.NonNodeData.OrganizationName
Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.26.506.1'
Node localhost
{
AADConditionalAccessPolicy "Require app protection policy or approved client app For internal users When using mobile apps on iOS or Android"
{
ApplicationEnforcedRestrictionsIsEnabled = $False;
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
AuthenticationContexts = @();
BuiltInControls = @("approvedApplication","compliantApplication");
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
ClientAppTypes = "mobileAppsAndDesktopClients";
CloudAppSecurityIsEnabled = $False;
CloudAppSecurityType = "";
DeviceFilterRule = "";
DisplayName = "Require app protection policy or approved client app For internal users When using mobile apps on iOS or Android";
Ensure = "Present";
ExcludeApplications = @();
ExcludeExternalTenantsMembershipKind = "all";
ExcludeGroups = @("Example-Group");
ExcludeGuestOrExternalUserTypes = @("internalGuest","b2bCollaborationGuest","b2bCollaborationMember","b2bDirectConnectUser","otherExternalUser","serviceProvider");
ExcludeLocations = @();
ExcludeRoles = @();
ExcludeUsers = @();
GrantControlOperator = "OR";
Id = "XXXXXXXXX-XXXXXXXXXX";
IncludeApplications = @("Office365");
IncludeExternalTenantsMembershipKind = "";
IncludeGroups = @();
IncludeLocations = @();
IncludePlatforms = @("android","iOS");
IncludeRoles = @();
IncludeUserActions = @();
IncludeUsers = @("All");
PersistentBrowserIsEnabled = $False;
PersistentBrowserMode = "";
ProtocolFlows = @();
SecureSignInSessionIsEnabled = $False;
SignInFrequencyIsEnabled = $False;
SignInFrequencyType = "";
State = "enabledForReportingButNotEnforced";
TenantId = $OrganizationName;
TransferMethods = "";
}
}
}
M365TenantConfig -ConfigurationData .\ConfigurationData.psd1
Verbose logs showing the problem
VERBOSE: [runnervmjeyax]: LCM: [ Start Resource ] [[AADConditionalAccessPolicy]Data...
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
+ PSComputerName : localhost
iOS or Android]
VERBOSE: [runnervmjeyax]: LCM: [ Start Test ] [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android]
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Testing configuration of the AADConditionalAccessPolicy with DisplayName {Data protection - O365:
Require app protection policy or approved client app For internal users When using mobile apps on iOS or Android}
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Getting configuration of AzureAD Conditional Access Policy for {Data protection - O365: Require
app protection policy or approved client app For internal users When using mobile apps on iOS or Android}
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] PolicyID was specified
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Couldn't find existing policy by ID {XXXXXXX-XXXX}
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Found existing Conditional Access policy
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Process IncludeUsers
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Process ExcludeUsers
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Process IncludeGroups
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Process ExcludeGroups
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
iOS or Android] Get-TargetResource: Location condition defined, processing
VERBOSE: [runnervmjeyax]: [[AADConditionalAccessPolicy]Data...
protection - O365: Require app protection policy or approved client app For internal users When using mobile apps on
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
Environment Information + PowerShell Version
PS5.1
Thanks, I'll take a look at it
Confirmed and will be resolved with the mentioned PR. Thanks for the heads up.