Azure DevOps Services
在本快速入门中,你将为 Azure 命令行接口(CLI)设置并开始使用 Azure DevOps 扩展。 使用 Azure CLI,可以从命令行管理许多 Azure DevOps Services。 借助 Azure CLI 命令,可以使用更快的灵活交互式画布简化任务,从而绕过用户界面工作流。
注意
Azure DevOps CLI 仅适用于 Azure DevOps Services。 Azure CLI 的 Azure DevOps 扩展不支持任何版本的 Azure DevOps Server。
若要开始使用 Azure CLI 的 Azure DevOps 扩展,请执行以下作:
安装 Azure CLI。 按照 安装 Azure CLI 中的说明设置 Azure CLI 环境。 Azure CLI 版本须至少为 2.10.1。 可以使用
az --version
命令进行验证。添加 Azure DevOps 扩展。
az extension add --name azure-devops
若要确认安装,请运行命令
az extension list
或az extension show --name azure-devops
。若要登录,请运行
az login
命令。 Azure CLI 仅支持使用用户名和密码进行az login
交互式登录。 若要使用个人访问令牌登录(PAT),请参阅 通过 Azure DevOps PAT 登录。注意
Azure DevOps 扩展目前不支持使用 托管标识进行身份验证。
建议为组织和项目设置默认配置。 否则,可以在单个命令本身中指定值。
az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp
使用命令
添加 Azure DevOps 扩展后,将添加 devops
、pipelines
、artifacts
、boards
和 repos
组。
对于任何命令的用法和帮助内容,请指定 --help
参数,例如:
az devops --help
Group
az devops : Manage Azure DevOps organization level operations.
Related Groups
az pipelines: Manage Azure Pipelines
az boards: Manage Azure Boards
az repos: Manage Azure Repos
az artifacts: Manage Azure Artifacts.
Subgroups:
admin : Manage administration operations.
extension : Manage extensions.
project : Manage team projects.
security : Manage security related operations.
service-endpoint : Manage service endpoints/service connections.
team : Manage teams.
user : Manage users.
wiki : Manage wikis.
Commands:
configure : Configure the Azure DevOps CLI or view your configuration.
feedback : Displays information on how to provide feedback to the Azure DevOps CLI team.
invoke : This command will invoke request for any DevOps area and resource. Please use
only json output as the response of this command is not fixed. Helpful docs -
https://learn.microsoft.com/rest/api/azure/devops/.
login : Set the credential (PAT) to use for a particular organization.
logout : Clear the credential for all or a particular organization.
在浏览器中打开项
可以使用 --open
参数在默认浏览器中打开 Azure DevOps 门户中的任何项目。
az pipelines build show --id 1 --open
此命令在命令提示符窗口中显示构建 --id 1
的详细信息,并在默认浏览器中打开该信息。