trigger: - main # ================== PARAMETERS ================== parameters: - name: agentPoolName type: string default: 'GlobalSP-SelfHosted' - name: solutionName type: string default: 'CopilotStudioDemoSolution' - name: artifactName type: string default: 'powerplatform' - name: devServiceConnection type: string default: 'PowerPlatform-CICD-Dev' - name: testServiceConnection type: string default: 'PowerPlatform-CICD-Test' - name: uatServiceConnection type: string default: 'PowerPlatform-CICD-UAT' - name: prodServiceConnection type: string default: 'PowerPlatform-CICD-Prod' # ================== POOL ================== pool: name: ${{ parameters.agentPoolName }} # ================== VARIABLES ================== variables: solutionFile: '${{ parameters.solutionName }}_managed.zip' # ================== STAGES ================== # ------------------ EXPORT FROM DEV ------------------ - stage: ExportFromDev displayName: Export Solution from Dev jobs: - job: Export displayName: Export Solution workspace: clean: all steps: - checkout: self - task: PowerPlatformToolInstaller@2 displayName: Install Power Platform Tools - task: PowerPlatformExportSolution@2 displayName: Export from Dev inputs: authenticationType: PowerPlatformSPN PowerPlatformSPN: ${{ parameters.devServiceConnection }} SolutionName: ${{ parameters.solutionName }} SolutionOutputFile: '$(Build.ArtifactStagingDirectory)\$(solutionFile)' Managed: true - task: PublishBuildArtifacts@1 displayName: Publish Solution Artifact inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: ${{ parameters.artifactName }} # ------------------ DEPLOY TO TEST ------------------ - stage: DeployToTest displayName: Deploy to Test dependsOn: ExportFromDev jobs: - job: ImportTest displayName: Import into Test workspace: clean: all steps: - checkout: none - task: DownloadBuildArtifacts@0 inputs: artifactName: ${{ parameters.artifactName }} downloadPath: '$(System.ArtifactsDirectory)' - task: PowerPlatformToolInstaller@2 - task: PowerPlatformImportSolution@2 displayName: Import to Test inputs: authenticationType: PowerPlatformSPN PowerPlatformSPN: ${{ parameters.testServiceConnection }} SolutionInputFile: '$(System.ArtifactsDirectory)\${{ parameters.artifactName }}\$(solutionFile)' Managed: true # ------------------ DEPLOY TO UAT ------------------ - stage: DeployToUAT displayName: Deploy to UAT dependsOn: DeployToTest jobs: - job: ImportUAT displayName: Import into UAT workspace: clean: all steps: - checkout: none - task: DownloadBuildArtifacts@0 inputs: artifactName: ${{ parameters.artifactName }} downloadPath: '$(System.ArtifactsDirectory)' - task: PowerPlatformToolInstaller@2 - task: PowerPlatformImportSolution@2 displayName: Import to UAT inputs: authenticationType: PowerPlatformSPN PowerPlatformSPN: ${{ parameters.uatServiceConnection }} SolutionInputFile: '$(System.ArtifactsDirectory)\${{ parameters.artifactName }}\$(solutionFile)' Managed: true # ------------------ DEPLOY TO PROD ------------------ - stage: DeployToProd displayName: Deploy to Production dependsOn: DeployToUAT jobs: - job: ImportProd displayName: Import into Production workspace: clean: all steps: - checkout: none - task: DownloadBuildArtifacts@0 inputs: artifactName: ${{ parameters.artifactName }} downloadPath: '$(System.ArtifactsDirectory)' - task: PowerPlatformToolInstaller@2 - task: PowerPlatformImportSolution@2 displayName: Import to Prod inputs: authenticationType: PowerPlatformSPN PowerPlatformSPN: ${{ parameters.prodServiceConnection }} SolutionInputFile: '$(System.ArtifactsDirectory)\${{ parameters.artifactName }}\$(solutionFile)' Managed: true