microsoftgraph / microsoft-graph-explorer-v4

React/Redux version of Graph Explorer used to learn the Microsoft Graph Api
https://developer.microsoft.com/graph/graph-explorer
MIT License
213 stars 93 forks source link

Inconsistency in Config Import via PowerShell #2165

Closed AcpPasc closed 1 year ago

AcpPasc commented 2 years ago

Describe the bug We discovered, that one of our Imports of a Configuration json completes successfully but a few Settings are missing (NOT ALL)! To be more Specific a #microsoft.graph.iosGeneralDeviceConfiguration. We used the Intune-Config-Frameworks as template and added our own changes. We discovered that when we import the Configuration via Powershell (With Token, ContentType "application/json" and the Invoke-RestMethod Command) that some Settigns are not Imported as "ture"/Condigured. If we Export, import and export again we get this diff: image What is strange if I import the same Config JSON in https://developer.microsoft.com/en-us/graph/graph-explorer it gets imported Correct. We did not have this issue with android Configurations or other Configs as far as I am aware. Furthermore I would like to know why only some settings are missing and others not.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'MEM configProfiles iOS'
  2. Create a Device Restriction Policy
  3. Set the Settings in the Diff shown above
    • Block backup of enterprise books
    • Block notes and highlights sync for enterprise books
    • Block removal of system apps from device
    • Allow copy/paste to be affected by managed open-in
  4. Open a Powershell
  5. Get an Auth-Token Token Script
  6. Export the Configuration (to a File or Clipboard)
    https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations/{deviceConfiguration-id}
    Invoke-RestMethod -Uri $uri -Headers $global:authToken
  7. Import the Configuration
    $JSON = "EXPORTED CONFIG"
    https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations
    Invoke-RestMethod -Uri $uri -Headers $global:authToken -Method Post -Body $JSON -ContentType "application/json"
  8. Export the config again and check diffrences

Expected behavior I expect the Imported Config to be the same as my Json or completely not Configured if it failes, but not some missing and some not.

Desktop (please complete the following information):

Additional context We use Powershell Scripts to Export Tested Configurations and import them to our Customers, we need to be able to trust, that what we import will be what we configured or throw an error.

ElinorW commented 2 years ago

Hey @AcpPasc , To try and understand the issue here, Are these differences only present when you export, import, and export the scripts on PowerShell? On Graph Explorer, the settings are the same?

AcpPasc commented 2 years ago

Hey @ElinorW The differences are, like you assumed only presend if we import via PowerShell I didn't see differences, if I Import the same File via Graph Explorer.

ElinorW commented 2 years ago

@AcpPasc this seems to be a problem with PowerShell... We only handle issues related to Graph Explorer, and going by your comments seems like Graph Explorer is providing the expected results.

AcpPasc commented 2 years ago

That is true. What is confusing for me, is that i think i am doing the same API Request as the Explorer but get a diffrent result.

ElinorW commented 2 years ago

I think it might be something with PowerShell

RabebOthmani commented 1 year ago

Hi @AcpPasc , as my colleagues mentioned we only handle Graph Explorer related issues here. I would recommend opening an issue on the PowerShell repo or using the community forum . Please do let us know if there are any Graph Explorer issues you're encountering.