Let's simplify publishing new NuGet packages for x++ builds
2 - What is a service principal
What is a Service Principal?
Before we register anything or create credentials, let's review what a service principal actually is and why automation needs one.
The Analogy: A Robot User
Think of a service principal (SPN) as a robot user. It has its own identity, its own credentials, and its own permissions - but there's no human behind it. It logs in, does its job, and never forgets a step. This user, called an S2S User in Dataverse, allows a non-person account to log in and have access to APIs and various other resources. S2S means server-to-server so this is created for non-human actors to perform various tasks ( meaning automations ) with no UI component.
In the LCS world, you log into the portal with your personal or service account to deploy packages. That works when one person deploys once a month. But what happens when you're on vacation? Or when you want deployments to happen automatically at 2 AM after a build completes? You need an identity that doesn't take holidays. Some automations are available for LCS but they require an account that could have a UI component and they cannot have MFA enabled. The limitations around MFA typically make use of the LCS APIs limited for security focused organizations.
That's what a service principal is: an identity purpose-built for automation.
Why Not Use a Personal Account?
You could store your own credentials in the pipeline, but that's a bad idea:
- Security - Your account has access to email, Teams, and everything else. If those credentials leak, the blast radius is enormous.
- MFA - Your account requires multi-factor authentication. Pipelines can't tap "Approve" on your phone at 3 AM - so using your account is a non-starter or MFA has to be disabled.
- Lifecycle - When you leave the company or change your password, every pipeline breaks. Additionally, if consultants or someone temporarily with the organization uses their credentials, that can cause issues when their accounts are deactivated.
- Audit - The SPN's actions are clearly logged as automation, not ambiguously attributed to a person. SPN's as S2S users are specifically for automation.
A service principal has exactly the permissions it needs and nothing more.
Three Things the SPN Needs
To work with D365 Finance and Operations pipelines, your service principal needs three registrations:
-
Entra ID App Registration - This creates the identity itself. Think of it as the robot's birth certificate. You get back a Client ID (the robot's username) and a Client Secret (the robot's password). todo link here.
-
PPAC Management App Registration - Entra ID knows the robot exists, but Power Platform doesn't trust it yet. This step tells PPAC: "this robot is allowed to call admin APIs - provision environments, deploy packages, copy databases." Without this, the SPN gets "Access Denied" on every PPAC call.
-
F&O Application User - If your pipelines need to call F&O APIs directly (OData endpoints, Data Management Framework), the SPN must also be registered inside each F&O environment as an application user with appropriate security roles. This will allow for automation to trigger various activities via API in F&O such a data entity refresh after copying a database.
How It Relates to What You Know
In the LCS world, here's what you did manually:
- Log into LCS with your account
- Click "Apply package" on an environment
- Wait for the status to change and advance
- LCS would email on environment status changes
In the PPAC world, the service principal does the equivalent:
- Authenticates to Entra ID using its Client ID and Secret
- Calls the PPAC REST API to apply the package
- Polls the operation status until completion
- Report on status and outcome of the pipeline with logging and error reporting
Same outcome, different actor. The SPN is just doing what you used to do - but programmatically, reliably, and without needing a human present.
The Client Secret: A Password for the Robot
The client secret is essentially the SPN's password. It's a long random string that proves "I am this service principal." Like any password, it expires (typically every 12 months) and must be rotated. Unlike your password, it never gets typed into a browser - it lives in a secure variable group that only authorized pipelines can read. We'll talk more about variable groups later. Additionally, you can use certificate based authentication as well. Conceptually replace secret with a certificate thumbprint and the concepts are the same. I'll be talking about creating and using a secret but if you replace "secret" with "thumbprint", we're using the mental model for certificate based auth. Regardless of the way we authenticate, both secrets and certificates need to be rotated. First, they expire and it's best practice to have expiry in your security plan. Second, sometimes ( hopefully very rarely ) credentials can be exposed and value has to be removed/deleted and new ones used in their place.
Now that you understand what a service principal is and why it exists, the next article will walk you through creating one step by step - registering the app in Entra ID, adding the PPAC management registration, and setting up the F&O application user.







