Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...