Description
Reproduce the same issue when use the same Rest API to create Wiki Page.
az devops wiki page create --path 'my page' --organization https://dev.azure.com/$OrganizationName --verbose --debug --detect --project 'mywiki' --wiki test --file-path test1.md --encoding utf-8
The cause of the issue is from the Azure DevOps CLI extension itself.
When you add the --debug argument in Azure DevOps CLI, you will see that the az devops wiki page create command is using the Rest API version 5.0.
azext_devops.devops_sdk.client: Api version '5.0'
Refer to this doc about Pages - Create Or Update Version 5.0 It doesn't support the parameters: versionType.
azext_devops.devops_sdk.client: Response content: b'{"$id":"1","innerException":null,"message":"The versionType should be 'branch' and version cannot not be null\r\nParameter name: versionDescriptor","typeName":"Microsoft.TeamFoundation.SourceControl.WebServer.InvalidArgumentValueException, Microsoft.TeamFoundation.SourceControl.WebServer","typeKey":"InvalidArgumentValueException","errorCode":0,"eventId":0}'
msrest.exceptions: The versionType should be 'branch' and version cannot not be null
This parameter is available after Rest API version 5.1.
The root cause of the issue is that Azure DevOps CLI requires versionType parameter, but Azure DevOps CLI is using old version of Rest API which doesn't support the version type argument.