2
votes

I am trying to create a managed device in Intune using the following Microsoft Graph but it keeps erroring out.

I also get an error when trying to update an existing device record.

I have the appropriate scopes and my account is an Intune admin. Any suggestions?

Here is the example error I receive when trying to update using PATCH

"error": {
    "code": "InternalError",
    "message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 7d3aea54-282a-4911-99a5-af3d2422f81a - Url: https://fef.amsua0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/managedDevices%28%278f312966-1c51-403b-9b3a-6cf52643fa70%27%29?api-version=5017-09-07 - CustomApiErrorPhrase: ",
    "innerError": {
        "request-id": "7d3aea54-282a-4911-99a5-af3d2422f81a",
        "date": "2017-11-02T12:16:55"
    }
}
2

2 Answers

1
votes

They have changed the endpoint without updating the documentation..

Use: /deviceManagement/managedDevices

It's a beta so endpoints and (more frequently) required parameters in the json object chances.. I've figured out a lot of these changes by simply looking at posts from the developer mode in a browser. The documentation is often behind the actual implementation.

And yea this worked. sorry for late response..

Edit2:

I don't have an example to create a managed device. But this is an example on how to create an empty device configuration:

$Endpoint = "https://graph.microsoft.com/beta"

    ## Win10
    $Win10 = [pscustomobject]@{
        '@odata.type' = "#microsoft.graph.windows10GeneralConfiguration"
        'description' = "standard Windows 10 Device Restriction Configuration"
        'displayName' = "Win10"
    }
    $Win10params = @{
        ContentType = 'application/json'
        Headers = $Header
        Body = $Win10 | ConvertTo-Json -Compress
        Method = 'POST'      
        URI = "$Endpoint/deviceManagement/deviceConfigurations"
    }
Invoke-RestMethod @Win10params

But again. Take a look at the POST in the developer tab, and then start by trying out parameters from the top. If the documentation isn't updated with the least required parameters, you will have to go through it step by step..

0
votes

They have changed the endpoint without updating the documentation..

Use: /deviceManagement/managedDevices