How to Create a New Schema Extension Using the Microsoft Graph Explorer

Introduction

This post is to provide a tutorial on how to create a schema extension utilizing the Microsoft Graph Explorer. In this post we will, login to Microsoft Graph Explorer, create the V1 AAD Application, and make the Microsoft Graph Schema Extension call.

 

Getting the Access Token

Please navigate to the Microsoft Graph Explorer at :

https://developer.microsoft.com/en-us/graph/graph-explorer

Once the page loads, on the left, below authentication you will see the button that says sign in with Microsoft. Click this and go ahead and login.

image

 

Login with an account that has the ability to modify AAD Application Schema Extensions.

Now that you have logged in with an account, click on modify permissions underneath your name.

image

 

From there find the permission required listed in the Create schemaExtension documentation.

The permission is listed here : https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/schemaextension_post_schemaextensions image

 

If you need help finding permissions for APIs, please go through this article : https://blogs.msdn.microsoft.com/aaddevsup/2018/05/21/finding-the-correct-permissions-for-a-microsoft-or-azure-active-directory-graph-call/

This will help you when working with other Microsoft APIs that you need help finding permissions to. That being said, once you find the permission, click on the box next to it to check it.

 

It will say that to change permissions you will need to login again. So when you press the modify permissions button, it will bring you back to the login page. From there, login and consent to the graph explorer application.

image image

 

Now, by logging in you should have an access token for the Graph Explorer to use.

We can now press the run query button and get some information about ourselves, and have the correct permissions to make the call to the create Schema Extension Graph API.

image

 

Creating the AAD Application Registration

Now going back to the Azure portal, go to Azure Active Directory > App Registrations > New Application Registration

image

 

From here you are now at the Create AAD Application Blade, fill out the name and sign-on URL with your own values. They won’t matter too much in this example.

image

 

Now click on your new web app, and copy the Application ID.

image image

 

Making the createSchemaExtensions Call

Now we have everything we need to make the create schema extensions call from the Microsoft Graph using the Graph Explorer. The nature of the createSchemaExtensions call is to add a schema extension to the application that is making the call. Since we are using the Graph Explorer, it will try to add it to the Graph Explorer’s AAD Application. You won’t be allowed to do this, as it is managed by Microsoft. So we have to set the Application ID of the application we would like to add the schema extension to in the body of our request. This is actually described in the documentation, although not very obvious, in the owner attribute for the request body.

owner
String
(Optional) The appId of the application that is the owner of the schema extension. This property can be supplied on creation, to set the owner. If not supplied, then the calling application's appId will be set as the owner. So, for example, if creating a new schema extension definition using Graph Explorer, you must supply the owner property. Once set, this property is read-only and cannot be changed.

I am going to copy the request from the documentation and put it into my request body, and then add the owner attribute with my application ID. You must also modify the ID, because if you wish to utilize the Domain_schema ID format, you must provide a domain that you own.

 

So now my request looks like :

{
"id":"2cd76e65",
"description": "Graph Learn training courses extensions",
"owner" : "3f434c47-5229-40fc-be95-e6e1583ac4fc",
"targetTypes": [
"Group"
],
"properties": [
{
"name": "courseId",
"type": "Integer"
},
{
"name": "courseName",
"type": "String"
},
{
"name": "courseType",
"type": "String"
}
]
}

In addition to that I also copied and pasted the request endpoint in the request example into the graph explorer URL box.(https://graph.microsoft.com/v1.0/schemaExtensions)

I also then changed the blue box on the left of the URL box from GET to POST as we want to create the schema extension.

image

 

Conclusion

In this post we have gone through, logging in, getting the right permissions, modifying the request body example for your application, and then adding the schema extension to your application. For more information on the schema extension please go through the schema extension attribute documentation here : https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/schemaextension

You will see the different resource types and other information that you can use to create your Schema Extension.

If you have any issues, feel free to open a support ticket and one of our support engineers will reach out to you as soon as possible to resolve the issue. Also feel free to comment below and I will try to reach out to you to resolve the issue.