简体   繁体   中英

Unable to add application assignment using Microsoft Graph API

When creating a request to assign an app to an AD group in Azure Intune using the graph API, i get the following response.

 {  "error": {
"code": "ModelValidationFailure",
"message": "Cannot create an abstract class.",
"innerError": {
  "message": "Cannot create an abstract class.",
  "request-id": "removed",
  "date": "removed"
}  }}

and here's my post data

{ "@odata.type": "#microsoft.graph.mobileAppAssignment", "intent": "required", "target": { "@odata.type": "microsoft.graph.groupAssignmentTarget", "groupId": "removed"  }, "settings": { "@odata.type": "microsoft.graph.mobileAppAssignmentSettings"}}

Here's the reference i've used to generate the json data: https://docs.microsoft.com/en-us/graph/api/intune-apps-mobileappassignment-create?view=graph-rest-beta

And I'm not sure if it something to do with my json input or if the graph api endpoint has an issue.

microsoft.graph.mobileAppAssignmentSettings is an abstract class. You'll need to provide a concrete implementation of assignment settings eg microsoftStoreForBusinessAppAssignmentSettings or iosStoreAppAssignmentSettings .

Your post data in this case could be:

{
  "@odata.type": "#microsoft.graph.mobileAppAssignment",
  "intent": "required",
  "target": {
    "@odata.type": "microsoft.graph.groupAssignmentTarget",
    "groupId":"removed"
  },
  "settings": {
    "@odata.type": "microsoft.graph.microsoftStoreForBusinessAppAssignmentSettings",
    "useDeviceContext":"true"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM