不存在与模板匹配的OData路由-在Azure intune中添加CorporateIdentifier

cgh8pdjw  于 2023-08-07  发布在  其他
关注(0)|答案(1)|浏览(73)

GET请求列出已添加的公司设备标识符的工作原理:

https://graph.microsoft.com/beta/deviceManagement/importedDeviceIdentities

字符串
POST请求添加公司标识如下,我收到错误:

https://graph.microsoft.com/beta/deviceManagement/importedDeviceIdentities
{
  "@odata.type": "#microsoft.graph.importedDeviceIdentity",
  "importedDeviceIdentifier": "01HW0000",
  "importedDeviceIdentityType": "serialNumber",
  "lastContactedDateTime": "2019-12-31T23:58:44.2908994-08:00",
  "description": "C02CCCCC",
  "enrollmentState": "unknown",
  "platform": "macOS"
}

的数据
回复:

{
  "error": {
    "code": "No method match route template",
    "message": "No OData route exists that match template ~/singleton/navigation with http verb POST for request /DeviceEnrollmentFE/StatelessDeviceEnrollmentFEService/deviceManagement/importedDeviceIdentities.",
    "innerError": {
      "request-id": "be06d7c6-9016-4684-9a82-d65b50d333eb",
      "date": "2020-01-04T17:33:07"
    }
  }
}

lhcgjxsq

lhcgjxsq1#

我已经对Intune门户的正确调用进行了逆向工程,下面是一个可用的PowerShell示例。请注意,您需要Graph权限“DeviceManagementServiceConfig.ReadWrite.All”。

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("OData-MaxVersion", "4.0")
$headers.Add("OData-Version", "4.0")
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer eyTOKEN")

$body = @"
{
  `"overwriteImportedDeviceIdentities`": false,
  `"importedDeviceIdentities`": [
    {
      `"importedDeviceIdentityType`": `"serialNumber`",
      `"importedDeviceIdentifier`": `"111111xxxxx`",
      `"description`": `"description`"
    }
  ]
}
"@

$response = Invoke-RestMethod 'https://graph.microsoft.com/beta/deviceManagement/importedDeviceIdentities/importDeviceIdentityList' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json

字符串

相关问题