Using Operation Results API to check the progress of deployment slots swap operation in App Service

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

Currently there is no standard REST API to monitor swap operation, apart from using the activity logs. 

 

Web Apps - Swap Slot Slot - REST API (Azure App Service) | Microsoft Docs

 

However, we have recently found the following way to monitor the Swap operation and the same API is being used by Azure portal as well to update the Swap status and it's comparatively fast. Please refer to the steps below:

 

  1. First call the POST Slot-Swap API & it will trigger the swap operation as shown below:

https://management.azure.com/subscriptions/{SubscriptionID}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap?api-version=2022-03-01

 

 

image_1.png

 

2. The above API will have location parameter in Response Headers with Operation Results API call which can be used to continuously poll in a loop until the Response is 200 (Swap completed) or (failure status code in case of swap failure)

 

GET: https://management.azure.com/subscriptions/{SubscriptionID}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/operationresults/915677b6-ea92-44c9-865b-95cfc693d5bb?api-version=2018-11-01

 

Polling: Swap in accepted/in-progress state:

 

image_2.png

 

Polling: Swap completed:

 

api_swap.png

 

Thanks to  for sharing the approach.

If you have any questions or feedback, please add a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.