question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error adding Icon when running New-DeviceAppManagement_MobileApps command

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rohitramucommented, Oct 19, 2018

Looking into it, I will get back to you soon.

0reactions
ThijsLecomtecommented, Oct 23, 2018

That did it, thank your very much1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a win32LobApp with Graph API (POST request) ...
I keep getting 'BAD REQUEST' on all my POST attempts (Powershell, Postman) and the error doesn't exactly say what is 'BAD' in the...
Read more >
Adding serialnumbers using New- ...
I am trying to use the cmd New-MgDeviceManagementImportedDeviceIdentity to insert new serialnumbers from our assetDB. connect-mggraph works ...
Read more >
Automating App Deployment with Winget and Intune
Hi, I have a trim() command on the application name which should remove the whitespace. Any chance you can send me the transcript...
Read more >
IntuneWin32App.psm1 1.1.0
Specify the Application ID of the app registration in Azure AD. By default, the script will attempt to use well known Microsoft Intune...
Read more >
DeviceManagementApps.ReadWrite.All | Graph Permissions
Allows the app to read and write the properties, group assignments and status of apps, app configurations and app protection policies managed by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found