We're dealing with what appears to be a memory leak issue, and we're still trying to find the root cause. In the meantime, Azure is auto-healing every time the memory gets high, which is happening about every 13 hours. Every time this happens the site goes down for up to 20 minutes.

Until we find the cause of the memory leak, I want to mitigate this by recycling the app pool at a certain time every day (e.g. 6AM EST) so that we can isolate the auto-healing to after business hours. I'm not sure where to start though - I know that Sitecore Powershell has a Restart-App command, but I'm not sure how to make a Powershell script that will run automatically. Can someone point me to where to get started in making a script to recycle the app pool at a certain time every day?


Instead of using a Powershell script, you can restart an Azure Web App using the Azure API Web Apps Restarts endpoint.

It basically involves calling up the api in this form:

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart?api-version=2019-08-01

You can invoke a request to the API from an external system that has access to it. For example, you can use your CI\CD platform and implement a scheduled job that runs at a certain time every day to invoke the API request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.