feat: add azure.provisioning extension (C# CDK importer)#7463
Draft
m-nash wants to merge 1 commit intoAzure:ext-importer-supportfrom
Draft
feat: add azure.provisioning extension (C# CDK importer)#7463m-nash wants to merge 1 commit intoAzure:ext-importer-supportfrom
m-nash wants to merge 1 commit intoAzure:ext-importer-supportfrom
Conversation
Add an azd extension that enables defining Azure infrastructure in C# using Azure.Provisioning. The extension implements the importer-provider capability to compile C# to Bicep, which azd's Bicep provider then deploys. Supports: - .NET 10 single-file apps (infra.cs with #:package directives) - Traditional .csproj multi-file projects - Options forwarding from azure.yaml to C# program args - Preview, provision, and destroy via Bicep delegation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an azd extension (
azure.provisioning) that enables defining Azure infrastructure in C# using Azure.Provisioning instead of Bicep. Built on the newimporter-providercapability from #7452.The extension compiles C# to Bicep as an intermediate step — azd's built-in Bicep provider handles deployment, preview, state tracking, and destroy. Zero changes to azd core.
How it works
The user writes
infra/infra.cs(or a.csprojproject) using Azure.Provisioning, then runsazd upas normal. The extension:.csfile or.csprojproject)dotnet runto compile C# to BicepTesting
All scenarios verified E2E against live Azure:
.csfile provision.csprojproject provisionazd provision --previewazd downazd init --templateazure.yamlSample repo: m-nash/todo-csharp-cosmos-sql-dotnet — full todo app with Cosmos DB, App Service, Key Vault, App Insights, all defined in a single
infra.csfile.Gaps to consider
1. Auto-detection —
infra.importerconfig is requiredToday, azd auto-detects
.bicep→ Bicep and.tf→ Terraform without anyinfra:config inazure.yaml. The same should work for C# — a user should be able to drop aninfra.csinto theinfra/folder and runazd upwithout any yaml changes.Currently this requires the explicit
infra.importerblock because the auto-detection path does not consult extension importers. Ideally, when no provider is detected from built-in file checks, azd would ask each installed extension importer if it can handle the current infra directory, and let the extension decide based on whatever criteria makes sense (file types, markers, etc.). This keeps azd core language-agnostic while letting extensions opt in to auto-detection.2. CLI argument passthrough
The extension forwards
infra.importer.optionsfromazure.yamlas--key valueargs to the C# program. This works for static configuration but there is no way to pass runtime arguments from the CLI (e.g.azd provision -- --region westus3).We would strongly encourage azd to support CLI arg passthrough to importer extensions. Code-based CDK programs are written in full programming languages — C#, TypeScript, Java, Python — and developers will naturally use command-line arguments to parameterize their infrastructure. If a standalone
dotnet run infra.cs -- --region westus3(ornpx ts-node infra.ts -- --region westus3) works but the same program requires manual wiring throughazure.yamloptions when run via azd, that friction becomes a real adoption blocker. Users should not have to restructure their code to work with azd.