Service principal in Azure is used for accessing the Azure resources by third-party applications, automation tools, and applications.
An Azure admin can control the access level for these Service principals and it’s always a better approach to provide only required privileges than an application required to access the resources.
Service Principal is a kind of service account that we generally use in the Active directory to bind with certain services rather than providing individuals id’s.
Create Service principal from Azure Portal:
- Login to Azure portal
- On the search bar type “app registrations” and select “App registrations”
- Click on the “New registration”
- Provide a name to the application and click on “Register”
- once app registration created, select the created “app registration” from “owned applications“
- The overview section provides the information on this app registration, and we need these details while using the service principal to connect to the resource, so please have a note of – Display Name, Application ID, Directory ID & Object ID
- Click on “Certificates & secrets” to create a new client secret (By using this secret and the above info we can connect to Azure resources)
- Provide a name to the “Secret” and Expiry of the secret then Click on Add
- The secret is now created. once after the creation, you will be shown with Value for this secret and please copy it into a secured location since it can’t be viewed later