0

I am trying to run a self- hosted agent in docker, I have created the dockerfile and start.ps1 files and installed the Azure DevOps Server Express Admin console. I am getting a "Basic authentication requires a secure connection to the server " when I try running the container in docker ( switched windows containers) URL: http://computername/DefaultCollection

I have also attached a screenshot of the error

can you please advise how to resolve this issue.

Docker Run error

thanks

2 Answers2

0

Run a self-hosted agent in Docker

I could not reproduce this issue on my side with hosted agent windows-2019.

To test this issue, I created a folder dockeragent in my Azure repo, which including the files Dockerfile and start.ps1

enter image description here

Then copy the content from the document Run a self-hosted agent in Docker to those two files.

Next, create a pipeline with an inline powershell task to create the docker image and run docker container:

cd $(System.DefaultWorkingDirectory)\dockeragent

docker build -t dockeragent:latest .

docker run -e AZP_URL=https://dev.azure.com/<YourOrganizationName> -e AZP_TOKEN=<YourPAT> -e AZP_AGENT_NAME=mydockeragent dockeragent:latest

The test result:

enter image description here

To make it work, please make sure the file Dockerfile and start.ps1 is correct without any change.

If above info not help you, please share the content of your Dockerfile and the steps you did.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Thanks for your help. I am using Azure DevOps on Premises. So I have installed Azure DevOp Server 2019. URL: https://computername/DefaultCollection . I have followed your instructions above and got : The remote server returned an error: (401) Unauthorized. – Joseph Maghames Nov 05 '20 at 23:31
  • Not sure if I need to setup the URL as HTTP or HTTPS . I am happy to reinstall it to make sure all settings are correct. – Joseph Maghames Nov 05 '20 at 23:39
  • The (401) Unauthorized error means you do not have sufficient permissions, please confirm that your PAT has sufficient permissions. – Leo Liu Nov 09 '20 at 09:05
  • I have Installed Azure DevOps on Premises with Http settings and ran the docker command. On step 3 (Configuring Azure Pipelines agent) I got an error " Basic authentication requires a secure connection to the server" I also check IIS and the Basic authentication is disabled. so not sure what to do now. – Joseph Maghames Nov 09 '20 at 13:08
  • I also installed Azure DevOps on Premises with Https settings and ran the docker command. on step 1 ( Determining matching Azure Pipelines agent) I got an error " Invoke-RestMethod : The remote name could not be resolved: "ComputerName" At C:\azp\start.ps1:32 char 12 so not sure what to do here either. I also create new token for both scenarios which used in the docker run command. – Joseph Maghames Nov 09 '20 at 13:13
  • Does this solution is working for any one of you ?. I am also getting error saying Unable to find image 'dockeragent:latest' locally docker: Error response from daemon: pull access denied for dockeragent, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'. – Techiemanu Sep 30 '21 at 04:12
  • I am able to see my agent online. But I have two problems here 1. Pipeline in which I am running docker image using PowerShell scripts runs infinitely 2. I am not able to use my agent to build my code – Techiemanu Sep 30 '21 at 20:14
0

Your are using azureDevOps without https. Registering your PiplineAgent via PAT requires https (hence the error: "Basic authentication requires a secure connection to the server".

Try using other authentication Methoden (negotiation, which uses windows authentication)

Arkarin0
  • 13
  • 3