I want to tag a commit in azure devops git repo using the below POST call (in PowerShell script). API documentation here:
{
"name": "v0.1-beta",
"taggedObject": {
"objectId": "c60be62ebf0e86b5aa01dbb98657b4b7e5905234"
},
"message": "First beta release"
}
So far I have written the below PowerShell script:
$Azuretoken = "xxxxxxxxxxxxxxxxxxxxxxxx"
$OrganizationName = "myorg"
$ProjectName = "myproj"
$AuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($Azuretoken)")) }
$uri_tag = "https://dev.azure.com/$($OrganizationName)/$($ProjectName)/_apis/git/repositories/b27ea2df-a72f-45gdf/annotatedtags?api-version=6.0-preview.1"
$body = @(
"name"= "v0.1-beta",
"taggedObject" @{
"objectId" = "2fa9486683e3d3003fd58dbb9345aae3cdd21013"
},
"message" = "First beta release"
)
$uri = Invoke-RestMethod -Uri $uri_tag -Method POST -ContentType "application/json" -Body $body -Headers $AuthenicationHeader
Getting errors due to the format of the JSON. Please help.