Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

Azure Deployment Slot Switch cmdlet not working from 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"

It gives the error:

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

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

There is only one subscription involved.

In the PowerShell cmdlet I've tried:

-SourceSlotName "production"

-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.

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

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

This looked like it might be the answer

Switch-AzureRmWebAppSlot no longer supports Production slot name

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" 

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

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

results this error:

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Answer given here: https://social.msdn.microsoft.com/Forums/en-US/774af941-d57b-47d4-8571-bab516f31633/deployment-swap-not-working-from-powershell?forum=windowsazurewebsitespreview

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...