1

I'm trying to send a post request in PowerShell to https://graph.microsoft.com/beta/deviceAppManagement/mobileApps using the Graph API for the android managed store app but I keep getting an error. This works for other odata.types but not for androidManagedStoreApp. Here is my JSON data:

{
"@odata.type":  "#microsoft.graph.androidManagedStoreApp",
"displayName":  "Microsoft Excel",
"description":  "Create Spreadsheets yo",
"publisher":  "Microsoft Corporation",
"largeIcon":  {
    "@odata.type": "microsoft.graph.mimeContent",
    "type": "Type value",
    "value": "dmFsdWU="
},
"isFeatured":  false,
"privacyInformationUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"informationUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"owner":  'james',
"developer":  'james',
"notes":  'james',
"uploadState":  0,
"publishingState":  "processing",
"isAssigned":  false,
"roleScopeTagIds":  [

                    ],
"dependentAppCount":  0,
"packageId":  "com.microsoft.office.excel",
"appIdentifier":  "com.microsoft.office.excel",
"usedLicenseCount":  0,
"totalLicenseCount":  1,
"appStoreUrl":  "https://play.google.com/store/apps/details?id=com.microsoft.office.excel&hl=en_US",
"isPrivate":  false,
"isSystemApp":  false,
"supportsOemConfig":  false,
"appTracks":  []

}

For reference I've followed the way the data is formatted on MS's

https://learn.microsoft.com/en-us/graph/api/intune-apps-androidmanagedstoreapp-create?view=graph-rest-beta

PowerShell code:

$JSONData = Get-Content "C:\Kits\Excel.json"
$Endpoint = "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps"
Invoke-WebRequest -Uri $Endpoint -Headers $Global:AuthToken -Method Post -Body $JSONData

This is the error I'm receiving:

Invoke-WebRequest : { "error": { "code": "BadRequest", "message": "{\r\n \"_version\": 3,\r\n \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 64234aa8-4195-4a11-a900-3ae515c385ee - Url: htt ps://fef.amsua0202.manage.microsoft.com/AppLifecycle/StatelessAppMetadataFEService/deviceAppManagem ent/mobileApps?api-version=5020-03-19\",\r\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{}\"\r\n}", "innerError": { "request-id": "64234aa8-4195-4a11-a900-3ae515c385ee", "date": "2020-04-23T19:37:40" } } }

mallockey
  • 56
  • 4

1 Answers1

0

The beta Graph APIs usually have incorrect details/examples, always check each value to see if it makes sense.

Looks like uploadState, publishingState, isAssigned, usedLicenseCount and totalLicenseCount are determined server-side, so you shouldn't need to provide their values. Maybe try making a request without them?

Also, largeIcon doesn't match the spec, should be

"largeIcon":  {
    "@odata.type": "#microsoft.graph.mimeContent",
    "type": "String",
    "value": "dmFsdWU="
}

Note the '#' in front of 'microsoft'.

pl4nty
  • 66
  • 5
  • Hey thanks, I tried your suggestions but still not able to upload it. – mallockey Apr 27 '20 at 14:46
  • @mallockey maybe check the properties of an app created through the GUI? Use [this](https://learn.microsoft.com/en-us/graph/api/intune-apps-androidmanagedstoreapp-list?view=graph-rest-beta#request) to get a list of `appIds`, and [this](https://learn.microsoft.com/en-us/graph/api/intune-apps-androidmanagedstoreapp-get?view=graph-rest-beta#request) to get the properties of one. – pl4nty Apr 27 '20 at 23:45
  • Yeah I've done that. I've tried every combination I can think of no dice. – mallockey Apr 28 '20 at 21:18
  • Hmm. Maybe replace the single quotes (eg `"owner": 'james'`) with double quotes (`"`)? Currently spinning up my dev tenant to have a play cause Graph Explorer doesn't support it – pl4nty Apr 30 '20 at 05:25
  • I still don't have a dev tenant, MS needed 10 days to delete my old one and another week to run up a new one :( – pl4nty May 11 '20 at 23:21