问题
I'm adding this in the hope that it saves other people wasting time like I just have. I can't currently explain why this has changed, but I can supply the resolution that's worked for me.
TL;DR: You no longer need to specify the production slot when using Switch-AzureRmWebAppSlot, only supply -SourceSlot with the name of the slot you want to switch with your production slot.
Error:
Switch-AzureRmWebAppSlot : The Resource 'Microsoft.Web/sites/SiteName/slots/production' under resource group 'ResourceGroupName' was not found. At line:1 char:1 + Switch-AzureRmWebAppSlot -SourceSlotName $SourceSlot -DestinationSlot ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Switch-AzureRmWebAppSlot], CloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots.SwitchAzureWebAppSlot
回答1:
Old working code:
Switch-AzureRmWebAppSlot -SourceSlotName 'production' -DestinationSlotName 'staging' -ResourceGroupName 'ResourceGroup' -Name 'webapp'
New working code:
Switch-AzureRmWebAppSlot -SourceSlotName 'staging' -ResourceGroupName 'ResourceGroup' -Name 'webapp'
来源:https://stackoverflow.com/questions/49558465/switch-azurermwebappslot-no-longer-supports-production-slot-name