问题描述
我们在Azure管道中使用Powershell进行了一次Cloud Service(Classic)交换,该交换器已经使用了一年,由一位前雇员进行设置,现在却因错误而失败:
Info.plist
实际的作业任务是将PowerShell脚本设置为内联,将Error操作设置为Stop。实际的脚本:
Move-AzureDeployment : An error occurred while sending the request.
At D:\a\_temp\blahblahblah.ps1:8 char:1
+ Move-AzureDeployment -ServiceName $servicename
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-AzureDeployment],HttpRequestException
+ FullyQualifiedErrorId : System.Net.Http.HttpRequestException,Microsoft.WindowsAzure.Commands.ServiceManagement.H
ostedServices.MoveAzureDeploymentCommand
我确定这可能是带有管理证书的服务连接已过期,但是我有一个有效的工作,发现它的设置与另一个正在运行的类似管道/服务连接完全相同。
解决方法
因此问题是两件事,即更新后的SSL和PowerShell版本问题。为了处理SSL问题,我将此行添加到了内联脚本的顶部:
[Net.ServicePointManager]::SecurityProtocol = "tls12,tls11,tls"
对于PowerShell问题,它需要更改为管道的Azure PowerShell应用程序,因此我们可以回滚到特定任务版本和此答复中所见的4.2.1 PowerShell版本:
Programmatically Swap Staging Slot to Production Slot in Azure Cloud Service
这可能是如今交换Cloud Service(经典)的唯一方法。有点烦人的Azure推销了这项经典服务,但从未对其进行适当维护。