Azure.Bicep.RpcClient 0.42.1

Prefix Reserved
dotnet add package Azure.Bicep.RpcClient --version 0.42.1
                    
NuGet\Install-Package Azure.Bicep.RpcClient -Version 0.42.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azure.Bicep.RpcClient" Version="0.42.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Azure.Bicep.RpcClient" Version="0.42.1" />
                    
Directory.Packages.props
<PackageReference Include="Azure.Bicep.RpcClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Azure.Bicep.RpcClient --version 0.42.1
                    
#r "nuget: Azure.Bicep.RpcClient, 0.42.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Azure.Bicep.RpcClient@0.42.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Azure.Bicep.RpcClient&version=0.42.1
                    
Install as a Cake Addin
#tool nuget:?package=Azure.Bicep.RpcClient&version=0.42.1
                    
Install as a Cake Tool

Azure Bicep RPC Client

A .NET library for programmatically interacting with the Bicep CLI via JSON-RPC.

Note: While this package is publicly available on nuget.org, it is not officially supported. Breaking changes may be introduced at any time.

Getting started

Install the package

dotnet add package Azure.Bicep.RpcClient

Initialize the client

The BicepClientFactory handles downloading the Bicep CLI (if needed) and establishing a JSON-RPC connection. By default, binaries are cached under ~/.bicep/bin.

using Bicep.RpcClient;

var factory = new BicepClientFactory();

// Download (or reuse) the latest Bicep CLI and connect
using var bicep = await factory.Initialize(BicepClientConfiguration.Default);

Pin a specific Bicep version

using var bicep = await factory.Initialize(new() {
    BicepVersion = "0.38.5"
});

Use an existing Bicep installation

using var bicep = await factory.Initialize(new() {
    ExistingCliPath = "/usr/local/bin/bicep"
});

Available operations

All methods are async, accept an optional CancellationToken, and communicate with the Bicep CLI over JSON-RPC.

Compile

Compiles a .bicep file into an ARM template JSON string.

var result = await bicep.Compile(new("./main.bicep"));

if (result.Success)
{
    // result.Contents contains the ARM template JSON
    Console.WriteLine(result.Contents);
}

CompileParams

Compiles a .bicepparam file into ARM deployment parameters. You can optionally override parameter values.

var result = await bicep.CompileParams(new(
    "./main.bicepparam",
    new Dictionary<string, JsonNode>()));

if (result.Success)
{
    Console.WriteLine(result.Parameters); // ARM parameters JSON
    Console.WriteLine(result.Template);   // ARM template JSON (if resolvable)
    // result.TemplateSpecId is set when the params file references a template spec
}

Format

Formats a Bicep file according to the standard Bicep formatting rules. Requires Bicep CLI 0.37.1 or later.

var result = await bicep.Format(new("./main.bicep"));

File.WriteAllText("./main.bicep", result.Contents);

GetMetadata

Retrieves parameters, outputs, exports, and file-level metadata from a Bicep file.

var result = await bicep.GetMetadata(new("./main.bicep"));

foreach (var param in result.Parameters)
{
    Console.WriteLine($"param {param.Name}: {param.Type?.Name} — {param.Description}");
}

foreach (var output in result.Outputs)
{
    Console.WriteLine($"output {output.Name}: {output.Type?.Name}");
}

foreach (var export in result.Exports)
{
    Console.WriteLine($"@export() {export.Kind} {export.Name}");
}

foreach (var meta in result.Metadata)
{
    Console.WriteLine($"metadata {meta.Name} = '{meta.Value}'");
}

GetFileReferences

Returns all file paths referenced by a Bicep file — modules, loaded files, and the file itself.

var result = await bicep.GetFileReferences(
    new("./main.bicep"));

foreach (var path in result.FilePaths)
{
    Console.WriteLine(path);
}

GetDeploymentGraph

Returns the resource dependency graph for a Bicep file, useful for visualization.

var result = await bicep.GetDeploymentGraph(
    new("./main.bicep"));

foreach (var node in result.Nodes)
{
    var existing = node.IsExisting ? " (existing)" : "";
    Console.WriteLine($"  {node.Name}: {node.Type}{existing}");
}

foreach (var edge in result.Edges)
{
    Console.WriteLine($"  {edge.Source} -> {edge.Target}");
}

GetSnapshot

Generates a snapshot of a .bicepparam file with Azure deployment context. Requires Bicep CLI 0.36.1 or later.

var result = await bicep.GetSnapshot(new(
    "./main.bicepparam",
    new(
        TenantId: null,
        SubscriptionId: "00000000-0000-0000-0000-000000000000",
        ResourceGroup: "my-rg",
        Location: "eastus",
        DeploymentName: "my-deployment"),
    ExternalInputs: null));

Console.WriteLine(result.Snapshot);

GetVersion

Returns the version of the connected Bicep CLI. The result is cached for subsequent calls.

var version = await bicep.GetVersion();
Console.WriteLine($"Bicep CLI version: {version}");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.42.1 192 4/2/2026
0.41.2 133 2/27/2026
0.40.2 159 1/24/2026
0.39.26 671 11/18/2025
0.38.33 243 10/6/2025
0.38.5 212 10/2/2025