feat: support visualstudio.com organization URLs for System.AccessToken#23
Open
ydimi wants to merge 1 commit into
Open
feat: support visualstudio.com organization URLs for System.AccessToken#23ydimi wants to merge 1 commit into
ydimi wants to merge 1 commit into
Conversation
When organizations use the legacy https://{org}.visualstudio.com URL
format, the System.AccessToken (OAuth Bearer token) is scoped to that
domain. Previously, all API calls were hardcoded to
https://dev.azure.com/{org}, causing Bearer token authentication to
fail with permission denied errors.
This change derives the API base URL from System.CollectionUri and
passes it as AZUREDEVOPS_COLLECTION_URI to all PowerShell scripts, so
API calls use the same domain as the OAuth token. Falls back to
https://dev.azure.com/{org} when the variable is not available,
preserving full backward compatibility.
Ref little-fort#22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Ref #22
When Azure DevOps organizations use the legacy
https://{org}.visualstudio.comURL format, theSystem.AccessToken(OAuth Bearer token) is scoped to that domain. Previously, all API calls were hardcoded tohttps://dev.azure.com/{org}, causing Bearer token authentication to fail with a "permission denied" error when usinguseSystemAccessToken: true.This change:
System.CollectionUriinstead of hardcodinghttps://dev.azure.comAZUREDEVOPS_COLLECTION_URIenvironment variable to all PowerShell scriptshttps://dev.azure.com/{org}when the variable is not set (fully backward compatible)What changed
index.tsSystem.CollectionUri, setAZUREDEVOPS_COLLECTION_URIenv var, pass-CollectionUrito scriptsGet-AzureDevOpsPR.ps1$CollectionUriparam, use for API/web URL constructionGet-AzureDevOpsPRChanges.ps1$CollectionUriparam, use for API/web URL constructionAdd-AzureDevOpsPRComment.ps1$CollectionUriparam, use for API/web URL constructionAdd-CopilotComment.ps1AZUREDEVOPS_COLLECTION_URIenv var toAdd-AzureDevOpsPRCommentUpdate-CopilotComment.ps1Delete-CopilotComment.ps1README.mdTest plan
https://dev.azure.com/{org}org URL +useSystemAccessToken: truestill workshttps://{org}.visualstudio.comorg URL +useSystemAccessToken: truenow posts PR comments successfullyazureDevOpsPat(Basic auth) still works regardless of URL format🤖 Generated with Claude Code