trigger: - main # ================== PARAMETERS ================== parameters: - name: agentPoolName displayName: Self-hosted Agent Pool Name type: string default: 'GlobalSP-SelfHosted' - name: solutionName displayName: Power Platform Solution Unique Name type: string default: 'CopilotStudioDemoSolution' - name: artifactName displayName: Build Artifact Name type: string default: 'powerplatform' - name: devServiceConnection displayName: Dev Environment Service Connection type: string default: 'PowerPlatform-CICD-Dev' - name: prodServiceConnection displayName: Prod Environment Service Connection type: string default: 'PowerPlatform-CICD-Prod' # ================== POOL ================== pool: name: ${{ parameters.agentPoolName }} # ================== VARIABLES ================== variables: solutionFile: '${{ parameters.solutionName }}_managed.zip' # ================== STAGES ================== stages: # ------------------ EXPORT FROM DEV ------------------ - stage: ExportFromDev displayName: Export Solution from Dev jobs: - job: Export displayName: Export from Dev Environment workspace: clean: all steps: - checkout: self - task: PowerPlatformToolInstaller@2 displayName: Install Power Platform Tools - task: PowerPlatformExportSolution@2 displayName: Export solution from Dev inputs: authenticationType: 'PowerPlatformSPN' PowerPlatformSPN: ${{ parameters.devServiceConnection }} SolutionName: ${{ parameters.solutionName }} SolutionOutputFile: '$(Build.ArtifactStagingDirectory)\$(solutionFile)' Managed: true - task: PowerPlatformUnpackSolution@2 displayName: Unpack solution inputs: SolutionInputFile: '$(Build.ArtifactStagingDirectory)\$(solutionFile)' SolutionTargetFolder: '$(Build.SourcesDirectory)\powerplatform\solutions\${{ parameters.solutionName }}' SolutionType: 'Managed' - task: PublishBuildArtifacts@1 displayName: Publish solution artifact inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' ArtifactName: ${{ parameters.artifactName }} # ------------------ IMPORT INTO PROD ------------------ - stage: DeployToProd displayName: Deploy to Production dependsOn: ExportFromDev jobs: - job: Import displayName: Import into Prod Environment workspace: clean: all steps: - checkout: none - task: DownloadBuildArtifacts@0 displayName: Download build artifacts inputs: artifactName: ${{ parameters.artifactName }} downloadPath: '$(System.ArtifactsDirectory)' - task: PowerPlatformToolInstaller@2 displayName: Install Power Platform Tools - task: PowerPlatformImportSolution@2 displayName: Import solution into Prod inputs: authenticationType: 'PowerPlatformSPN' PowerPlatformSPN: ${{ parameters.prodServiceConnection }} SolutionInputFile: '$(System.ArtifactsDirectory)\${{ parameters.artifactName }}\$(solutionFile)' Managed: true OverwriteUnmanagedCustomizations: true