AZ-400 Designing and Implementing Microsoft DevOps Solutions Exam

Seeking the thrill of transformative tech? Explore the art of designing and implementing DevOps solutions on Azure. Master the shift towards CI/CD, testing, and delivery, while preparing for the Designing and Implementing Microsoft DevOps Solutions exam!

Practice Test

Intermediate
Exam

Migrate a pipeline from classic to YAML in Azure Pipelines

Translate Classic Pipeline Components to YAML

Azure Pipelines allows for automatic deployment using continuous integration (CI) and continuous delivery (CD) with the ability to build, test, and deploy code using Azure DevOps.

Key Concepts

Classic pipelines use a visual designer whereas YAML pipelines are defined using a YAML file in your repository, providing a more modular and reproducible way to define pipeline processes. Steps in a YAML pipeline can be scripts or tasks. Transitioning from classic pipelines involves authoring equivalent YAML configurations to replicate the functionalities originally managed in the classic setup.

Task Versions

When converting classic pipeline tasks to YAML, it is essential to choose the correct task version:

Migration Process

  1. Analyze Classic Pipeline Elements: Identify key components such as tasks, variables, and triggers used in the classic pipeline.
  2. Map Elements to YAML:
    • Match each classic element to its YAML syntax counterpart.
    • Ensure all steps, tasks, and parameters are correctly translated into YAML format.
  3. Create Modular YAML Pipeline Files:
    • Author a complete YAML configuration that resides within the version control of your repository.
  4. Validate Execution: Run the pipeline to ensure functionality matches the original classic pipeline aiming for successful execution parity.

Example: Create a Pipeline for Azure Functions in YAML

Here is an example of what a YAML build pipeline might look like:

variables:
  buildConfiguration: 'Release'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true
- task: AzureFunctionApp@2
  inputs:
    azureSubscription: '<service-connection-name>'
    appName: '<function-app-name>'
    package: '$(System.DefaultWorkingDirectory)/**/*.zip'

Conclusion

Transitioning from classic pipeline definitions to YAML in Azure Pipelines involves careful analysis and reliable mapping of tasks, variables, and triggers from their classic definitions to YAML equivalents. Proper configuration ensures the modular and reproducible nature of your pipeline within your version-controlled repositories. By validating execution, you can ensure that your new YAML pipeline maintains the same functionality as the original classic pipeline, providing consistency and reliability in automated deployments.