Authentication for your Power Platform pipelines need not be a complex ritual. Traditional methods often involve DevOps environment variables or manually managed secrets, which can be cumbersome and prone to error. With a few well-placed invocations in your Azure DevOps pipeline, you can establish authentication rites that are both swift and blessed by the Omnissiah. Here’s how it’s done.
The Authentication Ritual
This sample pipeline demonstrates how to use Power Platform Build Tools to simplify and automate authentication in your Power Platform pipelines.
What’s happening?
-
Install Power Platform Build Tools: Installs the necessary Power Platform Build Tools into the pipeline environment and adds them to the system path making the Power Platform CLI easily accessable. This task will also set the
BuildTools.EnvironmentUrl
pipeline variable. - Set Power Platform Connection Variables:
Securely sets the Power Platform connection pipeline variables using a serice connection.
The following variables are set:
PowerPlatformSetConnectionVariables.BuildTools.TenantId
PowerPlatformSetConnectionVariables.BuildTools.ApplicationId
PowerPlatformSetConnectionVariables.BuildTools.ClientSecret
PowerPlatformSetConnectionVariables.BuildTools.DataverseConnectionString
- PowerShell Script:
Uses the configured variables to:
- Create a Power Platform connection
pac auth create
. - Validate the connection using
pac auth who
.
- Create a Power Platform connection
Cogitator’s Note: See The Litany of Automation: Consecrating Infrastructure for Deployment for a guide on installing the Power Platform Build Tools extension for Azure DevOps, creating a service principal, creating a power Platform application user and a Azure DevOps service connection to the Power Platform.
Key Features of This Setup
- No Secrets in DevOps Libraries: The
PowerPlatformSetConnectionVariables
task handles everything for you, providing secrets securely without manual intervention. - Ease of Access: Connection details are made available as pipeline variables, allowing seamless integration with your scripts.
- Modular and Flexible: This approach can be easily extended or modified to suit your deployment needs.
Why It Matters
By simplifying authentication, you reduce the chances of misconfiguration and enhance the maintainability of your pipelines. The Machine God favors those who work securely, and this method ensures that your pipeline scripts are as secure as they are sacred.
By the Omnissiah’s grace, our automation endures. ❤️