如何在 Azure Web 应用程序上使用 RM Powershell 交换插槽?
How to swap slot using RM Powershell on Azure web app?
在 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
:
详细:正在对目标“/subscriptions/xxxxxxxx-7649-4a3e-bc8b-xxxxxxxxxxxx/providers/Microsoft.Web/sites/testsite312345345/slots/staging”执行操作 "Invoking the 'slotsswap' action on the resource."。
Invoke-AzureRmResourceAction :管道已停止。
+ 调用-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo:CloseError:(:) [Invoke-AzureRmResourceAction],PipelineStoppedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet
Invoke-AzureRmResourceAction:LinkedInvalid属性Id:属性 路径 'targetSlot' 处的 ID 'production' 无效。期望任一资源名称,例如'myResource' 或限定的资源名称,例如
'myParent/myResource'.
- Invoke-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Invoke-AzureRmResourceAction], ErrorResponseMessageException
- FullyQualifiedErrorId : LinkedInvalid属性Id,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet
我尝试了多种格式来获得 $TargetSlot
生产价值,但似乎没有任何效果。
您忘记传递资源组名称:-ResourceGroupName MyRg
错误消息中不是很明显吗?我知道,我知道,这很糟糕...;)
在 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
:
详细:正在对目标“/subscriptions/xxxxxxxx-7649-4a3e-bc8b-xxxxxxxxxxxx/providers/Microsoft.Web/sites/testsite312345345/slots/staging”执行操作 "Invoking the 'slotsswap' action on the resource."。 Invoke-AzureRmResourceAction :管道已停止。 + 调用-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:CloseError:(:) [Invoke-AzureRmResourceAction],PipelineStoppedException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet
Invoke-AzureRmResourceAction:LinkedInvalid属性Id:属性 路径 'targetSlot' 处的 ID 'production' 无效。期望任一资源名称,例如'myResource' 或限定的资源名称,例如 'myParent/myResource'.
- Invoke-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Invoke-AzureRmResourceAction], ErrorResponseMessageException
- FullyQualifiedErrorId : LinkedInvalid属性Id,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet
我尝试了多种格式来获得 $TargetSlot
生产价值,但似乎没有任何效果。
您忘记传递资源组名称:-ResourceGroupName MyRg
错误消息中不是很明显吗?我知道,我知道,这很糟糕...;)