How to register your application with Azure Active Directory to use Graph API?
This article aims to explain the process of registering an application with Azure Active Directory (AAD) so that we can use the graph API to send an automated email
[Development/Testing] Join Microsoft 365 developer program
Join the Microsoft 365 developer program using this link
https://developer.microsoft.com/en-us/microsoft-365/dev-program
It will create a new email id and you get admin access to all the tools of Microsoft. The trial period is 90 days and it doesn’t ask for any payment details.
App Registration with AAD (Azure Active Directory)
Please navigate to the below URL. If prompted, please sign in with the outlook mail that has admin access. (email you got from the developer program).
https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Overview
Click on + Add
and select App Registration
On the next page, enter the name of your application. For the Supported account types
, select the 3rd option - Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)
. Ignore the Redirect URI
empty and click on Register
Generate Client Secret
Note the Application (Client) Id
and the Directory (tenant) ID
. Click on Add a certificate or secret
for generating the client secret.
Now click on + New client secret
. It opens a dialog box where we need to enter the description and select the duration of expiry as per the requirement. Now click on Add
It will create a client secret with value and secret ID. Note the value
. It is the clientSecret
of our application. It will be hidden by default when you visit this page in future
Give necessary Permissions to the Application
Navigate to API Permissions
under the Manage tab and click on + Add a permission
. It opens a new window. Select Microsoft Graph
and choose Application permissions
. In the select permissions box, search for mail
and select Mail.Send
permission. Now click on Add permissions
Now click on Grant admin consent for MSFT
and click Yes
on the prompt
Check the status of configured permissions. It should be as seen in the below image
You have successfully registered the application with AAD and generated the clientId
, tenantId
, and clientSecret
.