Update your URL for your organization
In the settings for your organization you can update your URL from {organization}.visualstudio.com to dev.azure.com/{organization}. Of course once you do this some of the environment variables used by Build and Release will change and if you took a dependency on their format things will break.

We happened to have a PowerShell script named Set-PackageQuality.ps1 in a release pipeline which had some code that parsed the URL from the SYSTEM_TEAMFOUNDATIONSERVERURI environment variable (see snippet below). I also submitted a pull request to René van Osnabrugge of Xpirit who authored the original script to help anyone else who may run into this in the future.
#global variables
$account = ($env:SYSTEM_TEAMFOUNDATIONSERVERURI -replace "https://(.*)\.visualstudio\.com/", '$1').split('.')[0]
$basepackageurl = ("https://{0}.pkgs.visualstudio.com/DefaultCollection/_apis/packaging/feeds" -f $account)
The code above was not able to parse the URL correctly after we updated our organization URL settings and our REST API call failed. Previously the value loaded into the environment was as follows:
[SYSTEM_TEAMFOUNDATIONSERVERURI] --> [https://like10.vsrm.visualstudio.com/]
After we updated our organization settings the URL was now in the new format:
[SYSTEM_TEAMFOUNDATIONSERVERURI] --> [https://vsrm.dev.azure.com/like10/]
Now at this point I figured I may as well update all references to the REST API to the new URL So I dove into the REST API documentation to find the proper URL to be using after moving our organization to the new URL so I could update the PowerShell script accordingly.
This is the change I made, you’ll notice I also changed the environment variable used to get the organization name as well as the base packaging URL for the REST API.
#global variables
$organization = ($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI -replace "https://dev\.azure\.com/(.*)/", '$1').split('.')[0]
$basepackageurl = ("https://pkgs.dev.azure.com/{0}/_apis/packaging/feeds" -f $organization)
I also updated the api-version parameter in the script to specify the latest version of the API
#API URL is slightly different for npm vs. nuget...
switch($feedType)
{
"npm" { $releaseViewURL = "$basepackageurl/$feedName/npm/$packageId/versions/$($packageVersion)?api-version=5.1-preview.1" }
"nuget" { $releaseViewURL = "$basepackageurl/$feedName/nuget/packages/$packageId/versions/$($packageVersion)?api-version=5.1-preview.1" }
default { $releaseViewURL = "$basepackageurl/$feedName/nuget/packages/$packageId/versions/$($packageVersion)?api-version=5.1-preview.1" }
}
The Set-PackageQuality.ps1 script is now executing properly in our Azure Release Pipeline.

Hope this helps someone, I forgot about this dependency until the task failed 🙂
No comments yet... Be the first to leave a reply!