Powershell命令行开关New-AzureRmWebAppSlot随机给出“位置不能为空”错误

时间:2018-10-17 09:40:54

标签: azure-devops azure-web-sites azure-pipelines azure-powershell azure-rm

我们有一个PowerShell脚本,该脚本为每个部署在部署中涉及的每个Azure Web应用程序上创建一个插槽。今天早上,这突然开始对我们的许多部署都失败了,但并不是所有相同的代码都在运行和部署。

开始失败的行:

$deploySlot = New-AzureRmWebAppSlot -ResourceGroupName "$ResourceGroupName" -Name "$($webapp.serviceApp)" -Slot "$slotName"

我在尝试捕获该命令的过程中添加了Resolve-AzureRmError -Last,并得到了以下内容:

2018-10-17T06:35:06.0228046Z 
2018-10-17T06:35:06.0228769Z 
2018-10-17T06:35:06.0230563Z    HistoryId: 1
2018-10-17T06:35:06.0230703Z 
2018-10-17T06:35:06.0231161Z 
2018-10-17T06:35:06.0234999Z Message        : 'Location' cannot be null.
2018-10-17T06:35:06.0235402Z StackTrace     :    at Microsoft.Azure.Management.WebSites.Models.Resource.Validate()
2018-10-17T06:35:06.0235646Z                     at Microsoft.Azure.Management.WebSites.Models.Site.Validate()
2018-10-17T06:35:06.0268780Z                     at Microsoft.Azure.Management.WebSites.WebAppsOperations.<BeginCreateOrUpdateSlotWithHttpMessagesAs
2018-10-17T06:35:06.0269062Z                  ync>d__326.MoveNext()
2018-10-17T06:35:06.0269217Z                  --- End of stack trace from previous location where exception was thrown ---
2018-10-17T06:35:06.0269503Z                     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2018-10-17T06:35:06.0269658Z                     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2018-10-17T06:35:06.0301248Z                     at Microsoft.Azure.Management.WebSites.WebAppsOperations.<CreateOrUpdateSlotWithHttpMessagesAsync>d
2018-10-17T06:35:06.0302594Z                  __137.MoveNext()
2018-10-17T06:35:06.0304593Z                  --- End of stack trace from previous location where exception was thrown ---
2018-10-17T06:35:06.0306400Z                     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2018-10-17T06:35:06.0306724Z                     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2018-10-17T06:35:06.0312293Z                     at Microsoft.Azure.Management.WebSites.WebAppsOperationsExtensions.<CreateOrUpdateSlotAsync>d__265.
2018-10-17T06:35:06.0314813Z                  MoveNext()
2018-10-17T06:35:06.0314990Z                  --- End of stack trace from previous location where exception was thrown ---
2018-10-17T06:35:06.0315157Z                     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2018-10-17T06:35:06.0315321Z                     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2018-10-17T06:35:06.0315562Z                     at Microsoft.Azure.Commands.WebApps.Utilities.WebsitesClient.CreateWebApp(String 
2018-10-17T06:35:06.0315722Z                  resourceGroupName, String webAppName, String slotName, String location, String serverFarmId, 
2018-10-17T06:35:06.0315886Z                  CloningInfo cloningInfo, String aseName, String aseResourceGroupName)
2018-10-17T06:35:06.0316053Z                     at 
2018-10-17T06:35:06.0316261Z                  Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots.NewAzureWebAppSlotCmdlet.ExecuteCmdlet()
2018-10-17T06:35:06.0316608Z                     at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2018-10-17T06:35:06.0316902Z Exception      : Microsoft.Rest.ValidationException
2018-10-17T06:35:06.0317067Z InvocationInfo : {New-AzureRmWebAppSlot}
2018-10-17T06:35:06.0323731Z Line           :                 $deploySlot = New-AzureRmWebAppSlot -ResourceGroupName "$ResourceGroupName" -Name 
2018-10-17T06:35:06.0324841Z                  "$($webapp.serviceApp)" -Slot "$slotName"  
2018-10-17T06:35:06.0325059Z                  
2018-10-17T06:35:06.0325200Z Position       : At D:\a\r1\a\Cloud apps\AzureDeploy\Publish-WebApps.ps1:313 char:31
2018-10-17T06:35:06.0326182Z                  + ... eploySlot = New-AzureRmWebAppSlot -ResourceGroupName "$ResourceGroupN ...
2018-10-17T06:35:06.0326820Z                  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-10-17T06:35:06.0326981Z HistoryId      : 1
2018-10-17T06:35:06.0327103Z 

该命令在 VSTS Azure PowerShell 任务上执行。

我在try catch中添加了一个重试,它似乎总是可以进行重试。超时了吗?

0 个答案:

没有答案