Deploy to Azure Web App slot using rest api

Bertrand Pons 36 Reputation points
2023-05-25T13:16:48.26+00:00

In this documentation https://azure.github.io/AppService/2021/03/01/deploying-to-network-secured-sites-2.html, it explains how to deploy to private endpoint-enabled site.

However it does not mention the case when we want to deploy to slot. Is it possible? What to mention in the body of REST Api call to make it work?

Thank you.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Tushar Kumar 3,371 Reputation points MVP
    2023-05-25T13:28:19.9233333+00:00

    You just need to use the URI for your slot and it should work .

    PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy?api-version=2022-03-01

    Check out following docs for refrence : https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-ms-deploy-operation-slot

    Please Accept as Answer if this works for you!


  2. Bertrand Pons 36 Reputation points
    2023-05-26T14:46:40.5833333+00:00

    I actually succeeded into deploying to slot with onedeploy with the following REST API call:

    az rest --method PUT --uri https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP_NAME>/providers/Microsoft.Web/sites/<AZURE_WEB_APP_NAME>/slots/<SLOT_NAME>/extensions/onedeploy?api-version=2022-03-01 --body '{"properties": {"type": "zip", "packageUri": "'"<PACKAGE_URI>"'"}}'


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.