Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced accountname.visualstudio.com with dev.azure.com/accountname #93

Merged
merged 54 commits into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
98a0da2
adapt integration test to additional VSTS pool 'Hosted Ubuntu 1604'
KaiWalter Jul 26, 2018
0954436
Updating psd1 and readme but not releasing new version yet.
DarqueWarrior Jul 29, 2018
6895c67
Merge remote-tracking branch 'upstream/master'
KaiWalter Jul 29, 2018
7afb6ed
breaking BuildDefinition down to Target
KaiWalter Jul 29, 2018
2a1ab7d
added integration tests for BuildDefinition
KaiWalter Jul 29, 2018
ac087b0
fixed identation in integration test
KaiWalter Jul 29, 2018
53ba724
added integration tests for BuildDefinition
KaiWalter Jul 29, 2018
2c5d978
Merge branch 'master' of github.com:KaiWalter/vsteam
KaiWalter Jul 29, 2018
6cae4b7
merge upstream
KaiWalter Jul 30, 2018
a279ff2
removed pools.ps1xml again from vsteam.psd1
KaiWalter Jul 31, 2018
7f5dc06
merge upstream
KaiWalter Aug 1, 2018
9809f21
rollback to version w/o Process and Phase
KaiWalter Aug 1, 2018
751f792
added integration test for BuildDefinition
KaiWalter Aug 1, 2018
b8c5491
rollback process and phase breakdown
KaiWalter Aug 1, 2018
288d2e5
fix typo
KaiWalter Aug 1, 2018
5a3fa0d
Merge remote-tracking branch 'upstream/master'
KaiWalter Aug 2, 2018
12e5073
Merge remote-tracking branch 'darquewarrior/master'
DarqueWarrior Aug 3, 2018
d41898d
Updated readme and updated build def tests to run on TFS and VSTS.
DarqueWarrior Aug 3, 2018
c8d1260
Merge remote-tracking branch 'upstream/master'
KaiWalter Aug 3, 2018
aea1e4d
Merge remote-tracking branch 'upstream/master'
KaiWalter Aug 12, 2018
2c2a36e
initial drilldown build def to process, phases, steps
KaiWalter Aug 13, 2018
f0fe9d8
added basic attrs to build def steps
KaiWalter Aug 13, 2018
84a8626
fixed build def unit tests
KaiWalter Aug 13, 2018
e7cb346
adapted formats for typed build defs
KaiWalter Aug 13, 2018
8102338
hooked up build def with PS provider project
KaiWalter Aug 13, 2018
5108cc4
add formats for process+phase+step
KaiWalter Aug 13, 2018
0481690
added missing Build Def + Phase properties
KaiWalter Aug 14, 2018
b7c2898
Merge remote-tracking branch 'upstream/master'
KaiWalter Aug 15, 2018
187f257
Getting Close. All tests passing.
DarqueWarrior Aug 17, 2018
afea396
Merge branch 'reivew'
DarqueWarrior Aug 17, 2018
b32ef6f
100% code coverage on teamspsdrive file.
DarqueWarrior Aug 17, 2018
e43475b
All integration tests passing.
DarqueWarrior Aug 17, 2018
a7fa45d
Added yaml and phased process types.
DarqueWarrior Aug 17, 2018
0c0d97b
Updated help for version class.
DarqueWarrior Aug 18, 2018
b50149c
Fixed broken tests
DarqueWarrior Aug 18, 2018
014258d
realign with upstream
KaiWalter Aug 21, 2018
bb94a10
remove obsolete output from buildDefinitions module
KaiWalter Aug 22, 2018
337172a
added GitRepository object to BuildDefinition
KaiWalter Aug 22, 2018
9a90727
rolled back Get-VSTeamGitRepo in Get-VSTeamBuildDef
KaiWalter Aug 23, 2018
582a113
Merge branch 'master' of github.com:KaiWalter/vsteam
KaiWalter Aug 26, 2018
d422c2c
convert VSTeamQueue from format/type to class
KaiWalter Aug 28, 2018
1c3fbc0
Got rid of merge conflict markers and little formatting.
DarqueWarrior Aug 30, 2018
4ca7384
Merge branch 'master' of https://github.com/KaiWalter/vsteam
DarqueWarrior Aug 30, 2018
696914a
Formatting.
DarqueWarrior Aug 30, 2018
a1a434b
fixed TeamPSDrive unit test
KaiWalter Sep 2, 2018
19e0957
protecting against null created by which I have seen on newer accounts.
DarqueWarrior Sep 7, 2018
c2d5f82
Merge remote-tracking branch 'upstream/master'
KaiWalter Sep 8, 2018
e856aef
check build definition type after add in integration test
KaiWalter Sep 8, 2018
e9fd627
replaced accountname.visualstudio.com with dev.azure.com/accountname
KaiWalter Sep 13, 2018
4e79c1e
Merge remote-tracking branch 'upstream/master'
KaiWalter Sep 13, 2018
11a270b
merge upstream/master
KaiWalter Sep 16, 2018
148558c
corrected for old URL in profile and added corresponding unit tests
KaiWalter Sep 16, 2018
0885d64
Merge branch 'master' of https://github.com/DarqueWarrior/vsteam
DarqueWarrior Sep 17, 2018
0d0a8b8
Bumped version to 4.0.8
DarqueWarrior Sep 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .docs/Add-VSTeamAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ Will add the account and use the OAuth Token provided by VSTS when you check the
The Visual Studio Team Services (VSTS) account name to use.
DO NOT enter the entire URL.

