Azure Functions Operations

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

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

Publish using Azure Functions Core Tools.

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

Functions.DeployWithSwap

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

Swap deployment slots.

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

Functions.Restart

Restart a function app.

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

Functions.Start

Start a function app.

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

Functions.Stop

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.csando
// 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");