SDKs overview
Azure DevOps Health offers a range of Software Development Kits (SDKs) and client libraries designed to facilitate programmatic interaction with its services. These tools enable developers to extend, automate, and integrate Azure DevOps functionalities into custom applications, scripts, and workflows. The available SDKs cover core areas such as build and release pipelines, work item management within Azure Boards, repository operations in Azure Repos, and artifact management via Azure Artifacts.
The primary goal of these SDKs is to provide a consistent and documented interface for developers to interact with the Azure DevOps platform outside of its web portal. This includes operations like triggering builds, updating work items, retrieving repository metadata, and managing user permissions. The official offerings are maintained by Microsoft, ensuring compatibility and adherence to best practices within the Azure ecosystem. Additionally, a vibrant community contributes various tools and libraries, extending the platform's reach to other programming languages and specific use cases.
Using these SDKs allows for greater automation of development processes, integration with third-party systems, and the creation of bespoke tools tailored to specific organizational needs. For instance, developers can create custom dashboards using data from Azure Boards or automate the deployment of applications based on specific triggers originating from external systems, as described in the comprehensive Azure DevOps REST API reference.
Official SDKs by language
Microsoft provides several official SDKs and client libraries that offer robust and supported methods for interacting with Azure DevOps services. These are designed for stability, performance, and integration within the broader Microsoft development environment. The primary official offerings include client libraries for .NET and Python, alongside a powerful command-line interface (CLI) tool.
Azure DevOps CLI
The Azure DevOps CLI is a command-line tool built on top of the Azure CLI. It provides a set of commands for interacting with Azure DevOps services across various platforms. It is particularly useful for scripting, automation, and continuous integration/continuous delivery (CI/CD) pipelines. The CLI allows for managing projects, teams, pipelines, repositories, and work items directly from the terminal.
Azure DevOps .NET Client Libraries
For developers working within the .NET ecosystem, Microsoft offers a comprehensive set of client libraries. These libraries provide typed access to the Azure DevOps REST APIs, simplifying development by handling authentication, serialization, and error handling. They are organized into several NuGet packages, each targeting specific areas like work item tracking, build and release, or Git operations. These libraries are suitable for building desktop applications, web services, and backend processes that integrate deeply with Azure DevOps. More information on their structure and usage is available in the Azure DevOps .NET client libraries documentation.
Azure DevOps Python Client Libraries
Python developers can utilize the official Python client libraries to programmatically interact with Azure DevOps. These libraries leverage the underlying REST API and offer a Pythonic interface for managing resources. They are widely used for scripting automation tasks, data analysis, and integrating Azure DevOps with other Python-based tools and platforms. The libraries are distributed via PyPI, making installation and management straightforward.
Official SDKs Summary Table
| Language | Package/Tool | Install Command | Maturity | Primary Use Cases |
|---|---|---|---|---|
| CLI | Azure DevOps CLI Extension | az extension add --name azure-devops |
Generally Available | Scripting, automation, CI/CD pipelines |
| .NET | Microsoft.TeamFoundationServer.Client (various NuGet packages) |
dotnet add package Microsoft.TeamFoundationServer.Client |
Generally Available | Windows applications, web services, backend integrations |
| Python | azure-devops |
pip install azure-devops |
Generally Available | Automation scripts, data analysis, cross-platform integrations |
Installation
The installation process varies depending on the chosen SDK or client library. Each method is designed to integrate seamlessly into its respective development environment. Prerequisites typically include an active Azure subscription and appropriate permissions within an Azure DevOps organization.
Azure DevOps CLI Installation
Before installing the Azure DevOps CLI extension, ensure the Azure CLI is installed. The Azure CLI can be installed on Windows, macOS, and Linux by following the instructions on the Azure CLI installation guide. Once the Azure CLI is set up, the Azure DevOps extension can be added:
az extension add --name azure-devops
After installation, users need to log in to Azure DevOps. This can be done interactively or via a personal access token (PAT).
az devops login --organization https://dev.azure.com/YourOrganizationName
.NET Client Libraries Installation
The .NET client libraries are distributed as NuGet packages. Developers using Visual Studio or the .NET CLI can add these packages to their projects. For example, to add the core client library for work item tracking:
dotnet add package Microsoft.TeamFoundationServer.Client
Alternatively, within Visual Studio, developers can use the NuGet Package Manager UI to search for and install the necessary Microsoft.TeamFoundationServer.Client packages. A full list of available packages can be found on NuGet.org by searching for Microsoft.TeamFoundationServer.Client.
Python Client Libraries Installation
The Python client libraries are available on PyPI, the Python Package Index. Installation is performed using pip, Python's package installer:
pip install azure-devops
It is recommended to use a virtual environment to manage dependencies for Python projects to avoid conflicts with other installed packages. Instructions for setting up and using virtual environments are available in the Python venv documentation.
Quickstart example
This example demonstrates how to use the Azure DevOps Python client library to list projects within an organization. This requires the azure-devops package installed and authentication setup, typically via an environment variable containing a Personal Access Token (PAT).
Prerequisites:
- Python 3.x installed
azure-devopspackage installed (pip install azure-devops)- An Azure DevOps organization URL (e.g.,
https://dev.azure.com/YourOrganizationName) - A Personal Access Token (PAT) with sufficient permissions (e.g., "Project & Team" read access), stored as an environment variable (e.g.,
AZURE_DEVOPS_PAT)
Python Code:
import os
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
# Configure your Azure DevOps organization URL and Personal Access Token (PAT)
organization_url = "https://dev.azure.com/YourOrganizationName"
personal_access_token = os.getenv("AZURE_DEVOPS_PAT")
# Check if PAT is available
if not personal_access_token:
print("Error: AZURE_DEVOPS_PAT environment variable not set.")
exit(1)
# Create a connection to the Azure DevOps organization
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
# Get a client for the core API (to list projects)
core_client = connection.clients.get_core_client()
# Get all projects in the organization
print("Fetching projects...")
try:
projects = core_client.get_projects()
if projects:
print(f"Found {len(projects)} projects:")
for project in projects:
print(f" - {project.name} (ID: {project.id})")
else:
print("No projects found in this organization.")
except Exception as e:
print(f"An error occurred: {e}")
This script first establishes a connection to your Azure DevOps organization using a PAT for authentication. It then retrieves a core client and uses it to fetch and print the names and IDs of all projects accessible within that organization. This serves as a foundational example for interacting with other Azure DevOps services through their respective clients.
Community libraries
While Microsoft provides official SDKs, the broader developer community has also contributed a variety of tools and libraries for Azure DevOps. These community-driven projects often fill gaps, offer alternative language bindings, or provide specialized functionalities not covered by the official offerings.
Community libraries can be particularly useful for developers working in languages not officially supported with dedicated client libraries, or for those seeking specific integrations. However, it is important to note that community-maintained projects may have varying levels of support, documentation, and stability compared to official SDKs. Developers should evaluate these libraries based on their project's requirements, community activity, and maintenance status.
Common platforms for discovering community libraries include GitHub, where many open-source projects are hosted, and package managers specific to different programming languages (e.g., npm for JavaScript, RubyGems for Ruby). Searching for terms like "Azure DevOps client" or "Azure DevOps API" alongside a specific language often yields relevant community contributions. For instance, developers might find PowerShell modules that extend beyond the basic Azure CLI capabilities for specific administrative tasks, or client libraries for languages like Golang or Java developed by third parties to interact with the Azure DevOps REST API directly.
When considering a community library, it's advisable to:
- Check the project's last commit date and overall activity.
- Review the issue tracker for open bugs or feature requests.
- Examine the documentation and examples provided.
- Understand the licensing model.
- Assess the community support available, such as forums or chat channels.
While a specific comprehensive list of community libraries is not centrally maintained by Microsoft, platforms like GitHub serve as the de facto repositories for such efforts. For example, a search for azure-devops on GitHub reveals numerous repositories, including tools for reporting, custom task development, and integrations with other systems. Developers should exercise due diligence when integrating third-party code into their production environments, particularly concerning security and ongoing maintenance. Furthermore, the OpenAPI specification for Azure DevOps, accessible through its REST API documentation, allows for the generation of client libraries in many languages using tools like Swagger Codegen, which can serve as a basis for community efforts.