Azure DevOps PowerShell CLI - az devops invoke Call for creating inherited process

Viewed 32

having an issue with the below code. Can anyone tell me if this is a bug or am I doing something wrong.

Code

#TODO Create process
$org = "silverscout"
$Orglong = "https://dev.azure.com/$org"
$proj = "Test"
$ProcessTemplate = @{
    name = "Agile - $($proj)"
    parentProcessTypeId = "adcc42ab-9882-485e-a3ed-7678f01f66bc"
    referenceName = "$($proj).MyNewAgileProcess"
    description = "My new process"}

    $infile = "envbody.json"

 Set-Content -Path $infile -Value ($envBody | ConvertTo-Json)
 
 
 az devops invoke `
 --area processes `
 --resource processes `
 --org $Orglong `
 --api-version 6.0 `
 --accept-media-type "application/json" `
 --http-method POST --in-file $infile

ERROR:

az : ERROR: --area is not present in current organization
At line:1 char:2
+  az devops invoke `
+  ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ERROR: --area i...nt organization:String 
   ) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

when I run the below I see

az devops invoke > az_devops_invoke.json
   
  {
    "area": "processes",
    "id": "02cc6a73-5cfb-427d-8c8e-b49fb086e8af",
    "maxVersion": 7.1,
    "minVersion": 2.1,
    "releasedVersion": "7.0",
    "resourceName": "processes",
    "resourceVersion": 2,
    "routeTemplate": "_apis/work/{resource}/{processTypeId}"
  }

If I try this outside of AZ CLI and use straight up API Call, it works with this call.

$createProcessURL = "$orgUrl/_apis/work/processes?api-version=6.0-preview.2"

$ProcessTemplate = @{name = "Agile - $($proj)";parentProcessTypeId = "adcc42ab-9882-485e-a3ed-7678f01f66bc";referenceName = "$($projectName).MyNewAgileProcess";description = "My new process"} | ConvertTo-Json

 
$response = Invoke-RestMethod -Uri $createProcessURL -Method Post -ContentType "application/json" -Headers $header -Body ($ProcessTemplate

)

0 Answers
Related