In this post we will see how to register an app in Azure AD. We need to do that if we want to authenticate the user using OAuth2, which in turn is something we well need if we are working with Microsoft APIs/services: Microsoft Graph, office 365, etc.
As a prerequisite to get the authorization token we need to work with authenticate OAuth2 we are required to register an application in Azure AD. So let’s see, without further ado, how we can do that.
How to register an application in Azure AD
Some time ago, I did write a post about the Azure feature easy tables that required the creation of a Web App; the process of registering an app in Azure AD is quite similar, and equally quick and easy.
First, we need to navigate to the App registrations menu in our Azure AD account.
Then we click the New application registration button: a pop up will open that will ask us for the following information:
- Name: a name to identify your application, you can pretty much write whatever you want here.
- Application type: you are registering an application because somewhere you have an application which needs to interact with Azure/Microsoft services. If your application is a Web App/ api you want to select here Web App/API. If your application is going to be installed on a user machine – console application, desktop application, mobile app, etc- you may select here Native.
- Redirect URI: this value here will be used in the OAuth2 authorization process. It does not need to be a real URL, but it must be a correctly formatted URI. If you check the Microsoft GitHub sample projects, you will see that an URI of type http://localhost:port is commonly used.
Click create and you are done! You have registered and application in Azure AD.
We are done, but there’s a last thing I would like to show you. If you select the registered application in the above list, you will see a screen like this one:
- From settings we can edit the form data we introduced before, and for example modify the redirect URI.
- In this screen you can check also Application ID: you will need this value later in your application when trying to authenticate the user.
And that’s all for today. In coming post we will move into the real fun: OAuth2, the Microsoft Graph API, etc. Thanks for reading! 🙂