0
votes

Following this link on how to swap slots, with the following script:

$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;

I get this output, with the key part being Property id 'production' at path 'targetSlot' is invalid:

VERBOSE: Performing the operation "Invoking the 'slotsswap' action on the resource." on target "/subscriptions/xxxxxxxx-7649-4a3e-bc8b-xxxxxxxxxxxx/providers/Microsoft.Web/sites/testsite312345345/slots/staging". Invoke-AzureRmResourceAction : The pipeline has been stopped. + Invoke-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Invoke-AzureRmResourceAction], PipelineStoppedException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet

Invoke-AzureRmResourceAction : LinkedInvalidPropertyId : Property id 'production' at path 'targetSlot' is invalid. Expect either resource name e.g. 'myResource' or qualified resource name e.g. 'myParent/myResource'.

  • Invoke-AzureRmResourceAction -ResourceType "Microsoft.Web/sites/slots ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : CloseError: (:) [Invoke-AzureRmResourceAction], ErrorResponseMessageException
    • FullyQualifiedErrorId : LinkedInvalidPropertyId,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet

I have tried numerous formats for the $TargetSlot production value but nothing seems to work.

1

1 Answers

1
votes

You forgot to pass the Resource Group Name: -ResourceGroupName MyRg

Wasn't that obvious from the error message? I know, I know, it's bad... ;)