Azure部署插槽开关cmdlet无法在PowerShell中运行 [英] Azure Deployment Slot Switch cmdlet not working from PowerShell

查看:60
本文介绍了Azure部署插槽开关cmdlet无法在PowerShell中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从Portal进行此交换,但是在PowerShell中将无法使用

I can do this swap from the Portal, however it won't work from PowerShell

Switch-AzureRmWebAppSlot   -ResourceGroupName "z_test_amp_Resource_Group" -Name "z-test-amp-EXPERIMENT-TEST-APP" -DestinationSlotName "z-test-amp-EXPER-DEPLOY-SLOT-01" -SourceSlotName "production"

它给出了错误:

资源组下的资源"Microsoft.Web/sites/z-test-amp-EXPERIMENT-TEST-APP/slots/production" 找不到"z_test_amp_Resource_Group".

The Resource 'Microsoft.Web/sites/z-test-amp-EXPERIMENT-TEST-APP/slots/production' under resource group 'z_test_amp_Resource_Group' was not found.

在门户交换"对话框中,它在源DDL中提供了生产",并且效果很好.

In the Portal Swap dialog it provides "production" in the Source DDL, and that works fine.

仅涉及一项订阅.

在PowerShell cmdlet中,我已经尝试过:

In the PowerShell cmdlet I've tried:

-SourceSlotName生产"

-SourceSlotName "production"

-SourceSlotName z-test-amp-EXPERIMENT-TEST-APP

-SourceSlotName z-test-amp-EXPERIMENT-TEST-APP

-SourceSlotName"z-test-amp-EXPERIMENT-TEST-APP"

-SourceSlotName "z-test-amp-EXPERIMENT-TEST-APP"

在每种情况下,我都会收到相同类型的消息:找不到该名称的广告位.

In each case I get the same type of message: can't finds a slot by that name.

如果我忽略了-SourceSlotName参数,它似乎会接受其他所有内容,然后要求输入-SourceSlotName.

If I leave out the -SourceSlotName parameter it seems to accept everything else and then asks for the -SourceSlotName.

如果我获得了该网络应用的广告位列表,请使用以下方法:

If I get a list of slots for the web app, using this:

Get-AzureRmWebAppSlot -ResourceGroupName z_test_amp_Resource_Group -name z-test-amp-EXPERIMENT-TEST-APP

它列出了(很多信息,最后是信息) 名称:z-test-amp-EXPERIMENT-TEST-APP/z-test-amp-EXPER-DEPLOY-SLOT-01

it lists (lots of information and then finally) Name: z-test-amp-EXPERIMENT-TEST-APP/z-test-amp-EXPER-DEPLOY-SLOT-01

这看起来可能是答案

Switch-AzureRmWebAppSlot不再支持生产插槽名称

上面写着尝试

which says try this:

Switch-AzureRmWebAppSlot   -ResourceGroupName "z_test_amp_Resource_Group" -Name "z-test-amp-EXPERIMENT-TEST-APP" -SourceSlotName "z-test-amp-EXPER-DEPLOY-SLOT-01" 

但是忽略目标位置会导致错误"TargetSlot不能为空"

but that leaving out the destination slot gives the error "TargetSlot must not be null"

然后包含-TargetSlot参数,如下所示:

And then including the -TargetSlot parameter like so:

Switch-AzureRmWebAppSlot   -ResourceGroupName "z_test_amp_Resource_Group" -Name "z-test-amp-EXPERIMENT-TEST-APP" -SourceSlotName "z-test-amp-EXPER-DEPLOY-SLOT-01" -TargetSlot production

导致此错误:

找不到与参数名称'TargetSlot'相匹配的参数.

A parameter cannot be found that matches parameter name 'TargetSlot'.

问题:为什么这不起作用/此cmdlet的新正确语法是什么?

Question: why is this not working / what is new correct syntax for this cmdlet?

推荐答案

此处给出答案: https://social.msdn.microsoft.com/Forums/zh-CN/774af941-d57b-47d4-8571-bab516f31633/deployment-swap-not-working-from-powershell?forum=windowsazurewebsitespreview

显然,PowerShell既需要源也要目标,但只希望在目标中生产".

Apparently PowerShell wants both Source and Destination, but "production" only in the Destination.

Switch-AzureRmWebAppSlot   -ResourceGroupName "z_test_amp_Resource_Group" -Name "z-test-amp-EXPERIMENT-TEST-APP" -SourceSlotName "z-test-amp-EXPER-DEPLOY-SLOT-01" -DestinationSlotName "production"

这篇关于Azure部署插槽开关cmdlet无法在PowerShell中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