Blog Post

Apps on Azure Blog
1 MIN READ

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

Shubham_Anand's avatar
Shubham_Anand
Icon for Microsoft rankMicrosoft
Dec 13, 2022

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

 

 

 

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:

 

 

Polling: Swap completed:

 

 

Thanks to DeependraChaudhary for sharing the approach.

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

Updated Jan 04, 2023
Version 2.0
No CommentsBe the first to comment