How to create service principal in Azure

In this Azure article, we will discuss the steps to create service principal in Azure Portal.

How to create service principal in Azure

To create service principal in Azure, follow the steps below.

  1. Log in to the Azure Portal.
  2. Search for Azure Active Directory and click on the search result Azure Active Directory.
create a service principal in Azure

3. Click on the App registrations link from the left navigation.

App registrations

4. Click on the + New Registration button.

how to create service principal in azure portal

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 the “Accounts in this organizational directory only (Default Directory only – Single tenant)” option. You can also choose the other options based on your requirements.
  • Redirect URI (Optional): Select the Web option. Anyway, this is optional.

Now, click on the Register button.

how to create a service principal in azure

The application will be created successfully within 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.

how to create a service principal in azure portal

7. Click on the + New client secret button.

how to create a service principal id in Azure

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 Microsoft recommends. You can also choose the other options from the dropdown based on your requirements.

how to create a service principal id in Azure portal

Now, the client’s secret will be added successfully.

Client Secrets Azure Portal

9. Now, search for Subscriptions and click on the search result Subscriptions.

how to create a service principal in azure for disk encryption

10. Click on the Subscription name from the list you want to use here.

create a service principal in azure portal

11. On the Subscription page, click the Access Control (IAM) option from the left navigation.

create service principal in azure portal

12. Click on the Role Assignments tab.

Role assignments in azure portal

13. Click the + Add button –> then choose the Add role assignment option from the list.