400 Bad request when importing iOS Device Configuration Policies
JelleMarc opened this issue · 4 comments
Hi Jseerden,
After installing the newest version we are still receiving an error when importen the iOS Device Configuration file:
Invoke-IntuneRestoreDeviceCompliancePolicy : 400 Bad Request
{
"error": {
"code": "ModelValidationFailure",
"message": "An entry with type 'microsoft.management.services.api.iosGeneralDeviceConfiguration' was found, but it
is not assignable to the expected type 'microsoft.management.services.api.deviceCompliancePolicy'. The type specified
in the entry must be equal to either the expected type or a derived type.",
"innerError": {
"message": "An entry with type 'microsoft.management.services.api.iosGeneralDeviceConfiguration' was found, but
it is not assignable to the expected type 'microsoft.management.services.api.deviceCompliancePolicy'. The type
specified in the entry must be equal to either the expected type or a derived type.",
"date": "2021-02-22T13:07:28",
"request-id": "9930a335-2ec1-4e0f-af3f-d467a9eed3cb",
"client-request-id": "9930a335-2ec1-4e0f-af3f-d467a9eed3cb"
}
}
}
At C:\Program Files\WindowsPowerShell\Modules\IntuneBackupAndRestore\2.1.1\Public\Start-IntuneRestoreConfig.ps1:27
char:5
-
Invoke-IntuneRestoreDeviceCompliancePolicy -Path $Path
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-IntuneRestoreDeviceCompliancePo
licy
Originally posted by @JelleMarc in #25 (comment)
Hi @JelleMarc
Did you create a new backup of the iOS device configuration, before trying to restore? Older backups will fail, as they are missing some data in the JSON.
If so, would you please be so kind to share the .json content, so I can troubleshoot further? Thanks
Hi @jseerden ,
I have created a new export on the new version before trying to run an import.
The JSON file is attached (changed the extension to .txt so that I can upload the file). If there is anything I can do to help troubleshoot please let me know.
iOS Device Restrictions.txt
Hi @JelleMarc , the issue you posted is that you are trying to restore a Device Configuration Profile with the Device Compliance Policy restore cmdlet.
Make sure to use the Invoke-IntuneBackupDeviceConfiguration
cmdlet instead of Invoke-IntuneBackupDeviceCompliancePolicy
when restoring Device Configuration Profiles. With that cmdlet I was able to succesfully restore the policy.
@slappa81 The screenshot you've posted refers to an issue that was resolved with IntuneBackupAndRestore version 2.1.1. Make sure to update and create a new backup before trying to restore.