Skip to content
Naming Conventions, Power Apps and DevOps pipelines
Albert-Jan Schot
Albert-Jan Schot

· 4 min read

Post

Naming Conventions, Power Apps and DevOps pipelines

Elianne and I recently presented on Naming Conventions at PowerAddicts. And that wouldn’t be possible without this awesome blog: Validating Naming Conventions in Power Apps Now, I’ve finally found the time to blog about integrating that script into a DevOps pipeline.

Integrating naming conventions into your DevOps pipeline will help you making sure naming conventions are followed. You can render the results directly as part of the pipeline, or even throw warnings and errors depending on the results. This ensures consistency and helps catch issues early, you can even go as far as preventing the push to a production environment unless a certain treshold has been reached.

By using custom DevOps pipelines, you can tailor the process to your needs and depend on the results of your naming conventions. It’s also easy to change naming conventions per project using a simple JSON file.

Power Platform Build Tools for Azure Devops

In order to run any script against your solution you will need to Power Platform Build Tools for Azure Devops. You can read all about them at Microsoft Learn: Power Platform Build Tools for Azure DevOps. In addition to that there are several blogs that help you get started, but the gist is pretty straight forward, all your pipeline has to do are the following steps:

  1. Install the Power Platform Build Tools
  2. Export the desired solution
  3. Extract the exported solution
  4. Run the script to validate the exported files

Setting up all the bits and bytes

For demo purposes I have created a new Azure DevOps Team project that contains the following:

  • A repository that contains the script and the json file containing our naming conventions
  • A pipeline that runs the script and validates the naming conventions
  • A library that contains the parameters for the pipeline, including the solution name and service principle for authentication.

💡 If you are new to setting up an Azure Devops Pipeline I can recommend getting started at the Power Platform Blog.

Script changes

In order to run the script from a pipeline you will need a few parameters so that we can dynamically analyze a solution based on whatever is passed in the pipeline.

[CmdletBinding()]
param (
    [Parameter(Mandatory)]
    [string]$folderName,
    [Parameter(Mandatory)]
    [string]$solutionName
)

We also need to make sure the required PowerShell Module is installed:

Install-Module -Name powershell-yaml -Force -Repository PSGallery -Scope CurrentUser

And instead of using the Write-Host to render an error with a nice message, we need to add ##vso[task.logissue type=warning;] or ##vso[task.logissue type=error;]. So I opted for both to make it a little easier. This will make sure our pipeline will pick-up the messages accordingly.

 Write-Host "❌ " $message -ForegroundColor Blue
Write-Host "##vso[task.logissue type=warning;]" + $message

Finally to make sure our pipeline will fail we must throw an error:

else {
    Write-Host "$($score)% `u{1F622}" -ForegroundColor Red -NoNewline
    $summary += "The score of the app $($displayName) is $($score)% `u{1F622}. $($wrong) out of $($output.Count) doesn't match the naming conventions."
    Write-Host "##vso[task.logissue type=error;] The score of the app $($displayName) is $($score)% `u{1F622}. $($wrong) out of $($output.Count) doesn't match the naming conventions."
    Exit 1;
}

Devops Pipeline

In order to run the script all you need to do is to call the script with the expected parameters:

- task: PowerShell@2
  displayName: 'Blis Digital: Naming Validator'
  inputs:
    filePath: '$(Build.SourcesDirectory)/scripts/ScoreCanvasAppNamingConvention.ps1'
    arguments: '-folderName "$(Build.SourcesDirectory)/$(SolutionName)" -solutionName $(SolutionName)'

So the your completed pipeline will look something like this:

steps:
- checkout: self
- task: PowerPlatformToolInstaller@2
  displayName: 'PP: Install tools'
  inputs:
    DefaultVersion: true
- task: PowerPlatformExportSolution@2
  displayName: 'PP: Export'
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'Source'
    SolutionName: '$(SolutionName)'
    SolutionOutputFile: '$(Build.StagingDirectory)/$(SolutionName).zip'
    AsyncOperation: true
    MaxAsyncWaitTime: '60'
- task: PowerPlatformUnpackSolution@2
  displayName: 'PP: Extract'
  inputs:
    SolutionInputFile: '$(Build.StagingDirectory)/$(SolutionName).zip'
    SolutionTargetFolder: '$(Build.SourcesDirectory)/$(SolutionName)'
    ProcessCanvasApps: true
- task: PowerShell@2
  displayName: 'Blis Digital: Naming Validator'
  inputs:
    filePath: '$(Build.SourcesDirectory)/scripts/ScoreCanvasAppNamingConvention.ps1'
    arguments: '-folderName "$(Build.SourcesDirectory)/$(SolutionName)" -solutionName $(SolutionName)'

Results

Assuming that you have a solution that contains a Canvas App that doesn’t follow the naming conventions, the pipeline will fail and you will see the following result:

Azure DevOps pipeline result

You can also navigate to the details and get additional results per element in your app.

Azure DevOps pipeline detailed result

Do you use naming conventions in your projects? And if so, how do you enforce them? Let me!

Albert-Jan Schot

Albert-Jan Schot

CTO, Microsoft MVP & FastTrack Recognized Solution Architect

I am Albert-Jan Schot, CTO at Blis Digital, Microsoft MVP, and FastTrack Recognized Solution Architect focused on Microsoft 365, Azure, and AI agents. I help teams turn complex Microsoft Cloud challenges into practical architecture decisions and shipped outcomes.

Copilot Studio Microsoft 365 Agent Flows

Zuid Holland, Netherlands

Related Posts