Just the portion before visualstudio.com. For example in the
Just the portion after dev.azure.com. For example in the
following url mydemos is the account name.
<https://mydemos.visualstudio.com>
<https://dev.azure.com/mydemos>
or
The full Team Foundation Server (TFS) url including the collection.
<http://localhost:8080/tfs/DefaultCollection>
Expand Down
4 changes: 2 additions & 2 deletions .docs/Add-VSTeamProfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ On Windows, allows you use to use Windows authentication against a local TFS ser
The Visual Studio Team Services (VSTS) account name to use.
DO NOT enter the entire URL.

Just the portion before visualstudio.com. For example in the
Just the portion after dev.azure.com. For example in the
following url mydemos is the account name.
<https://mydemos.visualstudio.com>
<https://dev.azure.com/mydemos>
or
The full Team Foundation Server (TFS) url including the collection.
<http://localhost:8080/tfs/DefaultCollection>
Expand Down
2 changes: 1 addition & 1 deletion .docs/Invoke-VSTeamRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Type: String

### -SubDomain

The SubDomain between your account and visualstudio.com. For example, to target Release Management you must use the SubDomain vsrm.
The SubDomain before .dev.azure.com. For example, to target Release Management you must use the SubDomain vsrm.

```yaml
Type: String
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 4.0.8

Merged [Pull Request](https://github.com/DarqueWarrior/vsteam/pull/93) from [Kai Walter](https://github.com/KaiWalter) which included the following:

- replaced {accountname}.visualstudio.com with dev.azure.com/{accountname}

## 4.0.7

Setting the Top to 10,000 when searching by email in Update-VSTeamUser. If you have a large number of users you should use by ID instead of by email. This addresses issue [90](https://github.com/DarqueWarrior/vsteam/issues/90).
Expand Down
2 changes: 1 addition & 1 deletion VSTeam.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
RootModule = ''

# Version number of this module.
ModuleVersion = '4.0.7'
ModuleVersion = '4.0.8'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
4 changes: 2 additions & 2 deletions docs/Add-VSTeamAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ Will add the account and use the OAuth Token provided by VSTS when you check the
The Visual Studio Team Services (VSTS) account name to use.
DO NOT enter the entire URL.

Just the portion before visualstudio.com. For example in the
Just the portion after dev.azure.com. For example in the
following url mydemos is the account name.
<https://mydemos.visualstudio.com>
<https://dev.azure.com/mydemos>
or
The full Team Foundation Server (TFS) url including the collection.
<http://localhost:8080/tfs/DefaultCollection>
Expand Down
4 changes: 2 additions & 2 deletions docs/Add-VSTeamProfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ On Windows, allows you use to use Windows authentication against a local TFS ser
The Visual Studio Team Services (VSTS) account name to use.
DO NOT enter the entire URL.

Just the portion before visualstudio.com. For example in the
Just the portion after dev.azure.com. For example in the
following url mydemos is the account name.
<https://mydemos.visualstudio.com>
<https://dev.azure.com/mydemos>
or
The full Team Foundation Server (TFS) url including the collection.
<http://localhost:8080/tfs/DefaultCollection>
Expand Down
2 changes: 1 addition & 1 deletion docs/Invoke-VSTeamRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Type: String

### -SubDomain

The SubDomain between your account and visualstudio.com. For example, to target Release Management you must use the SubDomain vsrm.
The SubDomain before .dev.azure.com. For example, to target Release Management you must use the SubDomain vsrm.

```yaml
Type: String
Expand Down
20 changes: 10 additions & 10 deletions en-US/VSTeam-Help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -226,7 +226,7 @@
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -307,7 +307,7 @@
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -403,7 +403,7 @@
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -2517,7 +2517,7 @@ PS C:\&gt; Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -2587,7 +2587,7 @@ PS C:\&gt; Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -2655,7 +2655,7 @@ PS C:\&gt; Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -2711,7 +2711,7 @@ PS C:\&gt; Add-NuGetEndpoint -EndpointName 'PowerShell Gallery' -NuGetUrl 'https
<maml:name>Account</maml:name>
<maml:Description>
<maml:para>The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL.</maml:para>
<maml:para>Just the portion before visualstudio.com. For example in the following url mydemos is the account name. &lt;https://mydemos.visualstudio.com&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
<maml:para>Just the portion after dev.azure.com. For example in the following url mydemos is the account name. &lt;https://dev.azure.com/mydemos&gt; or The full Team Foundation Server (TFS) url including the collection. &lt;http://localhost:8080/tfs/DefaultCollection&gt;</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -9200,7 +9200,7 @@ Demo-CI Demo-CI-45 notStarted</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named" aliases="none">
<maml:name>SubDomain</maml:name>
<maml:Description>
<maml:para>The SubDomain between your account and visualstudio.com. For example, to target Release Management you must use the SubDomain vsrm.</maml:para>
<maml:para>The SubDomain before .dev.azure.com. For example, to target Release Management you must use the SubDomain vsrm.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -9362,7 +9362,7 @@ Demo-CI Demo-CI-45 notStarted</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named" aliases="none">
<maml:name>SubDomain</maml:name>
<maml:Description>
<maml:para>The SubDomain between your account and visualstudio.com. For example, to target Release Management you must use the SubDomain vsrm.</maml:para>
<maml:para>The SubDomain before .dev.azure.com. For example, to target Release Management you must use the SubDomain vsrm.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down
2 changes: 1 addition & 1 deletion en-US/about_vsteam.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LONG DESCRIPTION

