Essentially, you need to stop - expand - restart.
You have many opportunities to do this, but the easiest way:
1- Extension: Azure App Services - start and stop you can try the extension "Azure App Services - start and stop" https://marketplace.visualstudio.com/items?itemName=rbengtsson.appservices-start-stop
2- AzureCLI task From build or deployment windows, complete the Add am Azure CLI task (currently in Preview)
Add one before the deployment task with the Inline script:
azure webapp stop
Add another task after deployment with Inline script:
azure webapp start
I hope that help.

source share