简体   繁体   中英

Using Azure Devops yaml pipelines to deploy to on-prem servers

When using Azure DevOps pipelines, is it possible to deploy to on-prem servers using a yaml pipeline?

I have deployed to on premise servers with a Release (classic) pipeline using deployment groups, and I have seen instructions on deploying to Azure infrastructure using yaml pipelines.

However I can't find any examples of how to deploy to on-prem servers using yaml pipelines - is this possible yet? If so are there any examples available of how to achieve this?

Yes you can. In YAML pipelines you can use "Environments" as a replacement for deployment groups. They work in a similar way in that you install the agent on the target machine and then specify the environment in your Deployment Job

Create a new Environment with an appropriate name (eg Dev) then add a resource , you'll be able to add either a VM or a Kubernetes cluster. Assuming that you choose VM, then you will able to download a script which you can run an target machines to install the deployment agent. This script will install and register the agent in to the environment.

Once you have the Agent registered in to the environment add a deployment job to your YAML

- stage: DeployToDev
  displayName: Deploy to Dev
  jobs:
  - deployment: DeployWebSite
    displayName: Deploy web site to Dev
    environment: Dev
    strategy:
      runOnce:
        deploy:
          steps:
            - task: PowerShell@2
            inputs:
              targetType: 'inline'
              script: |
                Write-Host "Deploy my code"         

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM