2
votes

I have a python script that execute an automation script on remote SUT. and given that the script is working when execute locally with user tester and password xxx.

when I build the DevOps Azure pipeline I have checkout from GIT the project into the agent and then try to execute the code from the command line .

cd .\MatrixPro\TestFramework
python .\main.py -t profaund_tests.matrix_pro_rf_energy_across_impedances 

this code gave me an error

E PermissionError: [WinError 5] Access is denied: '//192.168.1.100\c$\'

seems that this script try to create report file on the SUT and doesn't have permission.

more over that the azure user agent have admin permission but I suspect that I need to change into the local user before execute the command.

note: I'm working on windows 10 .

what is the right method to solve this issue ? how can I figure out way this error occur ?

is their a simple way to change the pipeline permmision to work on local agent with local user and password?

1
What user is the agent configured to run under? Ideally you'd give that user permission to do the deployment. There is also a Windows File Copy task that can auth to copy files.jessehouwing
yu could also perform a runas command to elevate to a different user or invoke net use \\192.168.1.100 /urer:{insert user here} {password} to set the network credentialsjessehouwing

1 Answers

3
votes

When you run the build pipeline on Azure DevOps.

It's actually the build service account which is running the script. You should make sure the build service account have sufficient permission to Access: '//192.168.1.100\c$\'

To change the identity of the build agent, just go into Windows Services and change the identity of related Build service (service name is " Azure Pipelines Agent").

  1. In the Services pane, right-click Azure Pipelines Agent.
  2. Under Service Status, click Stop.
  3. Click the Log On tab.
  4. Specify the account you want to use for the service in the This account text box.
  5. Type the new password in the Password text box, and then type the new password again in the Confirm password text box.
  6. Under Service Status, click Start.

    enter image description here

You should use a user to remote to that the server hold build agent and manually run the script to perform the deploy process. If that user is able to deploy succeed without any permission issue. Simply use this user as your build service account of Azure DevOps agent.

Hope this helps.