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

时间:2017-03-09 00:25:43

标签: powershell azure azure-web-sites azure-resource-manager

关注this link on how to swap slots,使用以下脚本:

$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

Invoke-AzureRmResourceAction:LinkedInvalidPropertyId:路径'targetSlot'的属性ID'production'无效。期望资源名称,例如'myResource'或合格的资源名称,例如 'myParent / myResource'。

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

我为$TargetSlot产品值尝试过多种格式,但似乎没有任何效果。

1 个答案:

答案 0 :(得分:1)

您忘记传递资源组名称:-ResourceGroupName MyRg

错误消息不是很明显吗?我知道,我知道,这很糟糕......;)