1

I am looking to create and update some Azure Devops Wiki pages for my project using Az Cli from an Azure Pipeline job.

However, the required commands (examples below) all have a --file-path attribute which is described as the "Path of the file input if content is specified in the file".


 az devops wiki page create --path 'my page' --wiki myprojectwiki --file-path a.txt

 az devops wiki page update --path 'my page' --wiki myprojectwiki --file-path a.txt 

Can anyone assist with examples of how this --file-path parameter can be set or passed, for example:

  1. An input file with a remote URL, e.g. http://.... ?
  2. An input file with an Azure Repo file path?
  3. An input file stored in a shared folder with a UNC path?

Unfortunately, the basic "a.txt" example provided in the two code snippets from learn.microsoft.com (above) don't exactly provide any clarity.

hitman126
  • 699
  • 1
  • 12
  • 43

1 Answers1

0

You'll need to provide the full path to the file, e.g. C:\users\johndoe\desktop\a.txt. Then the suggested commands will work.

Fokko
  • 188
  • 1
  • 14
  • My apologies @Fokko. I failed to add one crucial piece of information in my original post.............I'm running those wiki page commands from an Azure Pipeline (Hosted) and so referencing paths such as a C Drive are completely out of the question. I'm though considering storing the input file in an Azure Repo and then referencing that in my pipeline and this has worked when I tested. However, that may not be the eventual file location, which is why I need to identify other alternatives. – hitman126 Oct 08 '21 at 16:15
  • Thanks for the clarification. Obviously the file you want to use for Wiki page creation or update should exist in a repo or in a location you can access from the agent perspective (e.g. an internet url). To store and retrieve locally on the agent, you can use paths, e.g. $(Build.SourcesDirectory) (in case of a Build pipeline or stage, or $(System.DefaultWorkingDirectory) in case of a multistage or release pipeline. Just combine it with the path you want to use, e.g. $(Build.SourcesDirectory)\wiki\a.txt. Both variables contain the same value which will be something like C:\agent\_work\1\s. – Fokko Oct 08 '21 at 18:17