In this quick guide, you will learn about what an active directory is, how you can create an instance on Azure’s Active Directory, and also how to configure it from Spring boot which means how we can access the instance by configuring the instance properties
What is Active Directory?
Why use Active Directory?
It is a cloud-based directory and identity management service which gives the following benefits:
Who should use Active Directory?
Active Directory helps in organizing the company’s data. The admin uses AD to organize the whole data and hierarchy from which it belongs on which network, to what profile picture looks like, or which users have access to the storage room. Hence its main purpose is to organize all data, authenticate and authorized, etc.
For example, any IT company can use it to store employee details with proper authentication and authorization to keep that account/data secured.
Architecture of Active Directory
This shows the Active Directory workflow.
Creating Azure Active Directory Instance
1. Create an account on https://portal.azure.com then create a resource/tenant, then Identity, and then Azure Active Directory.
2. Enter your organization name and your Initial domain name. Copy the full URL of your directory; you will use that to add user accounts later in this tutorial. (For example: azureADsampledirectory.onmicrosoft.com.) Copy the full URL of your directory; you will use that to add user accounts later. (For example: azureADsampledirectory.onmicrosoft.com.)
When you have finished, select Create. It will take a few minutes to create the new resource.
3. When complete, select to access the new directory.
4. Copy the Tenant ID; you will use that value to configure your application.properties file later.
5. From the portal menu, select App registrations and then select Register an application.
6. Specify your application, and then select Register. When the page for your app registration appears, copy your Application ID and the Tenant ID.
7. Now, Click Certificates & secrets in the left navigation pane. Then select New client secret.
Add a Description and select duration in the Expires list. Click Add. The value for the key will be automatically filled in.
8. Now go to API permissions in the left navigation pane. Click Microsoft Graph and tick Access the directory as the signed-in user and Sign in and read user profile. Click Grant Permissions… and Yes when prompted.
Click Grant admin consent for Azure Sample and select Yes.
9. After this, select Authentication and select Add a platform. Then select Web applications.
Enter an endpoint URL that can accept data from azure as a new Redirect URI/Callback Response, and then select Configure to configure it.
10. Now we need to add a user to Active Directory. From the Overview page of your Active Directory, select Users, and then select New user.
When the User panel is displayed, enter the User name and Name. Then select Create.
Also, create a group of users for authentication. For this, we can select the user which we have created and form groups. Go back to the Users panel, select your test user, and select Reset password and reset it which we will be needed at the time of login.
Configure Active Directory through the app
Also, we need to configure WebSecurityConfig for authentication. This is how we can get connected to AD using spring boot.
Active Directory Advantages and Disadvantages:
Advantages
Disadvantages
Conclusion
In this quick guide, we have learned about what an active directory is, how we can create an instance on Azure’s Active Directory, and also how we can configure it from Spring boot which means how we can access the instance by configuring the instance properties. Do check out our other blogs here.