How to: Service Hooks Mapping on Azure DevOps

This script and report list all Service Hooks (in all Team Projects) within the Azure DevOps organization

An original script is available on my GitHub repository. See below this script:

Let’s go understand each command used.

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL to list all Service Hooks within Azure DevOps organization;
  • $Connstr = connection string to Azure SQL Database that stores the report information. To create this report, it’s necessary to create previously a Azure SQL Server and Database and run a script below:

2. Subscription List = uses this REST API to list all Service Hooks (in all Team Projects) within the Azure DevOps organization.

3. Projects Get = uses this REST API to get specific Team Project within the Azure DevOps organization.

4. After extract all Service Hooks, this information is stored in a table in Azure SQL.

5. After insert information into a table, I connected this database on Power BI:

  • Project Name (1) = Filter report using Project Name field;
  • Consumer (2) = Filter report using Consumer field (Slack, Teams, WebHooks, etc.);
  • Service Hooks Informations (2) = List all information about Service Hooks (Project Name, Consumer, Event Action, and Owner).

DevOps Consultant at N3