Azure DevOps CLI Tool
The `azdo-cli` package provides a command-line interface for interacting with Azure DevOps services. It allows users to manage various Azure DevOps resources, such as work items, pull requests, and comments, directly from their terminal. The current stable version, as indicated by the latest release, is v0.9.0. The project exhibits an active development cadence, with frequent minor feature releases and dependency updates, suggesting ongoing maintenance and expansion of its capabilities. It serves as a lightweight alternative for automating Azure DevOps tasks and integrating them into scripts, potentially offering a more streamlined experience for specific use cases compared to the broader `az devops` extension for the Azure CLI, focusing on developer-centric operations.
Common errors
-
azdo-cli: command not found
cause The `azdo-cli` package is not installed globally or is not in your system's PATH.fixRun `npm install -g azdo-cli` to install it globally, or use `npx azdo-cli [command]` to execute it without a global installation. -
Error: Failed to authenticate. Please check your PAT or organization/project settings.
cause The provided Personal Access Token (PAT) is invalid, expired, has incorrect scopes, or the Azure DevOps organization/project is misspelled or inaccessible.fixVerify your `AZDO_PAT` environment variable or the PAT configured via `azdo-cli config set`, ensure it's not expired and has the necessary scopes. Double-check the spelling of your organization and project names. -
Error: Missing required argument: --title
cause A command like `work-item create` requires specific arguments that were not provided.fixConsult the command's help (`azdo-cli work-item create --help`) and provide all mandatory arguments, such as `--title` for creating a work item. -
Error: Resource '123' not found in repository 'my-repo'.
cause The specified resource (e.g., work item ID, pull request ID, repository name) does not exist or is inaccessible within the configured project/organization.fixVerify the ID and name of the resource you are trying to access. Ensure you are operating within the correct Azure DevOps organization and project context.
Warnings
- breaking The `better-secret` feature introduced in v0.4.0 might have changed how secrets are managed or stored. Users upgrading from versions prior to v0.4.0 may need to re-configure their Personal Access Tokens (PATs) or other sensitive credentials.
- gotcha Personal Access Tokens (PATs) used for authentication must have the correct scopes enabled in Azure DevOps (e.g., 'Work Items (Read & Write)', 'Code (Read & Write)') for `azdo-cli` commands to function properly. Insufficient scopes will lead to authorization errors.
- gotcha Many commands require explicit `--organization` and `--project` flags if they are not set globally via `azdo-cli config set` or through environment variables. Failure to specify these can result in 'resource not found' or 'command scope' errors.
- gotcha Sensitive data like Personal Access Tokens (PATs) should ideally be managed via environment variables (e.g., `AZDO_PAT`) rather than storing them directly in shell history or less secure configuration files, especially in shared environments.
Install
-
npm install azdo-cli -
yarn add azdo-cli -
pnpm add azdo-cli
Quickstart
# Install globally (recommended for CLI tools) npm install -g azdo-cli # Alternatively, use npx for single execution without global install # npx azdo-cli --version # Configure authentication using a Personal Access Token (PAT) # Set your Azure DevOps organization and project # Replace 'your-organization' and 'your-project' with actual values # The PAT can be set as an environment variable (AZDO_PAT) for security export AZDO_PAT="YOUR_AZURE_DEVOPS_PAT" azdo-cli config set organization "your-organization" azdo-cli config set project "your-project" # Example: List all work items in the configured project azdo-cli work-item list # Example: Create a new bug work item azdo-cli work-item create --type "Bug" --title "Broken user profile image upload" --description "Users are reporting issues when trying to upload new profile pictures after the last deployment." --assigned-to "developer@example.com" # Example: Add a comment to an existing pull request (replace 123 and repo-name) azdo-cli pr comment add --id 123 --repository "your-repo-name" --comment "Initial review complete. Looks good, minor stylistic changes suggested."