0

I am creating some Azure CLI script to update an Azure DevOps project wiki, using the following command:

az devops wiki page update

However, the above command requires a --version (ETag) parameter which appears cannot be obtained via an Azure CLI command. It is however available through REST API Get request, as can be seen in the screenshot below from a Postman session.

enter image description here

Any idea how I can retrieve this ETag value from the REST API Get request and pass into my az devops wiki page update command in Azure CLI?

hitman126
  • 699
  • 1
  • 12
  • 43

1 Answers1

0

Well, in the end, I managed to find a less complicated way and without the need to reference any REST API response header. These are the two lines of code I created which addressed the immediate issue:

$etagVar = (az devops wiki page show --org https://dev.azure.com/[MyOrg] --project [MyProjectName] --path '/MyWiki/HelloWorld' --wiki [MyWiki_wiki] --query eTag -o tsv)

az devops wiki page update --path 'MyWikiPath/HelloWorld' --wiki [MyWiki_wiki --content "Yessssss, it worked !!!" --version $etagVar

I now need to find a way to set this up in an Azure YAML Pipeline and unfortunately setting it up as a Bash Inline script has so far proved hugely unsuccessful. Still, I'm just pleased that this original issue is no longer a Blocker.

Any suggestions on how to recreate the above two Az Devops commands in a YAML pipeline would be greatly appreciated.

hitman126
  • 699
  • 1
  • 12
  • 43