Using Operation Results API to check the progress of deployment slots swap operation in App Service
Published Dec 12 2022 11:10 PM 2,582 Views
Microsoft

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}/provi...

 

 

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}/provi...

 

Polling: Swap in accepted/in-progress state:

 

image_2.png

 

Polling: Swap completed:

 

api_swap.png

 

Thanks to @DeependraChaudhary for sharing the approach.

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

Co-Authors
Version history
Last update:
‎Jan 04 2023 07:49 AM
Updated by: