简体   繁体   English

accessToken 对于从 Windows 服务器连接到 Azure DevOps 部署组无效

[英]A accessToken is not valid for connecting to Azure DevOps deployment group from Windows server

In Azure Devops Server, I have created a group in Deployment Groups .在 Azure Devops Server 中,我在Deployment Groups中创建了一个组。 A registration script was created for run in the target server.创建了一个注册脚本以在目标服务器中运行。 This is the generated script.这是生成的脚本。

$ErrorActionPreference="Stop";If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] “Administrator”)){ throw "Run command in an administrator PowerShell prompt"};If($PSVersionTable.PSVersion -lt (New-Object System.Version("3.0"))){ 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." $ErrorActionPreference="Stop";If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] “Administrator”)){ throw "在管理员 PowerShell 提示符下运行命令"};If($PSVersionTable.PSVersion -lt (New-Object System.Version("3.0"))){ throw "脚本所需的 Windows Z3D265B4E1EEEF30DDF1788181FA00 的最低版本()与当前运行的 Windows PowerShell 版本不匹配。” };If(-NOT (Test-Path $env:SystemDrive'azagent')){mkdir $env:SystemDrive'azagent'}; };If(-NOT (Test-Path $env:SystemDrive'azagent')){mkdir $env:SystemDrive'azagent'}; cd $env:SystemDrive'azagent'; cd $env:SystemDrive'azagent'; for($i=1; $i -lt 100; $i++){$destFolder="A"+$i.ToString();if(-NOT (Test-Path ($destFolder))){mkdir $destFolder;cd $destFolder;break;}}; for($i=1; $i -lt 100; $i++){$destFolder="A"+$i.ToString();if(-NOT (Test-Path ($destFolder))){mkdir $destFolder; cd $destFolder;break;}}; $agentZip="$PWD\agent.zip";$DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy;$securityProtocol=@();$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol;$securityProtocol+=[Net.SecurityProtocolType]::Tls12;[Net.ServicePointManager]::SecurityProtocol=$securityProtocol;$WebClient=New-Object Net.WebClient; $agentZip="$PWD\agent.zip";$DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy;$securityProtocol=@();$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol;$securityProtocol+=[Net .SecurityProtocolType]::Tls12;[Net.ServicePointManager]::SecurityProtocol=$securityProtocol;$WebClient=New-Object Net.WebClient; $Uri='https://go.microsoft.com/fwlink/?linkid=2066756';if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))){$WebClient.Proxy= New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True);}; $Uri='https://go.microsoft.com/fwlink/?linkid=2066756';if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))){$WebClient.Proxy= New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True);}; $WebClient.DownloadFile($Uri, $agentZip);Add-Type -AssemblyName System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::ExtractToDirectory( $agentZip, "$PWD");.\config.cmd --deploymentgroup --deploymentgroupname "DG-Test" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://devops.MyCompany.com/tfs/' --collectionname 'Col-FRN-Main' --projectname 'T-MyCompany'; $WebClient.DownloadFile($Uri, $agentZip);Add-Type -AssemblyName System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::ExtractToDirectory($agentZip, "$PWD");\. .cmd --deploymentgroup --deploymentgroupname "DG-Test" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://devops.MyCompany.com/tfs/' --collectionname ' Col-FRN-Main' --projectname 'T-MyCompany'; Remove-Item $agentZip;删除项目 $agentZip;

I run the script then PowerShell asks me to Enter authentication type (press enter for PAT) , so I enter an accessToken that is generated in Personal Access Token but PowerShell returns Enter authentication type (press enter for PAT) .我运行脚本,然后 PowerShell 要求我Enter authentication type (press enter for PAT) ,因此我输入了在Personal Access Token中生成的 accessToken,但 PowerShell 返回Enter authentication type (press enter for PAT) I could use the accessToken for connecting Team explorer in Visual studio to my DevOps server and connecting agent pool to my DevOps server, but I have trouble connecting deployment agnet.我可以使用 accessToken 将 Visual Studio 中的 Team Explorer 连接到我的 DevOps 服务器,并将代理池连接到我的 DevOps 服务器,但是我无法连接部署 agnet。 What's wrong?怎么了?

When PowerShell asks you to Enter authentication type (press enter for PAT), you are supposed to press enter on your keyboard.当 PowerShell 要求您输入身份验证类型(为 PAT 按 Enter)时,您应该按键盘上的 Enter。 Then it will prompt you to enter your Personal Access Token.然后它会提示您输入您的个人访问令牌。 Follow the prompts and you should be able to connect successfully.按照提示操作,您应该能够成功连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM