Forum Discussion
mlister
Sep 22, 2023Copper Contributor
Issues with POST to GraphAPI with Powershell
I can export Intune policies using the API so i know i'm authenticated but when I try to POST one of the policies i get a response but its just a repeat of the JSON file and no Error or 201 success message.
Invoke-RestMethod -Uri https://graph.microsoft.com/Beta/deviceManagement/deviceCompliancePolicies -Headers $global:authToken -Method POST -Body $json_output -ContentType "application/json"
If i take the JSON file and paste it in to the body of MSGraph Explorer it works but i'm not sure why i'm not getting a response back.
No RepliesBe the first to reply