I created Authentication token as well all permission for user which running pipeline is defined
i am facing below issue in git based wiki updater task
955 views Asked by dnyaneshwar patil At
2
There are 2 answers
0
On
I had the exact same issue on a local Azure DevOps 2022 OnPremise installation and solved it by enabling the option 'Inject credentials via Headers' in the Advanced Settings of the task.
This option was added due to this Issue: https://github.com/rfennell/AzurePipelines/issues/613
To give some context: Thanks to the answer of @Levi Lu-MSFT, i was able to check if it actually was a premissions/authentication problem or not as his powershell script worked in an instant leaving the Git based WIKI File Updater task as the only possible source of the error.
If you checked
Run with Build Agent Credentials
as Authentication in the task. And the build account{ProjectName} build service ({OrganizationName})
was granted Read and Contribute permission in the Wiki Security page.But you still encounter above error. It's probably because you have IIS Basic Authentication turned on in the Azure DevOps Server machine. When IIS Basic Authentication is enabled on your windows machine, it prevents you from using personal access tokens (PATs) as an authentication mechanism. See here.
As workaround to this, you can add an extra header which includes a base 64 encoding of "user:PAT" to the Git requests when IIS Basic Authentication is enabled:
So you can run the pure git commands in a powershell task to update your wiki repo, instead of uisng the git based wiki updater task. See below example scripts in the powershell task (yaml format):
Check here for more information.
In order to use the Build Agent OAuth token
$(system.accesstoken)
in above script. You need click theAgent job 1
and Check the optionAllow scripts to access the OAuth token