如何在Azure web应用程序上使用RM Powershell交换插槽?

问题描述:

this link on how to swap slots,与下面的脚本:如何在Azure web应用程序上使用RM Powershell交换插槽?

$ParametersObject = @{ 
    targetSlot = "production"; 
}; 
$Name = "testsite312345345"; 
$SourceSlot = "staging";  

Invoke-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots" -ResourceName "$Name/$SourceSlot" -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-07-01 -Force -Verbose; 

我得到这个输出,关键部分是Property id 'production' at path 'targetSlot' is invalid

VERBOSE:执行操作“调用资源上的‘slotsswap’行动。”在目标上“/subscriptions/xxxxxxxx-7649-4a3e-bc8b-xxxxxxxxxxxx/providers/Microsoft.Web/sites/testsite312345345/slots/staging”。 Invoke-AzureRmResourceAction:管道已停止。 + Invoke-AzureRmResourceAction -ResourceType“Microsoft.Web/sites/slots ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:CloseError::(:) [Invoke -AzureRmResourceAction],PipelineStoppedException + FullyQualifiedErrorId:Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet

调用-AzureRmResourceAction:LinkedInvalidPropertyId:物业编号 '生产' 的路径 'targetSlot' 是无效的期待或者资源名称,如。 'myResource'或合格资源名称,例如 'myParent/myResource'。

  • Invoke-AzureRmResourceAction -ResourceType“Microsoft.Web/sites/slots ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo:CloseError:( :) [调用-AzureRmResourceAction],ErrorResponseMessageException
    • FullyQualifiedErrorId:LinkedInvalidPropertyId,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet

我已经尝试了$TargetSlot生产值的许多格式,但似乎没有任何工作。

你忘了通过资源组名称:-ResourceGroupName MyRg

没有从错误消息明显吗?我知道,我知道,这是坏的;;)

+0

是的我只是执行了一个成功的交换之前回来检查这个帖子:(。谢谢大卫 – click2install