Operations
| Operation | Description |
|---|---|
Bicep.DeployToResourceGroup | Deploy a Bicep template to a resource group. Returns a BicepDeployment with typed access to outputs via deployment.Output("name"). |
Bicep.DeployToSubscription | Deploy a Bicep template at subscription scope. Returns a BicepDeployment with typed access to outputs via deployment.Output("name"). |
Bicep.WhatIf | Preview what would be deployed (what-if analysis). |
Bicep.Build | Compile a Bicep file to ARM JSON template. |
Operation Details
Bicep.DeployToResourceGroup
Deploy a Bicep template to a resource group. Returns a BicepDeployment with typed access to outputs via deployment.Output("name").
var deployment = Bicep.DeployToResourceGroup("my-rg", "./infra/main.bicep");
var deployment = Bicep.DeployToResourceGroup("my-rg", "./main.bicep", o => o
.WithParameterFile("./params.json")
.WithDeploymentSlot("staging"));
Ef.DatabaseUpdate(db, deployment.Output("sqlConnectionString"));Bicep.DeployToSubscription
Deploy a Bicep template at subscription scope. Returns a BicepDeployment with typed access to outputs via deployment.Output("name").
var deployment = Bicep.DeployToSubscription("eastus", "./infra/sub.bicep");
var deployment = Bicep.DeployToSubscription("eastus", "./sub.bicep", o => o
.WithParameter("environment", "prod"));
var resourceGroup = deployment.Output("resourceGroupName");Bicep.WhatIf
Preview what would be deployed (what-if analysis).
Bicep.WhatIf("my-rg", "./infra/main.bicep");
Bicep.WhatIf("my-rg", "./main.bicep", o => o.WithParameterFile("./params.json"));Bicep.Build
Compile a Bicep file to ARM JSON template.
Bicep.Build("./infra/main.bicep");
Bicep.Build("./main.bicep", "./output/main.json");Example
Deploy infrastructure and use outputs in subsequent steps.
build.csando
// Preview changes first
Bicep.WhatIf("my-app-rg", "./infra/main.bicep", o => o
.WithParameterFile("./infra/params.prod.json"));
// Deploy - returns BicepDeployment with typed output access
var deployment = Bicep.DeployToResourceGroup("my-app-rg", "./infra/main.bicep", o => o
.WithParameterFile("./infra/params.prod.json"));
// Pass deployment outputs to other operations
Ef.DatabaseUpdate(DbContext, deployment.Output("sqlConnectionString"));
// Build Bicep to ARM for validation
Bicep.Build("./infra/main.bicep", "./artifacts/main.json");