Using Azure Activity Log to check the progress of deployment slots swap operation

If you use Azure Web App Deployment Slots then you may have noticed that sometimes the swap action may take a while to complete. This may happen when an application that is being swapped into production has a long warmup/initialization phase. It has to be warmed up on every VM in an App Service Plan and that sometimes takes minutes (more detailed description of what happens during the swap can be found in Most common deployment slot swap failures and how to fix them). This blog post explains how to see the progress and the result of the swap operation in the Azure Activity Log.

To see the swap operation events use the Activity log view in the Azure Portal:

Activity Log

Here is an example of how the swap events look like:

Swap events example

  1. ApplySlotConfig - this is logged when slot settings from production slot have been applied to a webapp in the staging slot
  2. StartSlotWarmup – this is logged when starting to initialize the webapp in the staging slot
  3. EndSlotWarmup – this indicates that the webapp initialization has completed
  4. SlotSwap – this is logged when the webapp from the staging slot has been swapped into production slot.

If there was a failure while swapping the slots then the events will look like below. The event description will have explanation of why the failure occurred.

Failed swap event in activity log

If you use PowerShell then you can get the swap related events by using this command:

Get-AzureRmLog -ResourceGroup slotswaptest -StartTime 2018-03-07 -Caller SlotSwapJobProcessor

This will produce an output as below:

Activity Log in PowerShell

(For more information on how to get Activity Log events via Powershell refer to View activity logs to audit actions on resources)

If you prefer to call the Azure API’s directly (or by using ARMClient tool) then you make a request like below:

ArmClient.exe GET "/<subscription>/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2018-03-07T00:00:00Z' and eventTimestamp le '2018-03-08T23:00:00Z' and resourceGroupName eq 'slotswaptest'"

In the response look for events that have Caller property set to “SlotSwapJobProcessor“.


ruslany on March 8th 2018 in WAWS

PoorFairAverageGoodExcellent (15 votes, average: 4.00 out of 5)

6 Responses to “Using Azure Activity Log to check the progress of deployment slots swap operation”

  1. Gravatar ImageEZ responded on 13 Mar 2018 at 12:48 pm #

    Nice article, but has nothing to do with IIS and yet it’s on the front page news of

  2. Gravatar Imageruslany responded on 19 Apr 2018 at 5:30 pm #

    @EZ, I’ve contacted to modify the RSS rules they use for aggregation. Thanks for letting me know.

  3. Gravatar ImageDuncan Smart responded on 25 Apr 2018 at 7:35 am #

    Not seeing these Activity Log items for slot swaps any more. All we see are “Microsoft.Web/sites/slots/write”

  4. Gravatar Imageruslany responded on 25 Apr 2018 at 5:32 pm #

    Hi Duncan. Thanks for letting me know. Looking into this.

  5. Gravatar Imageruslany responded on 27 Apr 2018 at 9:31 am #

    Found the bug that caused this. It will be fixed within next week. Thanks again for reporting this!

  6. Gravatar ImageDuncan Smart responded on 01 May 2018 at 11:49 am #

    Thanks. Wondering if it fixes the monitoring the swap operation using the technique here – we get the OperationId back from MSDeploy (“Info: Finished publishing with auto-swap enabled: SlotName=production, OperationId=ca4e59c0…”) and use this to ping “/operations/{OperationId}” and get 202 Accepted until the swap is complete and we get 200 OK. This stopped working around the same time (sometimes it works, mostly doesn’t).

Trackback URI | Comments RSS

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

XML Markup: If You want to add XML code to the comment please XML encode it first, otherwise the code will not show up.

Recently Published Articles