Tenho o script abaixo para atualizar o workspace do MS Fabric no pipeline de lançamento do ADO. Isso não está funcionando. Além disso, a autenticação é feita no Service Principal para o token.
$accessToken = "$(accessToken)" # Use the token from pipeline variables
$headers = @{
Authorization = "Bearer $accessToken"
"Content-Type" = "application/json"
}
$apiUrl = "https://api.fabric.microsoft.com/core/git/update-from-git?workspaceId=<workspace-id>&itemId=<item-id>"
$body = @{
gitBranch = "feature"
} | ConvertTo-Json -Depth 10
$response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $body
Write-Output $response
Erro:
2025-03-05T17:37:34.2927854Z Invoke-RestMethod :
2025-03-05T17:37:34.2928743Z Not Found
2025-03-05T17:37:34.2930059Z Not Found
2025-03-05T17:37:34.2931039Z HTTP Error 404. The requested resource is not found.
2025-03-05T17:37:34.2932857Z At D:\a\_temp\.ps1:16 char:13
2025-03-05T17:37:34.2933909Z + $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $hea ...
2025-03-05T17:37:34.2934961Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-03-05T17:37:34.2936330Z + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
2025-03-05T17:37:34.2937301Z eption