Azure Functions

Deploy and manage Azure Functions apps.

Operations

Operation Description
Functions.DeployZip
Deploy a function app using zip deploy.
Functions.Publish
Publish using Azure Functions Core Tools.
Functions.DeployWithSwap
Deploy to a slot then swap to production (zero-downtime).
Functions.SwapSlots
Swap deployment slots.
Functions.Restart
Restart a function app.
Functions.Start
Start a function app.
Functions.Stop
Stop a function app.

Operation Details

Functions.DeployZip source

Deploy a function app using zip deploy.

Functions.DeployZip("my-func", "./publish.zip");
Functions.DeployZip("my-func", "./publish.zip", "my-rg", o => o
  .WithDeploymentSlot("staging"));

Functions.Publish source

Publish using Azure Functions Core Tools.

Functions.Publish("my-func");
Functions.Publish("my-func", "./src/MyFunc", o => o
  .WithDeploymentSlot("staging")
  .WithConfiguration("Release"));

Functions.DeployWithSwap source

Deploy to a slot then swap to production (zero-downtime).

Functions.DeployWithSwap("my-func", "./publish.zip");
Functions.DeployWithSwap("my-func", "./publish.zip", "staging", "my-rg");

Functions.SwapSlots source

Swap deployment slots.

Functions.SwapSlots("my-func", "staging");
Functions.SwapSlots("my-func", "staging", "my-rg", "production");

Functions.Restart source

Restart a function app.

Functions.Restart("my-func");
Functions.Restart("my-func", "my-rg", "staging");

Functions.Start source

Start a function app.

Functions.Start("my-func");
Functions.Start("my-func", slot: "staging");

Functions.Stop source

Stop a function app.

Functions.Stop("my-func");
Functions.Stop("my-func", slot: "staging");

Example

Deploy a function app with zero-downtime using slot swap.

// Build and publish the function app
var FuncApp = Dotnet.Project("./src/MyFunc/MyFunc.csproj");
Dotnet.Publish(FuncApp, o => o
  .Output(Root / "publish")
  .WithConfiguration(Configuration.Release));

// Create zip for deployment
Artifact.Zip(Root / "publish", Root / "func.zip");

// Deploy with zero-downtime swap
Functions.DeployWithSwap("my-func-app", Root / "func.zip");

Options Reference

Functions.DeployZip / Publish Options

OptionDescription
WithDeploymentSlot(string)Deploy to a specific slot instead of production. Use slots for staging, testing, or blue-green deployments.
WithConfiguration(string)Build configuration when using Publish. Values: “Release” (optimized), “Debug” (with symbols).
WithForceRestart()Force restart the function app after deployment. Ensures new code is loaded immediately without waiting for the runtime to detect changes.
WithNoWait()Don’t wait for deployment to complete. Returns immediately after starting deployment. Useful for long-running deployments in CI.