0

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

subsoft
  • 99
  • 1
  • 8
  • Can you include your YAML (if you have it)? Alternatively, you should show the task that's placing the .CER files incorrectly. – derekbaker783 Jun 09 '20 at 12:48
  • Hi @derekbaker783 I have included YAML code too, please let me know if you need anything else. Thanks for your help – subsoft Jun 11 '20 at 11:55

1 Answers1

0

Came across this solution on stockoverflow that resolved the issue.

Azure DevOps Build Task: create a zip with contents identical to Visual Studio Publish

I had to simplify my build output directory in Pipeline so I could target restructure files and directories easily as part of the release process.

subsoft
  • 99
  • 1
  • 8