Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: config.sh remove is unauthenticated when using Tokens #5107

Open
2 of 4 tasks
mbxsuite opened this issue Feb 6, 2025 · 0 comments
Open
2 of 4 tasks

[BUG]: config.sh remove is unauthenticated when using Tokens #5107

mbxsuite opened this issue Feb 6, 2025 · 0 comments

Comments

@mbxsuite
Copy link

mbxsuite commented Feb 6, 2025

What happened?

We are using dockerized agents in ubuntu for a locally installed ADO server. Multiple agents are organized in docker-compose applications.
Once the compose application is killed (host power cycle or manually) the docker containers of the agents remain in state "Exited". Upon "docker compose up", the agent container starts again, Env-Var AZP_TOKEN_FILE is defined and the file filled by docker secret. So far, so good:

start.sh is running, tries to register with ADO server, recognizes agent was already registered and calls cleanup(), which tries to "remove" the agent from server via bin/Agent.Listener. That following call is done with BASIC auth and fails.

regardless whether manual or via parameters

root@bc26c4b2cf37:/azp# ./config.sh remove
Removing agent from the server
Enter authentication type (press enter for PAT) >
Enter personal access token > ****************************************************
Error reported in diagnostic logs. Please examine the log for more details.
    - /azp/_diag/Agent_20250206-144613-utc.log
Failed: Removing agent from the server
VS30063: You are not authorized to access https://MY_DEVOPS

error log from Agent:

[2025-02-06 14:46:22Z INFO ExtensionManager] Creating instance: Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider, Agent.Listener
[2025-02-06 14:46:22Z INFO PersonalAccessToken] GetVssCredentials
[2025-02-06 14:46:22Z INFO PersonalAccessToken] token retrieved: 52 chars
[2025-02-06 14:46:22Z INFO PersonalAccessToken] cred created
[2025-02-06 14:46:22Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2025-02-06 14:46:22Z WARN VisualStudioServices] Authentication failed with status code 401.
X-TFS-ProcessId: XXX
Strict-Transport-Security: max-age=31536000; includeSubDomains
ActivityId: XXX
X-TFS-Session: XXX
X-VSS-E2EID: XXX
X-VSS-SenderDeploymentId: XXX
WWW-Authenticate: Basic realm="https://MY_DEVOPS/", Negotiate, NTLM
X-Powered-By: ASP.NET
P3P: CP="CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOC CNT"
Lfs-Authenticate: NTLM
X-Content-Type-Options: nosniff
Date: Thu, 06 Feb 2025 14:46:22 GMT

[2025-02-06 14:46:22Z WARN VisualStudioServices] Basic issued token provider instance 18307385 requires an interactive prompt which is not allowed by the current settings
[2025-02-06 14:46:22Z ERR  VisualStudioServices] GET request to https://MY_DEVOPS/_apis/connectionData is not authorized. Details: VS30063: You are not authorized to access https://MY_DEVOPS.
[2025-02-06 14:46:22Z INFO VisualStudioServices] Finished operation Location.GetConnectionData
[2025-02-06 14:46:22Z INFO LocationServer] Unable to connect to https://MY_DEVOPS/.
[2025-02-06 14:46:22Z ERR  LocationServer] Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You are not authorized to access https://MY_DEVOPS.
   at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.LocationServer.ConnectAsync(VssConnection jobConnection) in /mnt/vss/_work/1/s/src/Microsoft.VisualStudio.Services.Agent/LocationServer.cs:line 36
[2025-02-06 14:46:22Z INFO Terminal] WRITE LINE: Failed: Removing agent from the server
[2025-02-06 14:46:22Z ERR  Agent] Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You are not authorized to access https://MY_DEVOPS.
   at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.LocationServer.ConnectAsync(VssConnection jobConnection) in /mnt/vss/_work/1/s/src/Microsoft.VisualStudio.Services.Agent/LocationServer.cs:line 36
   at Microsoft.VisualStudio.Services.Agent.Util.ServerUtil.GetConnectionData(String serverUrl, VssCredentials credentials, ILocationServer locationServer, Boolean skipServerCertificateValidation) in /mnt/vss/_work/1/s/src/Microsoft.VisualStudio.Services.Agent/Util/ServerUtil.cs:line 94
   at Microsoft.VisualStudio.Services.Agent.Util.ServerUtil.DetermineDeploymentType(String serverUrl, VssCredentials credentials, ILocationServer locationServer, Boolean skipServerCertificateValidation) in /mnt/vss/_work/1/s/src/Microsoft.VisualStudio.Services.Agent/Util/ServerUtil.cs:line 85
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.CheckIsHostedServer(IConfigurationProvider agentProvider, AgentSettings agentSettings, ICredentialProvider credProvider, Boolean skipServerCertificateValidation) in /mnt/vss/_work/1/s/src/Agent.Listener/Configuration/ConfigurationManager.cs:line 1010
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.UnconfigureAsync(CommandSettings command) in /mnt/vss/_work/1/s/src/Agent.Listener/Configuration/ConfigurationManager.cs:line 530
   at Microsoft.VisualStudio.Services.Agent.Listener.Agent.ExecuteCommand(CommandSettings command) in /mnt/vss/_work/1/s/src/Agent.Listener/Agent.cs:line 120
[2025-02-06 14:46:22Z ERR  Terminal] WRITE ERROR: VS30063: You are not authorized to access https://MY_DEVOPS.

Versions

vsts-agent-linux-x64-3.248.1

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure DevOps Server 2022.1 (AzureDevOpsServer_20231109.2)

Operation system

Windows Server

Version controll system

Git

Relevant log output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant