道歉这可能是一个冗长的,
所以我已经尝试了几个小时来配置一个自托管的Azure构建代理,但没有成功。我一直在尝试运行以下由azure devops ui生成的命令。
Powershell脚本:
$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." };If(-NOT (Test-Path $env:SystemDrive\'azagent')){mkdir $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;}}; $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://vstsagentpackage.azureedge.net/agent/3.227.1/vsts-agent-win-x64-3.227.1.zip';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 --environment --environmentname "-------------" --agent $env:COMPUTERNAME --runasservice --work '_work' --url '----------' --projectname '------------' --auth PAT --token --------------; Remove-Item $agentZip;
当运行时,它开始配置代理,直到它到达问题
>> Connect:
Connecting to server ...
>> Register Agent:
Scanning for tool capabilities.
Connecting to the server.
Pool already contains an agent with name DESKTOP-8HHF3U6.
Enter replace? (Y/N) (press enter for N) > Y
Enter Environment Virtual Machine resource tags? (Y/N) (press enter for N) >
Successfully replaced the agent
Testing agent connection.
2023-10-10 19:28:28Z: Settings Saved.
Enter enable SERVICE_SID_TYPE_UNRESTRICTED for agent service (Y/N) (press enter for N) >
Enter User account to use for the service (press enter for NT AUTHORITY\SYSTEM) >
Error reported in diagnostic logs. Please examine the log for more details.
- C:\azagent\A2\_diag\Agent_20231010-192501-utc.log
This access control list is not in canonical form and therefore cannot be modified.
我已经尝试了一些事情,从试图设置acl的微软appdata目录,也同样的代理文件夹,但似乎没有工作
有什么想法吗?
1条答案
按热度按时间gg0vcinb1#
请在PowerShell中尝试单行PowerShell脚本。