# App Service Operations Deploy and manage Azure App Service web applications. ## Operations ### AppService.DeployZip Deploy an app service using zip deploy. ```csharp AppService.DeployZip("my-app", "./publish.zip"); AppService.DeployZip("my-app", "./publish.zip", "my-rg", o => o .WithDeploymentSlot("staging")); ``` ### AppService.DeployWithSwap Deploy to a slot then swap to production (zero-downtime). ```csharp AppService.DeployWithSwap("my-app", "./publish.zip"); AppService.DeployWithSwap("my-app", "./publish.zip", "staging", "my-rg"); ``` ### AppService.SwapSlots Swap deployment slots. ```csharp AppService.SwapSlots("my-app", "staging"); AppService.SwapSlots("my-app", "staging", "my-rg", "production"); ``` ### AppService.CreateSlot Create a new deployment slot. ```csharp AppService.CreateSlot("my-app", "staging"); AppService.CreateSlot("my-app", "staging", "my-rg", "production"); ``` ### AppService.DeleteSlot Delete a deployment slot. ```csharp AppService.DeleteSlot("my-app", "staging"); AppService.DeleteSlot("my-app", "staging", "my-rg"); ``` ### AppService.ListSlots List deployment slots for an app service. ```csharp AppService.ListSlots("my-app"); AppService.ListSlots("my-app", "my-rg"); ``` ### AppService.Restart Restart an app service. ```csharp AppService.Restart("my-app"); AppService.Restart("my-app", "my-rg", "staging"); ``` ### AppService.Start Start an app service. ```csharp AppService.Start("my-app"); AppService.Start("my-app", slot: "staging"); ``` ### AppService.Stop Stop an app service. ```csharp AppService.Stop("my-app"); AppService.Stop("my-app", slot: "staging"); ``` ## Example Deploy a web app with zero-downtime using deployment slots. ```csharp // Build and publish the web app var WebApp = Dotnet.Project("./src/WebApp/WebApp.csproj"); Dotnet.Publish(WebApp, o => o .Output(Root / "publish") .WithConfiguration(Configuration.Release)); // Create zip for deployment Artifact.Zip(Root / "publish", Root / "app.zip"); // Deploy to staging slot, then swap to production AppService.DeployWithSwap("my-web-app", Root / "app.zip"); // Or deploy directly to a specific slot AppService.DeployZip("my-web-app", Root / "app.zip", "my-rg", o => o .WithDeploymentSlot("staging")); ``` ## Options Reference ### AppService.DeployZip Options | Option | Description | |--------|-------------| | `WithDeploymentSlot(string)` | Deploy to a specific slot instead of production. Common slots: "staging", "dev", "canary". Slots have their own URLs and can be swapped with production. | | `WithNoWait()` | Don't wait for deployment to complete. Returns immediately after starting the deployment. Use when you don't need to verify deployment success in the build. | | `WithRestart()` | Restart the app after deployment. Forces the app to pick up new code immediately instead of waiting for the next scheduled restart. |