Fix config.sh remove command to support --url parameter for organization-scoped PATs #5242
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.
Problem
Users with PATs scoped to specific organizations were unable to remove agents using the
config.sh remove
command. The issue occurred because:remove
command didn't accept the--url
parameterThis forced users to change their PAT scope to "All accessible organizations" just to remove agents.
Solution
This PR adds support for the
--url
parameter to theremove
command and updates the removal logic to use the specified URL when provided.Changes Made
--url
support to remove command: Moved theUrl
property fromConfigureAgent
toConfigureOrRemoveBase
so both configure and remove commands inherit itCommandSettings.GetUrl()
to work with both configure and remove commandsUnconfigureAsync()
to prefer command-line URL over stored configuration URLUsage Examples
Before (would fail with organization-scoped PAT):
./config.sh remove --unattended --auth pat --token xxxxx # Always tries to connect to https://ado-server/ (base URL)
After (now works with organization-scoped PAT):
./config.sh remove --unattended --url https://ado-server/Organization --auth pat --token xxxxx # Uses the specified URL with organization path
Backward Compatibility
The changes maintain full backward compatibility. If no
--url
parameter is provided during removal, the system falls back to using the stored configuration URL, preserving existing behavior.Testing
Fixes #5234.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
03nvsblobprodwcus014.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)055vsblobprodwcus02.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)1g1vsblobprodwcus01.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)3eavsblobprodwcus03.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)3zgvsblobprodwcus024.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)40qvsblobprodwcus022.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)4fdvsblobprodwcus012.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)5tbvsblobprodwcus06.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)61cvsblobprodwcus010.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)73dvsblobprodwcus07.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)8usvsblobprodwcus011.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)9owvsblobprodwcus020.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)arpvsblobprodwcus017.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)crcvsblobprodwcus021.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)fslvsblobprodwcus015.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)uubvsblobprodwcus018.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)vwmvsblobprodwcus016.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)xg1vsblobprodwcus019.vsblob.vsassets.io
dotnet build azure-pipelines-agent.sln --verbosity quiet
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.