Does anyone know here how to update an Artifact's properties? We've had a project assigned to us to move all of our artifact drops from one location to another - This is because our file server is about to die (We use On-Prem Azure DevOps Services)
I've wrote a PowerShell script already that updates what's needed for builds/releases and that works great.
So I wrote another PowerShell script to update what's needed within the Artifacts properties and then uses an "PUT" call to replace the info but there's an issue....
Invoke-RestMethod : {"count":1,"value":{"Message":"The requested resource does not support http method 'PUT'."}}
Does anyone know if this is possible/knows how to do it?
Here's my script;
Example of an endpoint;
https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/artifacts?api-version=5.1
$artefacts = Get-Content ".\artefacts.txt"
$oldDataURL = "\\rdtstore01.main.rdt.co.uk\Horizon\Drops"
$newDataURL = "\\main.rdt.co.uk\shares\Horizon\Drops"
foreach ($line in $artefacts)
{
$var = Invoke-RestMethod -Uri $line -UseDefaultCredentials -Method Get
### Updte Data line ###
$data = $var.value.resource.data
$dataNew = $data -replace [RegEx]::Escape($oldDataURL), $newDataURL
$var.value.resource.data = @{}
$var.value.resource.data += @{"value" = $dataNew}
$result = Invoke-RestMethod -Uri $line -Method Put -ContentType "application/json" -UseDefaultCredentials -Body (ConvertTo-Json $var -Depth 10)
}