0

I have a pipeline with 6 tasks in one job, this job runs on agent01(self-hosted), there are two users, user1 and user2(more privileges) on agent01.

My requirement is, my pipeline job running on agent01 must use user1 for task 1,2,3 and use2 for task 4,5,6. How to achieve this ? please suggest.

1 Answers1

0

How to switch to a different user on same agent to run a particular task in AzureDevOps pipeline

I'm afraid this is impossible to achieve. When pipeline is running, in the Initialize job step, the user has been determined, and we cannot assign another user to the tasks.

enter image description here

As Shayki suggested in the comment, you can split the job into two jobs and use different agents to run.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25