Renuka Maddipatla
Renuka Maddipatla

Reputation: 1

Set the logo for an Azure Application using Microsoft Graph PATCH call with request body as image URL

Here we can update logo by this url https://graph.microsoft.com/v1.0/applications/application-id/logo.

But I want update the logo using Microsoft Patch API while creating the application using Microsoft graph api. Because Users need to pass image url sometimes . I found this document https://learn.microsoft.com/en-us/graph/tutorial-applications-basics?tabs=http . Here we can update the logo by using image URL. Also I read in place logoUrl we need to pass CDN image links only.

JSON payload is

{
    "info": {
        "logoUrl": "https://cdn.pixabay.com/photo/2016/03/21/23/25/link-1271843_1280.png",
        "marketingUrl": "https://www.contoso.com/app/marketing",
        "privacyStatementUrl": "https://www.contoso.com/app/privacy",
        "supportUrl": "https://www.contoso.com/app/support",
        "termsOfServiceUrl": "https://www.contoso.com/app/termsofservice"
    }
}

It is given 204 content status All other fields are updated . But logo not uploaded in azure application.

Upvotes: 0

Views: 166

Answers (1)

Sridevi
Sridevi

Reputation: 22432

According to this MS Doc, you need to use PUT query to update the logo. You cannot update it with info/logoUrl as it is read-only based on informationalUrl resource type.

I have registered one Azure AD application named GraphApp with below properties:

enter image description here

To update above properties, I ran below PATCH request and got response like this:

PATCH https://graph.microsoft.com/v1.0/applications/<appObjectID>/

{
    "info": {
        "logoUrl": "https://cdn.pixabay.com/photo/2016/03/21/23/25/link-1271843_1280.png",
        "marketingUrl": "https://www.contoso.com/app/marketing",
        "privacyStatementUrl": "https://www.contoso.com/app/privacy",
        "supportUrl": "https://www.contoso.com/app/support",
        "termsOfServiceUrl": "https://www.contoso.com/app/termsofservice"
    }
}

Response:

enter image description here

When I checked the same in Portal, all properties updated except logo like this:

enter image description here

To update logo, you need to use PUT method by adding image in binary stream along with Content-Type header like below:

PUT https://graph.microsoft.com/v1.0/applications/<appObjectID>/logo
Authorization:Bearer <access_token>
Content-Type:image/png

Response:

enter image description here

When I checked the same in Portal, logo uploaded successfully to the application like below:

enter image description here

Reference: Set the logo for an Azure Application using Microsoft Graph - Stack Overflow by MattJeanes

Upvotes: 0

Related Questions