Operations
| Operation | Description |
|---|---|
AppService.DeployZip | Deploy an app service using zip deploy. |
AppService.DeployFolder | Zip a published folder (contents at the archive root) and deploy it with zip deploy. Use when you have a publish directory rather than a pre-built zip. |
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
source
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.DeployFolder
source
Zip a published folder (contents at the archive root) and deploy it with zip deploy. Use when you have a publish directory rather than a pre-built zip.
AppService.DeployFolder("my-app", "dist/api");
AppService.DeployFolder("my-app", "dist/api", "my-rg", o => o
.WithDeploymentSlot("release"));AppService.DeployWithSwap
source
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
source
Swap deployment slots.
AppService.SwapSlots("my-app", "staging");
AppService.SwapSlots("my-app", "staging", "my-rg", "production");AppService.CreateSlot
source
Create a new deployment slot.
AppService.CreateSlot("my-app", "staging");
AppService.CreateSlot("my-app", "staging", "my-rg", "production");AppService.DeleteSlot
source
Delete a deployment slot.
AppService.DeleteSlot("my-app", "staging");
AppService.DeleteSlot("my-app", "staging", "my-rg");AppService.ListSlots
source
List deployment slots for an app service.
AppService.ListSlots("my-app");
AppService.ListSlots("my-app", "my-rg");AppService.Restart
source
Restart an app service.
AppService.Restart("my-app");
AppService.Restart("my-app", "my-rg", "staging");AppService.Start
source
Start an app service.
AppService.Start("my-app");
AppService.Start("my-app", slot: "staging");AppService.Stop
source
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 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"));
// Or skip the manual zip and deploy the publish folder directly
// (contents are placed at the archive root, as config-zip expects)
AppService.DeployFolder("my-web-app", Root / "publish", "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. |
WithTimeout(TimeSpan) | Maximum time to wait for the zip deploy command before reconciling and retrying. Must be greater than zero. Default 20 minutes. |
Resilient zip deploy
AppService.DeployZip (and the operations built on it) tolerate the flaky
behaviour Azure App Service sometimes exhibits during large uploads:
- Timeout reconciliation. If the
az webapp deploycommand times out, ANDO queries the latest Kudu deployment status. When Kudu reports the deployment completed successfully after the command timed out, the step is treated as successful instead of failing. - Automatic retries. Transient failures (HTTP 5xx, “Service Unavailable”,
connection resets) are retried with backoff, up to three attempts, as long as
the overall
WithTimeoutbudget has not been exhausted.