How to: Service Hooks Mapping on Azure DevOps

  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:
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAT)")) }$UriServiceHooks = "https://dev.azure.com/$($Organization)/_apis/hooks/subscriptions?api-version=6.1-preview.1"$ServiceHooksResult = Invoke-RestMethod -Uri $UriServiceHooks -Method get -Headers $AzureDevOpsAuthenicationHeader Foreach ($serviceHook in $ServiceHooksResult.value)
{
Write-Host $serviceHook.eventDescription
}
$UriGetProject = "https://dev.azure.com/$($Organization)/_apis/projects/$($serviceHook.publisherInputs.projectId)?api-version=6.1-preview.4"   $GetProjectResult = Invoke-RestMethod -Uri $UriGetProject -Method get -Headers $AzureDevOpsAuthenicationHeaderWrite-Host $GetProjectResult.name
  • 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).

--

--

--

Tech Solution Architect Manager na Accenture

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

An interesting GnoLand project

Introduction to Multithreading and Multiprocessing in Python

Why You Should Treat Your Main Branch as Production

[Subscript technical team provides [Polkadot Developer Community Training Camp] participants with…

Starks, Lannisters, and Kubernetes administration

How to update contact information & Email Preferences in cPanel

Private Class Data — C Sharp (C#) — Studysection Blog

Private Class Data — C Sharp (C#) — Studysection Blog

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vinicius Moura

Vinicius Moura

Tech Solution Architect Manager na Accenture

More from Medium

How to: Team Projects, Fields, and Picklists Mapping on Azure DevOps

Deploy an Azure Function App connected to Cosmos DB with secrets on Key Vault using Bicep

Deploy an Azure Function App connected to Cosmos DB with secrets on Key Vault using Bicep

Generate random password in azure bicep template

Creating a Custom Role for an Azure Managed Identity

Azurerm resource block to create a custom role for a managed identity