Azure and Bicep
Run Azure CLI and typed Bicep commands for validation, formatting, builds, modules, and deployment snapshots.
Declare azure in the workspace tool requirements, then run ./do :install to make the az command available:
tools = ["azure"]
Tools.Azure.Bicep provides typed commands for Bicep authoring, modules, deployment snapshots, installation, and upgrades:
using System.Text.Json;
var template = Do.RootDirectory / "infra" / "main.bicep";
await Tools.Azure.Bicep.Lint with { File = template };
var build = await Tools.Azure.Bicep.Build with
{
File = template,
Stdout = true,
};
var armTemplate = build.ReadJson<JsonDocument>();
The supported commands are Build, BuildParams, Lint, Format, GenerateParams, Restore, Publish, Snapshot, Install, and Upgrade. Awaiting them returns ExecResult; use its ReadText() or ReadJson<T>() readers for standard-output content.
Tools.Azure.EnsureAvailable makes Azure CLI available. Tools.Azure.Bicep.Install runs az bicep install for explicit Bicep version or platform control. Other az bicep commands retain Azure CLI's native behavior of acquiring its internally managed Bicep binary when needed.
Entry points
Tools.Azure.EnsureAvailable
Makes the az command available.
public static ToolInstall EnsureAvailable { get; }Property Value
Tools.Azure.Bicep
Tools.Azure.Bicep.Build
Builds a Bicep template.
public static AzureBicepBuild Build { get; }Property Value
Tools.Azure.Bicep.BuildParams
Builds a Bicep parameters file.
public static AzureBicepBuildParams BuildParams { get; }Property Value
Tools.Azure.Bicep.Format
Formats a Bicep template.
public static AzureBicepFormat Format { get; }Property Value
Tools.Azure.Bicep.GenerateParams
Generates parameters for a Bicep template.
public static AzureBicepGenerateParams GenerateParams { get; }Property Value
Tools.Azure.Bicep.Install
Installs the Bicep CLI managed by Azure CLI.
public static AzureBicepInstall Install { get; }Property Value
Tools.Azure.Bicep.Lint
Lints a Bicep template.
public static AzureBicepLint Lint { get; }Property Value
Tools.Azure.Bicep.Publish
Publishes a Bicep module.
public static AzureBicepPublish Publish { get; }Property Value
Tools.Azure.Bicep.Restore
Restores external Bicep modules.
public static AzureBicepRestore Restore { get; }Property Value
Tools.Azure.Bicep.Snapshot
Captures or validates a Bicep deployment snapshot.
public static AzureBicepSnapshot Snapshot { get; }Property Value
Tools.Azure.Bicep.Upgrade
Upgrades the Bicep CLI managed by Azure CLI.
public static AzureBicepUpgrade Upgrade { get; }