# Azure Functions Operations Deploy and manage Azure Functions apps. ## Operations ### Functions.DeployZip Deploy a function app using zip deploy. ```csharp 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. ```csharp 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). ```csharp Functions.DeployWithSwap("my-func", "./publish.zip"); Functions.DeployWithSwap("my-func", "./publish.zip", "staging", "my-rg"); ``` ### Functions.SwapSlots Swap deployment slots. ```csharp Functions.SwapSlots("my-func", "staging"); Functions.SwapSlots("my-func", "staging", "my-rg", "production"); ``` ### Functions.Restart Restart a function app. ```csharp Functions.Restart("my-func"); Functions.Restart("my-func", "my-rg", "staging"); ``` ### Functions.Start Start a function app. ```csharp Functions.Start("my-func"); Functions.Start("my-func", slot: "staging"); ``` ### Functions.Stop Stop a function app. ```csharp Functions.Stop("my-func"); Functions.Stop("my-func", slot: "staging"); ``` ## Example Deploy a function app with zero-downtime using slot swap. ```csharp // 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 | Option | Description | |--------|-------------| | `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. |