Search code examples
microsoft-graph-apiazure-ad-b2c

Create organizationalBrandingProperties


I'm trying to create Organizational branding via Graph API Unfortunately it doesn't work as documented

curl --fail-with-body --silent --show-error --oauth2-bearer TOKEN -X PUT -H 'Content-Type: application/json' -d @- https://graph.microsoft.com/v1.0/organization/7c9674e7-ad41-482b-af13-fff7ba1c38f6/branding <<< '{
    "backgroundColor":"#FFFF33",
    "signInPageText":"Welcome",
    "usernameHintText":"hint"
}'
{
  'error': {
    'code': 'Request_BadRequest',
    'message': 'Specified HTTP method is not allowed for the request target.',
    'innerError': {
      'date': '2021-04-21T12:59:57',
      'request-id': 'a5ce577c-d0a9-4888-9999-521d7ba452b1',
      'client-request-id': 'a5ce577c-d0a9-4888-9999-521d7ba452b1'
    }
  }

neither PATCH works:


curl --fail-with-body --silent --show-error --oauth2-bearer TOKEN  -X PATCH -H 'Content-Type: application/json' -d @- https://graph.microsoft.com/v1.0/organization/7c9674e7-ad41-482b-af13-fff7ba1c38f6/branding <<< '{
    "backgroundColor":"#FFFF33",
    "signInPageText":"Welcome",
    "usernameHintText":"hint"
}'
{
  "error": {
    "code": "Request_ResourceNotFound",
    "message": "Resource '7c9674e7-ad41-482b-af13-fff7ba1c38f6' does not exist or one of its queried reference-property objects are not present.",
    "innerError": {
      "date": "2021-04-21T13:07:43",
      "request-id": "c2c7056b-0043-40cb-82b8-6d262f190005",
      "client-request-id": "c2c7056b-0043-40cb-82b8-6d262f190005"
    }
  }

I tried opening an Azure support request but they told me

The AAD Developer queue is experiencing a very high number of requests. Please expect a delay in the assignation as the cases are assigned considering case severity, time in queue, customer service level and business impact.

Since Azure support has proven to be useless yet again, maybe somebody here would be able to help me? :)


Solution

  • Based on my test, I have the same error when I use PUT method.

    But PATCH works fine for me.

    id should be the organization id or tenant id.

    Please get the id first with

    GET https://graph.microsoft.com/beta/organization/
    

    Then use the id for PATCH method:

    PATCH https://graph.microsoft.com/v1.0/organization/{id}/branding
    Content-Type: application/json
    Content-Language: en-US
    {
        "backgroundColor": "#FFFF33",
        "signInPageText": "Welcome",
        "usernameHintText": "hint"
    }
    

    Update:

    Application token is not supported for this endpoint. See Permissions.

    enter image description here