Name Value
---- -----
Account https://test.visualstudio.com
Account https://dev.azure.com/test
DefaultProject
Version TFS2017
Build 3.0
Expand Down
2 changes: 1 addition & 1 deletion en-US/about_vsteam_profiles.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EXAMPLES

Add-VSTeamAccount -Profile demonstrations

This will add the account https://demonstrations.visualstudio.com/
This will add the account https://dev.azure.com/demonstrations/

KEYWORDS
Team Services, VSTS, TFS, VSO, TFS, DevOps
Expand Down
2 changes: 1 addition & 1 deletion integration/test/000_team.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Describe 'Team' -Tag 'integration' {
$info.Account | Should Be $acct
}
else {
$info.Account | Should Be "https://$acct.visualstudio.com"
$info.Account | Should Be "https://dev.azure.com/$acct"
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions integration/test/010_projects.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ Describe 'VSTeam Integration Tests' -Tag 'integration' {
$buildDefs.Count | Should Be 2
}

It 'Get-VSTeamBuildDefinition by Type "build" should return 2 build definitions' {
$buildDefs = Get-VSTeamBuildDefinition -ProjectName $newProjectName -Type build
$buildDefs.Count | Should Be 2
}

### issue #87 validity of this test needs to be checked first
# It 'Get-VSTeamBuildDefinition by Type "xaml" should return no build definitions' {
# $buildDefs = Get-VSTeamBuildDefinition -ProjectName $newProjectName -Type xaml
# $buildDefs.Count | Should Be 0
# }

# Only run for VSTS
if ($api -eq 'VSTS') {
It 'Get-VSTeamBuildDefinition by Id should return intended attribute values for 1st build definition' {
Expand Down
8 changes: 4 additions & 4 deletions src/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function _isVSTS {
[parameter(Mandatory = $true)]
[string] $instance
)
return $instance -like "*.visualstudio.com*"
return $instance -like "*.visualstudio.com*" -or $instance -like "https://dev.azure.com/*"
}

function _getVSTeamAPIVersion {
Expand Down Expand Up @@ -147,8 +147,8 @@ function _addSubDomain {
$instance = [VSTeamVersions]::Account

# For VSTS Entitlements is under .vsaex
if ($subDomain -and [VSTeamVersions]::Account.ToLower().Contains('visualstudio.com')) {
$instance = [VSTeamVersions]::Account.ToLower().Replace('visualstudio.com', "$subDomain.visualstudio.com")
if ($subDomain -and [VSTeamVersions]::Account.ToLower().Contains('dev.azure.com')) {
$instance = [VSTeamVersions]::Account.ToLower().Replace('dev.azure.com', "$subDomain.dev.azure.com")
}

return $instance
Expand Down Expand Up @@ -190,7 +190,7 @@ function _getUserAgent {
}

function _useWindowsAuthenticationOnPremise {
return (_isOnWindows) -and (!$env:TEAM_PAT) -and -not ([VSTeamVersions]::Account -like "*visualstudio.com")
return (_isOnWindows) -and (!$env:TEAM_PAT) -and -not ([VSTeamVersions]::Account -like "*visualstudio.com") -and -not ([VSTeamVersions]::Account -like "https://dev.azure.com/*")
}

function _useBearerToken {
Expand Down
30 changes: 27 additions & 3 deletions src/profile.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ function Get-VSTeamProfile {
# We needed to add ForEach-Object to unroll and show the inner type
$result = Get-Content $profilesPath | ConvertFrom-Json

# convert old URL in profile to new URL
if ($result) {
$result | ForEach-Object {
if ($_.URL -match "(?<protocol>https?\://)?(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])(?<domain>\.visualstudio\.com)") {
$_.URL = "https://dev.azure.com/$($matches.account)"
}
}
}

if ($Name) {
$result = $result | Where-Object Name -eq $Name
}
Expand Down Expand Up @@ -155,11 +164,26 @@ function Add-VSTeamProfile {
}
}

# If they only gave an account name add visualstudio.com
# If they only gave an account name add https://dev.azure.com
if ($Account -notlike "*/*") {
if ($Account -match "(?<protocol>https?\://)?(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])(?<domain>\.visualstudio\.com)?") {
$Account = "https://$($matches.account).visualstudio.com"
if (-not $Name) {
$Name = $Account
}
$Account = "https://dev.azure.com/$($Account)"
}
# If they gave https://dev.azure.com extract Account and Profile name
if ($Account -match "(?<protocol>https\://)?(?<domain>dev\.azure\.com/)(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])") {
if (-not $Name) {
$Name = $matches.account
}
$Account = "https://dev.azure.com/$($matches.account)"
}
# If they gave https://xxx.visualstudio.com extract Account and Profile name, convert to new URL
if ($Account -match "(?<protocol>https?\://)?(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])(?<domain>\.visualstudio\.com)") {
if (-not $Name) {
$Name = $matches.account
}
$Account = "https://dev.azure.com/$($matches.account)"
}

if ($UseBearerToken.IsPresent) {
Expand Down
12 changes: 7 additions & 5 deletions src/team.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,15 @@ function Add-VSTeamAccount {
$_pat = $PersonalAccessToken
}

# If they only gave an account name add visualstudio.com
# If they only gave an account name add https://dev.azure.com
if ($Account -notlike "*/*") {
if ($Account -match "(?<protocol>https?\://)?(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])(?<domain>\.visualstudio\.com)?") {
$Account = "https://$($matches.account).visualstudio.com"
}
$Account = "https://dev.azure.com/$($Account)"
}

# If they gave https://xxx.visualstudio.com convert to new URL
if ($Account -match "(?<protocol>https?\://)?(?<account>[A-Z0-9][-A-Z0-9]*[A-Z0-9])(?<domain>\.visualstudio\.com)") {
$Account = "https://dev.azure.com/$($matches.account)"
}

if ($UseBearerToken.IsPresent) {
$token = $_pat
$encodedPat = ''
Expand Down
Loading