You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
* Adding agent re-configuration scripts for TFS hardware move scenario
* updating the comments
* adding example usage
* Resolving comments
* resolving comments 2
* Agent config script for detach attach scenario
Agent config script for detach attach scenario
* Adding script for the scenario when source collection is not online
Adding script for the scenario when source collection is not online
* Resolving comments
Resolving comments
This script is applicable for AzureDevOpsServer 2019 or later.
3
+
This is a guidance script to re-configure deployment group agents to the target AzureDevOpsServer after detach/attach activity. This script is applicable if the source collection is not online. If source AzureDevOpsServer collection is online (Side by Side scenario), use ConfigureAgentToTargetServerUsingSourceServer,ps1 script instead.
4
+
5
+
Inputs:
6
+
1. targetServerUrl : New AzureDevOpsServer instance url.
7
+
2. targeServerPatToken : PAT token from target AzureDevOpsServer with Deployment group manage scope (at least)
8
+
3. existingAgentFolder: The script will Auto-detect the agent folder if it was running as windows service. User need to pass the folder path otherwise.
9
+
4. agentDownloadUrl: this is optional, user can specify if she wants any specific agent version to be installed.
10
+
5. tags : Tags of the target. Since the source AzureDevOpsServer is not available, user need to pass the tags explicitly.
11
+
5. action: By default, the script will not do any update operation, it will just print what changes will happen after the script is applied. User need to set action parameter to 'apply' to update execute actual steps.
12
+
13
+
Output:
14
+
If action is set to apply, this script this script will
15
+
1. Configure a new agent to the deployment group in the target AzureDevOpsServer with same properties as the existing agent in the source AzureDevOpsServer.
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] “Administrator”)){
34
+
throw"Run command in an administrator PowerShell prompt"
35
+
};
36
+
37
+
If ($PSVersionTable.PSVersion-lt (New-Object System.Version("3.0"))){
38
+
throw"The minimum version of Windows PowerShell that is required by the script (3.0) does not match the currently running version of Windows PowerShell."
throw"Not able to auto detect existing agent folder. Provide the existingAgentFolder as input parameter. You can find it in agent capabilities UI as Agent.HomeDirectory. Generally it is in C:\vstsagent folder.";
56
+
}
57
+
58
+
cd $existingAgentFolder;
59
+
60
+
if (-not (Test-Path'.\.agent')){
61
+
throw"No agent installed in this path. Please run this script from Agent Home Directory. Generally it is in C:\vstsagent folder."
$dg=Invoke-RestMethod-Uri $getDeploymentGroupUrl-Method Get -Headers @{Authorization="Basic $encodedPat"} -ContentType "application/json"
90
+
$deploymentGroupName=$dg.name
91
+
92
+
93
+
# Create and go to new agent folder
94
+
$parentPath=Split-Path$existingAgentFolder-Parent
95
+
cd $parentPath
96
+
$newAgentFolfer="";
97
+
98
+
for ($i=1; $i-lt100; $i++){
99
+
$destFolder="A"+$i.ToString();
100
+
if (-NOT (Test-Path ($destFolder))){
101
+
$newAgentFolfer=$destFolder;
102
+
break;
103
+
}
104
+
};
105
+
106
+
$newAgentPath=$parentPath+$newAgentFolfer;
107
+
108
+
if ($action-ne"apply"){
109
+
Write-Verbose-Verbose "If action is set to apply, this script will configure an agent with name $agentName and tags $tags in $newAgentPath path to the deployment group $deploymentGroupName in the AzureDevOpsServer $targetServerUrl with same properties as the existing agent $agentName in the source AzureDevOpsServer $sourceServerUrl.";
110
+
return0;
111
+
}
112
+
113
+
Write-Verbose-Verbose "Start execution : It will configure an agent with name $agentName and tags $tags in $newAgentPath path to the deployment group $deploymentGroupName in the AzureDevOpsServer $targetServerUrl with same properties as the existing agent $agentName in the source AzureDevOpsServer $sourceServerUrl.";
This script is applicable for AzureDevOpsServer 2019 or later.
3
+
This is a guidance script to re-configure deployment group agents to the target AzureDevOpsServer after detach/attach activity. The script is applicable if both source and target AzureDevOpsServer collections are online.
4
+
5
+
Inputs:
6
+
1. targetServerUrl : New AzureDevOpsServer instance url.
7
+
2. sourceServerPatToken : PAT token from source AzureDevOpsServer with Deployment group manage scope (at least)
8
+
3. existingAgentFolder: The script will Auto-detect the agent folder if it was running as windows service. User need to pass the folder path otherwise.
9
+
4. agentDownloadUrl: this is optional, user can specify if she wants any specific agent version to be installed.
10
+
5. action: By default, the script will not do any update operation, it will just print what changes will happen after the script is applied. User need to set action parameter to 'apply' to update execute actual steps.
11
+
12
+
Output:
13
+
If action is set to apply, this script this script will
14
+
1. Configure a new agent to the deployment group in the target AzureDevOpsServer with same properties as the existing agent in the source AzureDevOpsServer including tags.
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] “Administrator”)){
32
+
throw"Run command in an administrator PowerShell prompt"
33
+
};
34
+
35
+
If ($PSVersionTable.PSVersion-lt (New-Object System.Version("3.0"))){
36
+
throw"The minimum version of Windows PowerShell that is required by the script (3.0) does not match the currently running version of Windows PowerShell."
throw"Not able to auto detect existing agent folder. Provide the existingAgentFolder as input parameter. You can find it in agent capabilities UI as Agent.HomeDirectory. Generally it is in C:\vstsagent folder.";
54
+
}
55
+
56
+
cd $existingAgentFolder;
57
+
58
+
if (-not (Test-Path'.\.agent')){
59
+
throw"No agent installed in this path. Please run this script from Agent Home Directory. Generally it is in C:\vstsagent folder."
$dm=Invoke-RestMethod-Uri $getDeploymentMachineUrl-Method Get -Headers @{Authorization="Basic $encodedPat"} -ContentType "application/json"
96
+
$tags=$dm.value[0].tags -join",";
97
+
98
+
99
+
# Create and go to new agent folder
100
+
$parentPath=Split-Path$existingAgentFolder-Parent
101
+
cd $parentPath
102
+
$newAgentFolfer="";
103
+
104
+
for ($i=1; $i-lt100; $i++){
105
+
$destFolder="A"+$i.ToString();
106
+
if (-NOT (Test-Path ($destFolder))){
107
+
$newAgentFolfer=$destFolder;
108
+
break;
109
+
}
110
+
};
111
+
112
+
$newAgentPath=$parentPath+$newAgentFolfer;
113
+
114
+
if ($action-ne"apply"){
115
+
Write-Verbose-Verbose "If action is set to apply, this script will configure an agent with name $agentName in $newAgentPath path to the deployment group $deploymentGroupName in the AzureDevOpsServer $targetServerUrl with same properties as the existing agent $agentName in the source AzureDevOpsServer $sourceServerUrl incluing tags $tags.";
116
+
return0;
117
+
}
118
+
119
+
Write-Verbose-Verbose "Start execution : It will configure an agent with name $agentName in $newAgentPath path to the deployment group $deploymentGroupName in the AzureDevOpsServer $targetServerUrl with same properties as the existing agent $agentName in the source AzureDevOpsServer $sourceServerUrl incluing tags $tags.";
Copy file name to clipboardExpand all lines: DeploymentAgentReconfigurationScripts/HardwareMoveScanrio/TFS2018 Update2/HardwareMoveRemoveOldAgent.ps1
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
<#
2
-
This script is applicable for TFS 2018 Update2.
2
+
This script is applicable for TFS 2018 Update2 or later.
3
3
This is a guidance script to bring a deployment group agent online after TFS Hardware move activity. Post Hardware move, all the agents will be offline as the TFS server url has been updated. User can use\follow this script to bring them online. The script has to be run from Administrator PowerShell prompt on the each agent machine.
Copy file name to clipboardExpand all lines: DeploymentAgentReconfigurationScripts/HardwareMoveScanrio/TFS2018 Update2/HardwareMoveRetainOldAgent.ps1
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
<#
2
-
This script is applicable for TFS 2018 Update2.
2
+
This script is applicable for TFS 2018 Update2 or later.
3
3
This is a guidance script to bring a deployment group agent online after TFS Hardware move activity. Post Hardware move, all the agents will be offline as the TFS server url has been updated. User can use\follow this script to bring them online. The script has to be run from Administrator PowerShell prompt on the each agent machine.
0 commit comments