Azure DevOps data source for Grafana
The Azure DevOps data source plugin allows you to query and visualize Azure DevOps data from within Grafana.
Before you begin
- Ensure you have an Azure devops account and a personal access token.
- Ensure you have one of the following account types:
- Grafana Cloud: Pro customers, Advanced customers, or Pro trial users with the Enterprise plugin add-on enabled
- Grafana Enterprise: Customers with an activated license and a user with Grafana server or organization administration permissions
- Ensure the Enterprise plugin add-on is enabled.
Known limitations
- Template variables cannot be multi-select; only single selection is supported.
- Only the following feature set is provided as part of the plugin
Features covered
Service | API | Reference Docs |
---|---|---|
Core | Projects - List | API |
Git | Repositories - List | API |
Pull Requests - List | API | |
Build | Builds - List | API |
Definitions - List | API | |
Pipelines | Pipelines - List | API |
Runs - List | API | |
Release | Definitions - List | API |
Deployments - List | API | |
Releases - List | API |
Install the Azure DevOps data source plugin
To install the data source, refer to Installation.
Get a personal access token from Azure DevOps
To get a personal access token, refer to Azure DevOps docs - Personal access token section.
Set the necessary read
permissions for your API token. This includes workItems.read
, code.read
, code.status
, build.read
, release.read
, test.read
and packaging.read
. You can skip specific permissions if you are not using that specific feature.
Configure the data source in Grafana
Add a data source by filling in the following fields:
Field | Description |
---|---|
URL | URL of your Azure DevOps instance. Example: https://dev.azure.com/xxxxxx |
PAT Token | Azure DevOps personal access token. Refer the previous section to know how to generate one. |
Projects Limit | Number of projects to retrieve. Defaults to 100. Useful when having more than 100 projects in the org |
Configure the data source with provisioning
You can configure data sources using config files with Grafana’s provisioning system. To read more about how configuration works, including the full list of settings for data sources, refer to Provisioning Grafana.
apiVersion: 1
datasources:
- name: Azure Devops
type: grafana-azuredevops-datasource
version: 1
orgId: 1
uid: azure_devops_001
basicAuth: false
editable: false
isDefault: false
jsonData:
url: https://dev.azure.com/xxxxxxxx
projectsLimit: 100
secureJsonData:
patToken: xxxxxxxxxxxxxxxxxxxxxxxxx
Query the data source
The query editor allows you to query different set of data from Azure DevOps. Based on the query type selected in the query editor, you can retrieve data from different APIs.
Projects
- View a list of all projects in the organization that the data source has access to.
- The underlying API is Projects - List.
Repositories
- Retrieve a list of git repositories in the organization that the data source has access to.
- (Optional) You can specify the project ID to filter the repositories for the project specified.
- The underlying API is Repositories - List.
Pull Requests
- Retrieve a list of pull requests for the specified project.
- (Optional) You can specify the repository ID to filter the pull requests specific to the repository.
- The underlying API is Get Pull Requests By Project
Builds
- View a list of builds for the specified project.
- Project ID is a mandatory field.
- Query response is scoped to dashboard’s time range.
maxTime
andminTime
parameters are passed to the API automatically based on dashboard time range. - The underlying API is Builds - List
Build definitions
- View a list of build definitions for the specified project.
- Project ID is a mandatory field.
- The underlying API is Build Definitions - List.
Pipelines
- View a list of pipelines for the specified project.
- Project ID is a mandatory field
- Underlying API is Pipelines - List
Pipeline runs
- Gets top 10000 runs for the pipeline specified
- Project ID and Pipeline ID are mandatory fields
- Underlying API is Pipeline Runs - List
Releases
- Gets a list of releases for the project specified
- Project ID is a mandatory field
- Query response will be scoped to dashboard’s time range.
maxCreatedTime
andminCreatedTime
parameters are passed to the API automatically based on dashboard time range - Underlying API is Releases - List
Release definitions
- Gets a list of release definitions for the project specified
- Project ID is a mandatory field
- Underlying API is Release Definitions - List
Release deployments
- Gets a list of release deployments for the project specified
- Project ID is a mandatory field
- Underlying API is Release deployments - List
Templates and variables
To add a new Azure DevOps query variable, refer to Add a query variable. Use your Azure devops data source as your data source for the following available queries:
Query Type | Description |
---|---|
Projects | Returns the list of project IDs. Project ID will be a value. The project name is used as the display value |
Repositories | Returns the list of repository IDs. Repository ID will be the value. The repository name is used as the display value. Optionally, you can specify the project to filter the repositories to only for the specific project |
Note: You can’t apply regex in variable editor by the project/repo name. Also multi variable is not supported in the plugin
Sample dashboards
Azure DevOps plugin contains sample pre-made dashboards that can be imported from “Dashboards” tab of the plugin configuration page. These dashboards are there for demonstration purposes and may not cover all your needs.
Get the most out of the plugin
- Add Annotations.
- Configure and use Templates and variables.
- Add Transformations.
- Alerts are not supported.