Error adding Icon when running New-DeviceAppManagement_MobileApps command
See original GitHub issueI am trying to run the New-DeviceAppManagement_MobileApps to add Android Applications. I have had it working with the following command:
New-DeviceAppManagement_MobileApps -androidStoreApp -displayName $Application.Name -appStoreUrl $application.URL -publisher $application.Publisher `
-Description $application.Description -minimumSupportedOperatingSystem $androidVersion
But when I try to add an icon, I keep getting a 400 ERROR code back. I tried to create the same application using the GRAPH API with the icon, and that works
I noticed the icon parameter requires a MimeContent Object So first I created one. The Value of the Mimecontent should be a byte, that is why I ran this code:
$encoding = [system.Text.Encoding]::UTF8
$iconResponse = Invoke-WebRequest $application.Icon
$iconExt = ([System.IO.Path]::GetExtension("$application.Icon")).replace(".","")
$iconType = "image/$iconExt"
$data = $encoding.GetBytes($iconResponse.Content)
If I then run the following, it creates the object
$icon = New-MimeContentObject -type $iconType -value $data
But using that object in the New-DeviceAppManagement_MobileApps function gives a 404 error
400 Bad Request { "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: bcded7cb-75bc-4658-bc16-f333fd06f6c7 - Url: https://fef.amsub0102.manage.microsoft.com/StatelessAppMetadataFEService/deviceAppManagement/mobileApps?api-version=2018-03-22\",\r\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{}\"\r\n}", "innerError": { "request-id": "bcded7cb-75bc-4658-bc16-f333fd06f6c7", "date": "2018-10-15T19:08:08" } } }
This is the command I use:
New-DeviceAppManagement_MobileApps -androidStoreApp -displayName $Application.Name -appStoreUrl $application.URL -publisher $application.Publisher
-Description $application.Description -minimumSupportedOperatingSystem $androidVersion -largeIcon $icon`
I also tried:
New-DeviceAppManagement_MobileApps -androidStoreApp -displayName $Application.Name -appStoreUrl $application.URL -publisher $application.Publisher
-Description $application.Description -minimumSupportedOperatingSystem $androidVersion -largeIcon (New-MimeContentObject -type $iconType -value $data)`
But that doesn’t work aswell.
Running the same code without the largeicon URL fixes the problem
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Looking into it, I will get back to you soon.
That did it, thank your very much1