jseerden / IntuneBackupAndRestore

PowerShell Module that queries Microsoft Graph, and allows for cross-tenant Backup & Restore actions of your Intune Configuration.
MIT License
345 stars 102 forks source link

Invoke-IntuneRestoreDeviceConfiguration > "400 Bad Request" for custom profiles that contain XML content #41

Open Beer2Beer1 opened 3 years ago

Beer2Beer1 commented 3 years ago

Restoring configuration profile fails for custom profile containing XML content (such as Windows 10 Start Layout for instance).

Example .json attached as .txt, rename to .json to use for reproduction. Win10 StartLayout.txt

PS C:\WINDOWS\system32> $TempBackUpPath = "C:\temp\Test"
>> Invoke-IntuneRestoreDeviceConfiguration -Path $TempBackUpPath

VERBOSE: Win10 StartLayout - Failed to restore Device Configuration
Invoke-IntuneRestoreDeviceConfiguration : 400 Bad Request
{"error":{"code":"ModelValidationFailure","message":"Cannot convert the literal '<LayoutModificationTemplate [...]'
to the expected type 'Edm.Binary'.","date":"2021-09-02T08:34:13","request-id":"78a741d9-6e29-45ff-a5
37-dfeea5a79ab3","client-request-id":"78a741d9-6e29-45ff-a537-dfeea5a79ab3"}}}
At line:1 char:1
+ Invoke-IntuneRestoreDeviceConfiguration -Path $TempBackUpPath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-IntuneRestoreDeviceConfiguration