Azure has very nice function to facilitate cross search through all repositories:
I have noticed that after I did search for a keyword which was in one of the branches it was not found. How can I cross search also through all the branches from all repositories?
You can run the following PowerShell scripts to update the searchable branches via REST API.
$token = "{PAT}"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
$url="https://dev.azure.com/{Org name}/{Project name}/_apis/policy/Configurations/{Configuration ID}?api-version=7.1-preview.1"
$body = @'
{
"type": {
"id": "0517f88d-4ec5-4343-9d26-9930ebd53069"
},
"isBlocking": false,
"isEnabled": false,
"settings": {
"scope": [
{
"repositoryId": "{Your repo ID}"
}
],
"searchBranches": [
"refs/heads/Branch1",
"refs/heads/branch2",
"refs/heads/Branch3"
]
}
}
'@
$head = @{ Authorization =" Basic $token" }
Invoke-RestMethod -Uri $url -Method PUT -Headers $head -Body $body -ContentType application/json
[ ]
if you want to remove all branches except the default beanch.