Jump to content

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


Recommended Posts

Guest shuanand
Posted

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

 

 

 

 

 

largevv2px999.png.b1ca11bb5a10a95eb49a60d68ac0b632.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:

 

 

 

largevv2px999.png.9ce9d37ebec31a44922710100fae34af.png

 

 

 

Polling: Swap completed:

 

 

 

largevv2px999.png.19c5cb93f4acd19a4e6f647c087c6b14.png

 

 

 

Thanks to @DeependraChaudhary for sharing the approach.

 

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

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...