0% found this document useful (0 votes)
41 views

Working

The document defines a pipeline for managing Power Platform solutions in Azure DevOps. It includes steps to set the solution version number, export solutions as zip files, unpack zip files, extract settings, and check all files into a Git repository. Parameters are used to configure the solution name, connection string, and other values.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Working

The document defines a pipeline for managing Power Platform solutions in Azure DevOps. It includes steps to set the solution version number, export solutions as zip files, unpack zip files, extract settings, and check all files into a Git repository. Parameters are used to configure the solution name, connection string, and other values.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

parameters:

- name: 'asyncTimeout'
type: number
default: 3600

- name: 'connectionString'
type: string

- name: 'gitUserEmail'
type: string

- name: 'SolutionInternalName'
type: string

- name: 'SolutionVersionPreFix'
type: string

steps:
- checkout: self
persistCredentials: true

- task: PowerPlatformToolInstaller@2 #Always Install this when using


PowerPlatformBuiltTools on machine
displayName: 'Power Platform Tool Installer'

- task: NuGetToolInstaller@1
displayName: 'Use NuGet'

- task: NuGetCommand@2
displayName: 'Install pac'
inputs:
command: custom
arguments: 'install Microsoft.PowerApps.CLI -OutputDirectory pac'

- powershell: |
$pacNugetFolder = Get-ChildItem "pac" | Where-Object {$_.Name -match
"Microsoft.PowerApps.CLI."}

$pacPath = $pacNugetFolder.FullName + "\tools"

echo "##vso[task.setvariable variable=pacPath]$pacPath"


displayName: 'Find pac Folder'

# Solutions logic #
- task: PowerPlatformSetSolutionVersion@2 #Set Version in DEV with unique
Build Number included
displayName: 'Solution Versioning'
inputs:
authenticationType: 'PowerPlatformSPN'
PowerPlatformSPN: ${{ parameters.connectionString }}
SolutionName: '${{ parameters.SolutionInternalName }}'
SolutionVersionNumber: '${{ parameters.SolutionVersionPrefix }}.$
(Build.BuildNumber)'

- task: PowerPlatformPublishCustomizations@2 #Publish Environment


Customizations
displayName: 'Solutions - Publish customizations'
inputs:
authenticationType: 'PowerPlatformSPN'
PowerPlatformSPN: ${{ parameters.connectionString }}
enabled: false

- task: PowerPlatformExportSolution@2 #Export Unmanaged Solution to machine


as .zip file locally
displayName: 'Solutions - UnmSol zip export zip locally'
inputs:
authenticationType: 'PowerPlatformSPN'
PowerPlatformSPN: ${{ parameters.connectionString }}
SolutionName: '${{ parameters.SolutionInternalName }}'
SolutionOutputFile: '$(GitDirectoryExportedSolutions)\$
{{ parameters.SolutionInternalName }}UM.zip'
AsyncOperation: true
MaxAsyncWaitTime: '60'
ExportAutoNumberingSettings: true

- task: PowerShell@2 #Push Unmanaged Solution .zip file to Git Repo


displayName: 'Solutions - UnmSol zip to repo'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
ls ${env:GitDirectoryExportedSolutions}
git config --global user.email ${{ parameters.gitUserEmail }}
git config --global user.name ${{ parameters.gitUserEmail }}
git fetch --all
git checkout -b $(Build.SourceBranchName)
git add ${env:GitDirectoryExportedSolutions}
git commit -am "Added Solution Export $
{{ parameters.SolutionInternalName }}UM V${{ parameters.SolutionVersionPrefix }}.$
(Build.BuildNumber) as zip"
git push origin $(Build.SourceBranchName)

- task: PowerPlatformUnpackSolution@2 #Unpack Unmanaged Solution .zip file


locally
displayName: 'Solutions - UnmSol zip unpack locally'
inputs:
SolutionInputFile: '$(GitDirectoryExportedSolutions)\$
{{ parameters.SolutionInternalName }}UM.zip'
SolutionTargetFolder: '$(GitDirectoryExportedSolutions)\$
{{ parameters.SolutionInternalName }}Unmanaged'

- task: PowerShell@2 #Push unpacked Unmanaged Solution files to Git Repo


displayName: 'Solutions - UnmSol folders to repo'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
ls ${env:GitDirectoryExportedSolutions}
git config --global user.email ${{ parameters.gitUserEmail }}
git config --global user.name ${{ parameters.gitUserEmail }}
git checkout -b $(Build.SourceBranchName)
git add ${env:GitDirectoryExportedSolutions}\$
{{ parameters.SolutionInternalName }}Unmanaged
git commit -am "Added Solution $
{{ parameters.SolutionInternalName }}Unmanaged V$
{{ parameters.SolutionVersionPrefix }}.$(Build.BuildNumber) unpacked"
git push origin $(Build.SourceBranchName)
- task: PowerPlatformExportSolution@2 #Export Managed Solution to machine as
.zip file locally
displayName: 'Solutions - ManSol export zip locally'
inputs:
authenticationType: 'PowerPlatformSPN'
PowerPlatformSPN: ${{ parameters.connectionString }}
SolutionName: '${{ parameters.SolutionInternalName }}'
SolutionOutputFile: '$(GitDirectoryExportedSolutions)\$
{{ parameters.SolutionInternalName }}M.zip'
Managed: true
AsyncOperation: true
MaxAsyncWaitTime: '60'
ExportAutoNumberingSettings: true

- powershell: |
$env:PATH = $env:PATH + ";" + "$(pacPath)"
pac solution create-settings --solution-zip "$
(System.DefaultWorkingDirectory)/$(GitDirectoryExportedSolutions)/$
{{ parameters.SolutionInternalName }}UM.zip" --settings-file "$
(GitDirectoryExportedSolutions)\DeploymentSettings\$
{{ parameters.SolutionInternalName }}.json"
displayName: "Extract Solution Settings, Environment Variables and
Connection References"

- task: PowerShell@2 #Push Managed Solution .zip file to Git Repo


displayName: 'Solutions - ManSol zip to repo'
inputs:
targetType: 'inline'
script: |
# Write your PowerShell commands here.
ls ${env:GitDirectoryExportedSolutions}
git config --global user.email ${{ parameters.gitUserEmail }}
git config --global user.name ${{ parameters.gitUserEmail }}
git checkout -b $(Build.SourceBranchName)
git add ${env:GitDirectoryExportedSolutions}
git commit -am "Added Solution Export $
{{ parameters.SolutionInternalName }}M V${{ parameters.SolutionVersionPrefix }}.$
(Build.BuildNumber) as zip"
git push origin $(Build.SourceBranchName)

You might also like