Question: In the Azure DevOps portal, I select a pipeline, then the [...] menu, then Delete.

I see a message asking:

> 
> Are you sure? This action cannot be undone. This will permanently
>  delete the pipeline 'vt3e (1)'. Deletion includes all builds and
>  associated artifacts.
> 
> 
> 

I type in the pipeline name and click OK but the pipeline does not delete.

I have waited some hours.

**[Update]**

F12 in Chrome shows an error in the console:

> 
> ms.vss-build-web.common-library.\_\_y\_\_CePsj5f5zdcIK.min.js:18 Error:
>  One or more builds associated with the requested pipeline(s) are
>  retained by a release. The pipeline(s) and builds will not be deleted
> 
> 
> 

**[Update]**

I am trying to follow the answer given by David D, but when I go to delete a release I get a message

> 
> VS402946: 'Release-8' cannot be deleted as it is currently deployed on
>  stage(s) Stage 1.
> 
> 
> 

**[update]**

[The issue is logged at Microsoft](https://developercommunity.visualstudio.com/content/problem/324411/deleting-a-build-pipeline-does-not-work.html)

Answer: 
I used powershell to delete just my own build (instead of looping through all the build definitions)

```
$organization = "YourOrganization"
$project = "YourProject"
$personalAccessToken = "GetTokenFromAzureDevops"

$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)"))
$header = @{authorization = "Basic $token"}

$url = "https://dev.azure.com/$organization/$project/_apis/build/definitions?api-version=3.2"
Write-Host $url
$buildDefinitions = Invoke-RestMethod -Uri $url -Method Get -ContentType "application/json" -Headers $header

function DeleteLease($definitionId) {
    $url = "https://dev.azure.com/$organization/$project/_apis/build/retention/leases?api-version=6.0-preview.1&definitionId=$definitionId"
    $leases = (Invoke-RestMethod -Method GET -Uri $url -ContentType "application/json" -Headers $header )

    foreach ($lease in $leases.value) {
        $leaseId = $lease.leaseId
        $url = "https://dev.azure.com/$organization/$project/_apis/build/retention/leases?ids=$($leaseId)&api-version=6.0-preview.1"
        $ignore = Invoke-RestMethod -Method DELETE -Uri $url -ContentType "application/json" -Headers $header
    }
}

DeleteLease "yourBuildDefinitionId"

```

Note :

1. The PAT token can be created from Azure Devops Portal using below
Sign in to your organization in Azure DevOps ([https://dev.azure.com/{yourorganization}](https://dev.azure.com/%7Byourorganization%7D))

From your home page, open your user settings, and then select Personal access tokens.

2. To get the build definition Id- see the URL of build , it will have the ID in the URL itself.
You can also just temporarily choose to retain nothing, then delete what you want, then revert.

[![enter image description here](https://i.stack.imgur.com/JSsVk.jpg)](https://i.stack.imgur.com/JSsVk.jpg)