Operations
| Operation | Description |
|---|---|
AppService.DeployZip | Deploy an app service using zip deploy. |
AppService.DeployWithSwap | Deploy to a slot then swap to production (zero-downtime). |
AppService.SwapSlots | Swap deployment slots. |
AppService.CreateSlot | Create a new deployment slot. |
AppService.DeleteSlot | Delete a deployment slot. |
AppService.ListSlots | List deployment slots for an app service. |
AppService.Restart | Restart an app service. |
AppService.Start | Start an app service. |
AppService.Stop | Stop an app service. |
Operation Details
AppService.DeployZip
Deploy an app service using zip deploy.
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).
AppService.DeployWithSwap("my-app", "./publish.zip");
AppService.DeployWithSwap("my-app", "./publish.zip", "staging", "my-rg");AppService.SwapSlots
Swap deployment slots.
AppService.SwapSlots("my-app", "staging");
AppService.SwapSlots("my-app", "staging", "my-rg", "production");AppService.CreateSlot
Create a new deployment slot.
AppService.CreateSlot("my-app", "staging");
AppService.CreateSlot("my-app", "staging", "my-rg", "production");AppService.DeleteSlot
Delete a deployment slot.
AppService.DeleteSlot("my-app", "staging");
AppService.DeleteSlot("my-app", "staging", "my-rg");AppService.ListSlots
List deployment slots for an app service.
AppService.ListSlots("my-app");
AppService.ListSlots("my-app", "my-rg");AppService.Restart
Restart an app service.
AppService.Restart("my-app");
AppService.Restart("my-app", "my-rg", "staging");AppService.Start
Start an app service.
AppService.Start("my-app");
AppService.Start("my-app", slot: "staging");AppService.Stop
Stop an app service.
AppService.Stop("my-app");
AppService.Stop("my-app", slot: "staging");Example
Deploy a web app with zero-downtime using deployment slots.
build.csando
// 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"));