I have implemented Azure DevOps Pipeline for a .Net solution. Pipeline is simple is builts and drop solution at "$(build.artifactstagingdirectory)"
Under Release I am picking up Artifices from build and pushing it to Dev stage, and here is the structure:
IIS Deployment (tasks)
1. IIS Web App management
2. Extract file solution (Cos i have to do few Replace token in few files)
- $(System.DefaultWorkingDirectory)/_App-ASP.NET-CI/drop/Web.zip
- $(System.DefaultWorkingDirectory)/_App-ASP.NET-CI/Web-unzip
3. Download .cer files (download certificate from secure location under library)
- $(System.DefaultWorkingDirectory)/_App-ASP.NET-CI/Web-unzip
4. IIS Web App Deploy
- $(System.DefaultWorkingDirectory)/_App-ASP.NET-CI/Web-unzip
Issue is: Currently .cer files are placed at the root of the web deployment process.
Expected: To be placed in a 'certificate' folder instead of root
I can see during deployment, solution is deployed on target machines first and after that .cer files are placed at the root. I am not sure why and how to move them to desired directory.
Here is the YAML code:
steps:
- task: ExtractFiles@1
displayName: 'Extract files '
inputs:
archiveFilePatterns: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\drop\Web.zip'
destinationFolder: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
steps:
- task: mattlabrum.build-task.custom-build-task.downloadsSecureFile@0
displayName: 'Download Certs'
inputs:
fileInput: 'certnew_64.cer'
targetPath: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
Contents: '*.cer'
TargetFolder: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip\Certificates'
steps:
- task: ArchiveFiles@2
displayName: 'Archive $(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\Web-unzip'
includeRootFolder: false
archiveFile: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\drop\Web-unzip.zip'
steps:
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
Package: '$(System.DefaultWorkingDirectory)\_DevOpsTestProject-ASP.NET-CI\drop\Web-unzip.zip'
TakeAppOfflineFlag: True
XmlVariableSubstitution: true