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

[Question]: Environment Not Found #4722

Closed
1 of 4 tasks
alandillon opened this issue Mar 20, 2024 · 2 comments
Closed
1 of 4 tasks

[Question]: Environment Not Found #4722

alandillon opened this issue Mar 20, 2024 · 2 comments

Comments

@alandillon
Copy link

alandillon commented Mar 20, 2024

Describe your question

We have a service connection in devops, and gave it the correct permissions to add a resource to the new environment. This works for our dev environment but in test it initially failed with a permission error not having access to the environment. Now it is failing with environment not found.

First error (Now Resolved):

[2024-03-19 18:45:15Z INFO Terminal] WRITE LINE: >> Register Agent:
[2024-03-19 18:45:15Z INFO Terminal] WRITE LINE: 
[2024-03-19 18:45:15Z INFO CommandSettings] Arg 'projectname': 'xxx'
[2024-03-19 18:45:15Z INFO EnvironmentVMResourceConfigProvider] vm resource will be configured against the environment 'test'
[2024-03-19 18:45:15Z ERR  VisualStudioServices] GET request to https://dev.azure.com/xxx/cloud/_apis/pipelines/environments failed. HTTP Status: Unauthorized, AFD Ref: Ref A: 8AB1D7D71B714FC897F693ED6BF4A376 Ref B: BL2AA2030109037 Ref C: 2024-03-19T18:45:15Z
[2024-03-19 18:45:15Z INFO CommandSettings] Flag 'unattended': 'True'
[2024-03-19 18:45:15Z ERR  Agent] Microsoft.VisualStudio.Services.Common.VssServiceException: TF400813: The user 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx' is not authorized to access this resource.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   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.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.GetEnvironmentAsync(String projectName, String environmentName) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationProvider.cs:line 572
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.GetPoolIdAndName(AgentSettings agentSettings, CommandSettings command) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationProvider.cs:line 456
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationManager.cs:line 197
   at Microsoft.VisualStudio.Services.Agent.Listener.Agent.ExecuteCommand(CommandSettings command) in D:\a\1\s\src\Agent.Listener\Agent.cs:line 103
[2024-03-19 18:45:15Z ERR  Terminal] WRITE ERROR: TF400813: The user 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx' is not authorized to access this resource.

New error:

[2024-03-19 22:13:13Z INFO Terminal] WRITE LINE: >> Register Agent:
[2024-03-19 22:13:13Z INFO Terminal] WRITE LINE: 
[2024-03-19 22:13:13Z INFO CommandSettings] Arg 'projectname': 'xxx'
[2024-03-19 22:13:13Z INFO EnvironmentVMResourceConfigProvider] vm resource will be configured against the environment 'test'
[2024-03-19 22:13:13Z INFO CommandSettings] Flag 'unattended': 'True'
[2024-03-19 22:13:13Z ERR  Agent] Microsoft.TeamFoundation.DistributedTask.WebApi.EnvironmentNotFoundException: Environment not found: 'test'
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.GetEnvironmentAsync(String projectName, String environmentName) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationProvider.cs:line 576
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.GetPoolIdAndName(AgentSettings agentSettings, CommandSettings command) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationProvider.cs:line 456
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command) in D:\a\1\s\src\Agent.Listener\Configuration\ConfigurationManager.cs:line 197
   at Microsoft.VisualStudio.Services.Agent.Listener.Agent.ExecuteCommand(CommandSettings command) in D:\a\1\s\src\Agent.Listener\Agent.cs:line 103
[2024-03-19 22:13:13Z ERR  Terminal] WRITE ERROR: Environment not found: 'test'

Versions

agent v3.227.2 / windows 10

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

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

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Operation system

windows 10

Version controll system

No response

Azure DevOps Server Version (if applicable)

No response

@KonstantinTyukalov
Copy link
Contributor

Hi @alandillon, this looks like an issue on the Service side.
Please, raise your question of the Developer Community to get right eyes on it

@alandillon
Copy link
Author

This was resolved. Turns out the service connection we were using only had a stakeholder license. Once it was given a basic license everything started working.

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

3 participants