The az pipelines command is part of the azure-cli tool, which is the official Command-Line Interface (CLI) provided by Microsoft for managing Azure resources and services.
The az pipelines command allows you to manage Azure Pipelines resources, which are used for continuous integration and continuous delivery (CI/CD) workflows in Azure DevOps. Here’s an overview of its functionality:
- Pipeline Creation: With the az pipelines create subcommand, you can create new pipelines in Azure DevOps. Pipelines define the stages, tasks, and configurations required to build, test, and deploy your applications or infrastructure. You can specify the pipeline definition file, repository, and other parameters to create a pipeline that suits your requirements.
- Pipeline Management: The az pipelines update subcommand enables you to update and modify existing pipelines in Azure DevOps. You can make changes to the pipeline configuration, such as adding or removing stages, tasks, or variables, to adapt to evolving project needs.
- Pipeline Execution: Using the az pipelines run subcommand, you can trigger the execution of a pipeline in Azure DevOps. This allows you to manually initiate the CI/CD workflow for building, testing, and deploying your applications or infrastructure.
- Pipeline Listing: The az pipelines list subcommand provides a list of pipelines in your Azure DevOps project. It displays information such as the pipeline name, repository, status, and the last run details, giving you an overview of the existing pipelines in your project.
- Pipeline Deletion: With the az pipelines delete subcommand, you can delete pipelines that are no longer needed in Azure DevOps. This allows you to remove pipelines that are outdated or no longer relevant to your project, freeing up resources and maintaining a clean pipeline configuration.
- Pipeline Variables: The az pipelines variable subcommand allows you to manage variables used within your pipelines. Variables provide a way to store and access values that can be used across different stages and tasks in the pipeline. You can create, update, or delete variables using this subcommand.
Azure Pipelines is a powerful service in Azure DevOps that enables you to automate the building, testing, and deployment of your applications or infrastructure. The az pipelines command provides a convenient way to manage and interact with your pipelines using the Azure CLI.
az pipelines Command Examples
1. Create a new Azure Pipeline (YAML based):
# az pipelines create --org organization_url --project project_name --name pipeline_name --description description --repository repository_name --branch branch_name
2. Delete a specific pipeline:
# az pipelines delete --org organization_url --project project_name --id pipeline_id
3. List pipelines:
# az pipelines list --org organization_url --project project_name
4. Enqueue a specific pipeline to run:
# az pipelines run --org organization_url --project project_name --name pipeline_name
5. Get the details of a specific pipeline:
# az pipelines show --org organization_url --project project_name --name pipeline_name
6. Update a specific pipeline:
# az pipelines update --org organization_url --project project_name --name pipeline_name --new-name pipeline_new_name --new-folder-path /user1/production_pipelines
7. Get a list of agents in a pool:
# az pipelines agent list --org organization_url --pool-id agent_pool