microsoftgraph / powershell-intune-samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.37k stars 658 forks source link

HTTP Status BadRequest DeviceConfiguration_Import_FromJSON.ps1:343 #179

Open jamesvincent opened 3 years ago

jamesvincent commented 3 years ago

When attempting to import from JSON (a file that contains a SecretReferenceValueId, I'm receiving the following error.

This previously worked, and has seemingly stopped in the last few weeks. JSON files without the SecretReferenceValueId still appear to import.

A similar issue is reported on Reddit; https://www.reddit.com/r/Intune/comments/ou1vbk/intune_import_device_configuration_graph_api/

`Adding Device Configuration Policy 'PolicyName' Response content: {"error":{"code":"NotSupported","message":"{\r\n \"_version\": 3,\r\n \"Message\": \"SecretReferenceValueId invalid for create. - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: redacted - Url: https://fef.msub01.manage.microsoft.com/DeviceConfiguration_2107/StatelessDeviceConfigurationFEService/deviceManagement/deviceConfigurations?api-version=5021-05-26\",\r\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{}\"\r\n}","innerError":{"date":"2021-08-12T13:58:38","request-id":"redacted ","client-request-id":"redacted "}}} Add-DeviceConfigurationPolicy : Request to https://graph.microsoft.com/Beta/deviceManagement/deviceConfigurations failed with HTTP Status BadRequest Bad Request At C:\Users\redacted \Scripts\Intune\DeviceConfiguration\DeviceConfiguration_Import_FromJSON.ps1:343 char:1

Bioflap commented 3 years ago

When I'm trying to import a JSON OMA-URI with Strings it seems to fail. The integers seem to be OK. Is there a way to export them non-encrypted? There are no "confidential" things in the configuration.. Without the strings it's working good.

tadakatsukami commented 3 years ago

Good afternoon. Can someone please let me know what I am missing, When Exporting CSPs I am getting the following. "secretReferenceValueId": "12345678990", "isEncrypted": true, "value": "****"

is there a trigger I am missing to export these settings unencrypted?

Thanks