Adding url parameter to remove agent #5319
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Fixing unauthorized access error while removing agent with the same PAT with which it has been configured
AB #5234
Description
When agents are configured using collection URLs (e.g., https://ado-server/Organization), the server returns a canonical URL which gets stored in the .agent file. During removal, the agent uses this stored canonical URL, but PAT tokens are scoped to the original collection URL used during token creation, causing "You are not authorized to access" errors.
Risk Assessment (Low / Medium / High)
Low
Unit Tests Added or Updated (Yes / No)
No
Additional Testing Performed
Yes manual testing is performed by setting up an on-prem ADO server and then trying to configure and remove the agent using the updated changes and it is working fine.
Change Behind Feature Flag (Yes / No)
No
Tech Design / Approach
Trade-offs:
Documentation Changes Required (Yes/No)
Yes - Documentation updates needed:
Logging Added/Updated (Yes/No)
Appropriate log statements added: ✅ Added Trace.Info() statement documenting URL override operation
Telemetry Added/Updated (Yes/No)
No
Rollback Scenario and Process (Yes/No)
NA
Dependency Impact Assessed and Regression Tested (Yes/No)
NA