In this Azure article, we will discuss how to create a service principal in Azure. Along with that, we will discuss a few other topics.
How to create service principal in Azure
Follow the below steps to create a service principal in Azure Portal.
- Log in to the Azure Portal.
- Search for Azure Active Directory and click on the search result Azure Active Directory.
3. Click on the App registrations link from the left navigation.
4. Click on the + New Registration button.
5. On the Register an application window, choose the below details
- Provide a meaningful name. This will be the user-facing display name for this application (which can be changed later).
- Choose the supported account types (Who can use this application or access this API?): Select “Accounts in this organizational directory only (Default Directory only – Single tenant)” option. You can also choose the other options based on your requirement.
- Redirect URI (Optional): Select the Web option. Anyway, this is optional.
Now, click on the Register button.
The application will get created successfully within a span of seconds.
6. On the Application page, locate the Application (client) ID, then click on the Copy to clipboard button next to the Application (client) ID to copy the ID. Then, click on the Certificates & secrets link from the left navigation.
7. Click on the + New client secret button.
8. On the Add a client secret window, Provide a description and choose when it expires. You can choose the “Recommended: 180 days (6 months)” option which is recommended by Microsoft. In fact, you can also choose the other options from the dropdown based on your actual requirement.
Now, the client secret will get added successfully.
9. Now, search for Subscriptions and click on the search result Subscriptions.
10. Click on the Subscription name from the list that you want to use here.
11. On the Subscription page, click on the Access control (IAM) option from the left navigation.
12. Click on the Role Assignments tab.
13. Click on the + Add button –> then choose the Add role assignment option from the list.
14. On the Add role assignment window, search for Contributor –> then click on the next button to move to the Members tab.
15. On the Members tab, select the below options.
- Assign access to: Choose User, group, or service principal option.
- Members: Click on the + Select members option, search for the user principal you have created above, and then click on the Select button.
16. Click on the Review + assign button on the below window and again click on the Review + assign button and you are done.
Now, it is added successfully. See the below screenshot for reference.
Now the service principal is ready, you can pass this client id and secret through your client app requests then it gets authenticated and you can get an access token that can be used for all the requests for the client apps to access the Azure resources.
You may also like following the below articles
- How to Create Azure Free Account (Step by Step tutorial)
- How to create and add members to Azure Active Directory Group
- How to create a user in azure active directory
- How to delete a user in Azure Active Directory
- How to find deleted users in Azure Active Directory
- What is the azure active directory and how Azure AD works?
- What is Azure Active Directory B2B collaboration (Azure AD B2B)
In this Azure article, we discussed how to create service principal in the Azure portal, Now, it’s your turn to utilize the above information to create your own Azure service principal. Thanks for reading this article !!!