I have an Azure Pipeline using a Pool of a Self Hosted Agent and I have the following YAML that is working great:
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
# Al usuar el pool default, usara de la organizacion el pool que cree como Self hosted CustomAgentSelfInsurance
pool:
name: Default
#vmImage: 'windows-latest'
#container: mcr.microsoft.com/windows/servercore:ltsc2019
variables:
- group: 'CertPass'
#solution: '**/SelfInsurance.sln'
#buildPlatform: 'Any CPU'
#buildConfiguration: 'Release'
#pathToMageTool: "\"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.8 Tools\\mage.exe\""
steps:
- task: DownloadSecureFile@1
displayName: Download Pfx
name: myCertificatePfx
inputs:
secureFile: ventasmlcert.pfx
- task: DownloadSecureFile@1
displayName: Download sni
name: snInstallPfx
inputs:
secureFile: SnInstallPfx.exe
- task: DownloadSecureFile@1
displayName: Download Testpipelineapp
name: testPipelineapp
inputs:
secureFile: TestPipelineapp.zip
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/TestPipelineapp.zip'
cleanDestinationFolder: false
overwriteExistingFiles: true
#- task: PowerShell@2
# env:
# SN_INSTALL_PFX: $(snInstallPfx.secureFilePath)
# MYCERTIFICATE_PFX: $(myCertificatePfx.secureFilePath)
# MYCERTIFICATE_PFX_PASSWORD: $(certpass)
# inputs:
# targetType: 'inline'
# script: '&"$($ENV:SN_INSTALL_PFX)" "$($ENV:MYCERTIFICATE_PFX)" "$($ENV:MYCERTIFICATE_PFX_PASSWORD)"'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build .csproj file'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:SkipInvalidConfigurations=false /p:OutDir="$(System.DefaultWorkingDirectory)\publish_output"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
# Command line
# Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
- task: CmdLine@2
inputs:
script: TestPipelineapp.exe #'echo Write your commands here.'
#workingDirectory: # Optional
#failOnStderr: false # Optional
What I need is to create a task that takes my build release files and copy them to a folder in my Azure VM.
Any clue and example on how can I do that?