liveBook · Manning

Service principal

As explained in Microsoft Azure in Action

A service principal is a nonhuman identity used by an application or service to authenticate to Azure resources.

An app cannot check its inbox for a login code. When an app, script, or deployment pipeline needs access to Azure resources, a service principal gives it a nonhuman identity. It can authenticate and be authorized without borrowing someone’s personal account. section 6.6.2 section 6.9

Service principals belong to Azure’s identity-and-access picture: Microsoft Entra ID handles identities, while role-based access control (RBAC) determines what an identity may do. Giving a deployment bot an identity is not the same as giving it permission to touch everything. section 6.6 section 6.9

To create one for an application in the Azure portal:

  • Open Microsoft Entra ID, go to App registrations, and select New registration. Registering the app creates a corresponding service principal. section 6.6.2
  • Under Certificates & secrets, create a client secret and choose its expiry. Copy its value to a safe place immediately; Azure shows it only once. section 6.6.2
  • Keep the application (client) ID, directory (tenant) ID, and client secret available for the application’s authentication setup. Plan to rotate the secret when it expires. section 6.6.2

A deployment pipeline needs its own identity

A GitHub Actions workflow or Terraform deployment can use a service principal rather than a person’s credentials. Service principals are also useful for applications running outside Azure. For an Azure-native service such as App Service or Function App, consider a managed identity instead: it lets the service authenticate without storing credentials. section 6.6.2 section 6.9

How Microsoft Azure in Action covers it

How deep it goes
Defines the identity and walks through portal registration and client-secret creation, including expiry and safe handling.
Examples
Uses Terraform and GitHub Actions deployments, plus an Azure portal app-registration and client-secret workflow.
What it assumes
Builds from the tenant-and-subscription identity hierarchy before introducing application access; assumes no prior service-principal setup.
What you can do after
Operate/configure it by registering an application, creating a client secret, and retaining the IDs needed for authentication.
How it connects
Links service principals to Microsoft Entra ID, app registrations, RBAC, client secrets, and managed identities.

Also explained in

Compare how 3 books explain service principal →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.