Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Intune: An error occurred while exporting resource {IntuneDeviceEnrollmentPlatformRestriction}

Open Dekor86 opened this issue 2 weeks ago • 1 comments

Description of the issue

Since upgrading to 2.26.1104.1 we have a new error relating to export of IntuneDeviceEnrollmentPlatformRestriction component.

This is an Android platform device enrollment restriction and worked in previous versions.

Error Log created at {file://C:/Users/VSSADM~1/AppData/Local/Temp/4288-M365DSC-ErrorLog.log}
Error Log created at {file://C:/Users/VSSADM~1/AppData/Local/Temp/4288-M365DSC-ErrorLog.log}
[74/160] Extracting [IntuneDeviceEnrollmentPlatformRestriction] using {CertificateThumbprint}...
    |---[1/2] pol-ios-restriction❌
    An error occurred while exporting resource {IntuneDeviceEnrollmentPlatformRestriction}: Cannot assign property 'IosRestriction' on resource 'IntuneDeviceEnrollmentPlatformRestriction': a value of type 'System.Collections.Hashtable' does not convert to 'MSFT_DeviceEnrollmentPlatformRestriction'. The value carries member(s) not declared on 'MSFT_DeviceEnrollmentPlatformRestriction': isServerEnrollmentBlocked.

I have manually queried the policy via Graph and can see that the isServerEnrollmentBlocked property is set to "true" within the tenant. Issue seems to be when extracting it to snapshot.

Microsoft 365 DSC Version

2.26.1104.1

Which workloads are affected

Intune

The DSC configuration

=
Export-M365DSCConfiguration  
   -ApplicationId "$(appID)" 
   -TenantId "$(tenantDomain)"  
   -CertificateThumbprint "$(certificateThumbprint)" 
   -Workloads @( "INTUNE" )  
   -Mode Full   
   -Validate 
   -Path $snapshotPath 
   -FileName "devTenantSnapshot-Batch2.ps1"  
   -ConfigurationName "DevTenantSnapshot" 
   -WithStatistics

Verbose logs showing the problem

{OperationStopped}

System.InvalidOperationException: Cannot assign property 'IosRestriction' on resource 'IntuneDeviceEnrollmentPlatformRestriction': a value of type 'System.Collections.Hashtable' does not convert to 'MSFT_DeviceEnrollmentPlatformRestriction'. The value carries member(s) not declared on 'MSFT_DeviceEnrollmentPlatformRestriction': isServerEnrollmentBlocked.

"Error retrieving data:"

at _SetProperty, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\_Shared.psm1: line 431

at FromHashtable, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\_Shared.psm1: line 853

at AsResult, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\Part08.psm1: line 15513

at Get, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\Part08.psm1: line 14992

at GetForExport, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\_Shared.psm1: line 1224

at Export, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\Part08.psm1: line 15226

at Invoke-M365DSCResourceMethod, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Classes\_Shared.psm1: line 1611

at <ScriptBlock>, <No file>: line 136

at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Modules\M365DSCReverse.psm1: line 1073

at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\2.26.1104.1\Modules\M365DSCExportUtil.psm1: line 510

at <ScriptBlock>, D:\a\_temp\4672af70-ccaf-49fe-87f0-3bce3abf4117.ps1: line 10

at <ScriptBlock>, <No file>: line 1

Environment Information + PowerShell Version

Azure Pipelines, using PowerShell task 2.281.0 (PowerShell 7), agent is windows-latest

https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell

Dekor86 avatar Nov 18 '26 09:11 Dekor86

That was caused by a change made by Microsoft in their back end where the newly introduced property was missing in our resource but it's already fixed and merged on https://github.com/Microsoft365DSC/Microsoft365DSC/pull/7647, just wait for next release to get the fix or just apply it yourself since it's a very small fix.

image

ricmestre avatar Nov 18 '26 11:11 ricmestre