This post should have appeared before the other related posts. However let us see from the ground up how we can build an application to use Azure AD Graph API to add the user to AAD.
We first need to add an application in AAD Open the Azure AD in portal and open the application tab, click to add new
If this is a properly hosted web application then give that URL else for desktop application can give any well formatted dully URL
Now go to the Azure AD Application’s Configuration tab, Copy the Client ID
Then under Keys add a new Key and copy after you click Save. This is visible for one time. Later point in time you will not see it.
Go to the permissions to other applications section and add required permissions
Then copy the App End-Point
Then create a Windows Application
Let me thank the most comprehensive blog at https://www.simple-talk.com/cloud/security-and-compliance/azure-active-directory-part-5-graph-api/