4
votes

Using the Microsoft Graph API it is possible to create Azure Applications using the applications end point. https://docs.microsoft.com/en-us/graph/api/application-post-applications?view=graph-rest-1.0&tabs=http

An application has a logo and when you add it through the Azure Portal then the info/logoUrl property has a value. How do you set the logo through the graph? I've tried setting it to a url and there is no error, but the value does not get set.

3

3 Answers

3
votes

As mentioned in another reply, the info/logoUrl is Read-only in Microsoft Graph, we could not set it directly, also per my test, even the request returns 204, it will not take effect.

My workaround is to use the Azure AD Graph API, you could try the request below in the postman, it works on my side.

Request URL:

PUT https://graph.windows.net/<tenant-id>/applications/<object-id>/mainLogo?api-version=1.6

In the postman, Authorization -> Bearer token -> fill your token, in the Body, select binary -> Select file, then Send.

Note: Your picture could not be large, otherwise you will get a The stream write request would result in an excessive number of bytes being written error.

enter image description here

enter image description here

Check in the portal:

enter image description here


Besides, if you just want to set the logo Programmatically, you could use the powershell Set-AzureADApplicationLogo, it is the easiest way I can find.

Set-AzureADApplicationLogo -ObjectId <object-id> -FilePath C:\Users\joyw\Desktop\pic1.jpg
3
votes

Microsoft Graph API v1.0 now supports uploading logos, although I was unable to find this particular endpoint in their documentation but this may be because the v1.0 API is only a couple of weeks old at time of writing.

Request:

Content-Type: image/png
PUT https://graph.microsoft.com/v1.0/applications/<object-id>/logo
<binary content>

In Postman, you can set binary body content by going to Body and then clicking binary from the radio buttons. Make sure you set the Content-Type header accordingly, e.g. image/png for a .png file

Postman binary content

You will receive a 204 No Content empty response on success, it appears to take effect immediately in the Azure Portal when viewing the App Registration.

0
votes

I'm afraid we can't modify the logo through the Microsoft Graph API.

The info/logoUrl is read-only based on informationalUrl resource type.