Skip to content

feat: support visualstudio.com organization URLs for System.AccessToken#23

Open
ydimi wants to merge 1 commit into
little-fort:mainfrom
ydimi:feature/support-visualstudio-com-urls
Open

feat: support visualstudio.com organization URLs for System.AccessToken#23
ydimi wants to merge 1 commit into
little-fort:mainfrom
ydimi:feature/support-visualstudio-com-urls

Conversation

@ydimi

@ydimi ydimi commented Feb 12, 2026

Copy link
Copy Markdown

Summary

Ref #22

When Azure DevOps 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 a "permission denied" error when using useSystemAccessToken: true.

This change:

  • Derives the API base URL from System.CollectionUri instead of hardcoding https://dev.azure.com
  • Passes it as AZUREDEVOPS_COLLECTION_URI environment variable to all PowerShell scripts
  • Falls back to https://dev.azure.com/{org} when the variable is not set (fully backward compatible)

What changed

File Change
index.ts Read System.CollectionUri, set AZUREDEVOPS_COLLECTION_URI env var, pass -CollectionUri to scripts
Get-AzureDevOpsPR.ps1 Add $CollectionUri param, use for API/web URL construction
Get-AzureDevOpsPRChanges.ps1 Add $CollectionUri param, use for API/web URL construction
Add-AzureDevOpsPRComment.ps1 Add $CollectionUri param, use for API/web URL construction
Add-CopilotComment.ps1 Forward AZUREDEVOPS_COLLECTION_URI env var to Add-AzureDevOpsPRComment
Update-CopilotComment.ps1 Read env var, use for URL construction
Delete-CopilotComment.ps1 Read env var, use for URL construction
README.md Document support for both URL formats

Test plan

  • Pipeline with https://dev.azure.com/{org} org URL + useSystemAccessToken: true still works
  • Pipeline with https://{org}.visualstudio.com org URL + useSystemAccessToken: true now posts PR comments successfully
  • Pipeline with azureDevOpsPat (Basic auth) still works regardless of URL format
  • Backward compatible: no new required inputs, no breaking changes

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant