I have suddenly started getting this error on some of the agents that are installed on my Agent Pool. All of them are on the same Virtual Machine:
我突然开始在安装在我的座席池上的某些代理上收到此错误。所有它们都位于相同的虚拟机上:
2022-06-13T11:07:24.5665998Z ##[command]"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\Agent\02\_work\_temp\3c5c143c-117b-4adb-9c90-7043632edfa0.ps1'"
2022-06-13T11:07:26.0076950Z Added TLS 1.2 in session.
2022-06-13T11:07:26.1347095Z ##[command]Import-Module -Name C:\Program Files\PowerShell\Modules\Az.Accounts\2.8.0\Az.Accounts.psd1 -Global
2022-06-13T11:07:26.8410918Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2022-06-13T11:07:27.4110901Z ##[command]Clear-AzContext -Scope Process
2022-06-13T11:07:27.4789914Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant {{Redacted}} -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope
2022-06-13T11:07:27.5295739Z ##[error]Unable to find environment with name 'AzureCloud'
2022-06-13T11:07:27.6855841Z ##[error]There was an error with the service principal used for the deployment.
2022-06-13T11:07:27.7936958Z ##[error]PowerShell exited with code '1'.
2022-06-13T11:07:29.5169529Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2022-06-13T11:07:29.9206643Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
I have tried uninstalling and installing azure powershell, but the error persist. Also agents which are using the same service connection on a different VM are deploying without any issues.
我试着卸载并安装了Azure PowerShell,但错误仍然存在。此外,在不同的VM上使用相同服务连接的代理部署也没有任何问题。
Finally I tried to run the command locally on my VM and it succeeded, so I am not sure what could be causing this error.
最后,我尝试在我的VM上本地运行该命令,但它成功了,所以我不确定是什么导致了这个错误。
更多回答
优秀答案推荐
We experience the same error message.
我们遇到了相同的错误消息。
In our case, we ran out of space.
Therefore, the solution is to clean up the system disk.
在我们的例子中,我们的空间用完了。因此,解决方案是清理系统盘。
The real problem was not the missing space, but corrupted files in the folder
$env:HOMEPATH\.Azure of the user of DevOps Agent.
真正的问题不是缺少空间,而是DevOps代理用户的文件夹$env:HomePath\.Azure中的文件已损坏。
There can more options on how to fix it.
We decided to simply delete the folder $env:HOMEPATH\.Azure and let the mechanism create .Azure folder again own way after retry of failing job(s).
关于如何修复它,还有更多的选择。我们决定简单地删除文件夹$env:HomePath\.Azure,并让机制在重试失败的作业后以自己的方式再次创建.Azure文件夹(S)。
From the error message, it may cause by Azure PowerShell Module.
从错误消息来看,这可能是由Azure PowerShell模块导致的。
You could try uninstall the Az PowerShell module locally on your VM : https://learn.microsoft.com/en-us/powershell/azure/uninstall-az-ps?view=azps-8.0.0
您可以尝试在您的VM上本地卸载Az PowerShell模块:https://learn.microsoft.com/en-us/powershell/azure/uninstall-az-ps?view=azps-8.0.0
And re-install for "AllUsers" scope:
并为“AllUser”范围重新安装:
Install-Module -Name Az -Scope AllUsers -Repository PSGallery -Force
更多回答
You are a life saver.. After the system disk got full, and we cleared space, the pipelines were still not working. Deleting the ".Azure" folder in the HOMEPATH did the trick.
你是救命稻草..在系统盘装满后,我们清理了空间,管道仍然无法工作。删除HomePath中的“.Azure”文件夹成功了。
I tried doing this and I still had the same issue. I also tried using -AllowClobber, but the result was the same.
我试着这样做,但我仍然有同样的问题。我也尝试使用-AllowClobber,但结果是相同的。
我是一名优秀的程序员,十分优秀!