代码之家  ›  专栏  ›  技术社区  ›  Chris Marshall

配置azure azagent给我带来了规范问题

  •  0
  • Chris Marshall  · 技术社区  · 1 年前

    应用程序这可能是一个冗长的应用程序,

    因此,我已经尝试了好几个小时来配置自托管的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.
    

    我尝试了一些方法,比如在microsoft appdata目录上设置acl,在代理文件夹中也尝试了同样的方法,但似乎都不起作用

    有什么想法吗?

    0 回复  |  直到 1 年前
        1
  •  0
  •   Miao Tian-MSFT    1 年前

    请在PowerShell中尝试单行PowerShell脚本。

    Get-Acl C:\azagent| Set-Acl C:\azagent
    
    推荐文章