Azure.Provisioning
1.3.0
Prefix Reserved
dotnet add package Azure.Provisioning --version 1.3.0
NuGet\Install-Package Azure.Provisioning -Version 1.3.0
<PackageReference Include="Azure.Provisioning" Version="1.3.0" />
<PackageVersion Include="Azure.Provisioning" Version="1.3.0" />
<PackageReference Include="Azure.Provisioning" />
paket add Azure.Provisioning --version 1.3.0
#r "nuget: Azure.Provisioning, 1.3.0"
#:package Azure.Provisioning@1.3.0
#addin nuget:?package=Azure.Provisioning&version=1.3.0
#tool nuget:?package=Azure.Provisioning&version=1.3.0
Azure Provisioning client library for .NET
Azure.Provisioning makes it easy to declaratively specify Azure infrastructure natively in .NET.
Getting started
Install the package
Install the client library for .NET with NuGet:
dotnet add package Azure.Provisioning
Prerequisites
You must have an Azure subscription.
Authenticate the Client
Key concepts
This library allows you to specify your infrastructure in a declarative style using dotnet. You can then use azd to deploy your infrastructure to Azure directly without needing to write or maintain bicep or arm templates.
Examples
Create Basic Infrastructure
This example demonstrates how to create basic Azure infrastructure using the Azure Provisioning framework, including a storage account with blob services and output values.
Infrastructure infra = new();
// Create a storage account and blob resources
StorageAccount storage =
new(nameof(storage), StorageAccount.ResourceVersions.V2023_01_01)
{
Kind = StorageKind.StorageV2,
Sku = new StorageSku { Name = StorageSkuName.StandardLrs },
IsHnsEnabled = true,
AllowBlobPublicAccess = false
};
infra.Add(storage);
blobs = new(nameof(blobs)) { Parent = storage };
infra.Add(blobs);
// Grab the endpoint
endpoint = new ProvisioningOutput("blobs_endpoint", typeof(string)) { Value = storage.PrimaryEndpoints.BlobUri };
infra.Add(endpoint);
Create A Container App Environment
This example shows how to create a complete container application environment with managed identity, container registry, log analytics workspace, and container app environment with the Aspire dashboard.
Infrastructure infra = new();
ProvisioningParameter principalId = new(nameof(principalId), typeof(string)) { Value = "" };
infra.Add(principalId);
ProvisioningParameter tags = new(nameof(tags), typeof(object)) { Value = new BicepDictionary<string>() };
infra.Add(tags);
UserAssignedIdentity mi =
new(nameof(mi))
{
Tags = tags,
};
infra.Add(mi);
ContainerRegistryService acr =
new(nameof(acr))
{
Sku = new ContainerRegistrySku() { Name = ContainerRegistrySkuName.Basic },
Tags = tags,
Identity =
new ManagedServiceIdentity
{
ManagedServiceIdentityType = ManagedServiceIdentityType.SystemAssignedUserAssigned,
UserAssignedIdentities =
{
// TODO: Decide if we want to invest in a less janky way to use expressions as keys
{ BicepFunction.Interpolate($"{mi.Id}").Compile().ToString(), new UserAssignedIdentityDetails() }
}
}
};
infra.Add(acr);
RoleAssignment pullAssignment = acr.CreateRoleAssignment(ContainerRegistryBuiltInRole.AcrPull, mi);
infra.Add(pullAssignment);
OperationalInsightsWorkspace law =
new(nameof(law))
{
Sku = new OperationalInsightsWorkspaceSku() { Name = OperationalInsightsWorkspaceSkuName.PerGB2018 },
Tags = tags,
};
infra.Add(law);
ContainerAppManagedEnvironment cae =
new(nameof(cae))
{
WorkloadProfiles =
{
new ContainerAppWorkloadProfile()
{
Name = "consumption",
WorkloadProfileType = "Consumption"
}
},
AppLogsConfiguration =
new ContainerAppLogsConfiguration()
{
Destination = "log-analytics",
LogAnalyticsConfiguration = new ContainerAppLogAnalyticsConfiguration()
{
CustomerId = law.CustomerId,
SharedKey = law.GetKeys().PrimarySharedKey,
}
},
Tags = tags,
};
infra.Add(cae);
RoleAssignment contribAssignment = cae.CreateRoleAssignment(AppContainersBuiltInRole.Contributor, mi);
infra.Add(contribAssignment);
// Hack in the Aspire Dashboard as a literal since there's no
// management plane library support for dotNetComponents yet
BicepLiteral aspireDashboard =
new(
new ResourceStatement(
"aspireDashboard",
new StringLiteralExpression("Microsoft.App/managedEnvironments/dotNetComponents@2024-02-02-preview"),
new ObjectExpression(
new PropertyExpression("name", "aspire-dashboard"),
new PropertyExpression("parent", new IdentifierExpression(cae.BicepIdentifier)),
new PropertyExpression("properties",
new ObjectExpression(
new PropertyExpression("componentType", new StringLiteralExpression("AspireDashboard")))))));
infra.Add(aspireDashboard);
infra.Add(new ProvisioningOutput("MANAGED_IDENTITY_CLIENT_ID", typeof(string)) { Value = mi.ClientId });
infra.Add(new ProvisioningOutput("MANAGED_IDENTITY_NAME", typeof(string)) { Value = mi.Name });
infra.Add(new ProvisioningOutput("MANAGED_IDENTITY_PRINCIPAL_ID", typeof(string)) { Value = mi.PrincipalId });
infra.Add(new ProvisioningOutput("LOG_ANALYTICS_WORKSPACE_NAME", typeof(string)) { Value = law.Name });
infra.Add(new ProvisioningOutput("LOG_ANALYTICS_WORKSPACE_ID", typeof(string)) { Value = law.Id });
infra.Add(new ProvisioningOutput("AZURE_CONTAINER_REGISTRY_ENDPOINT", typeof(string)) { Value = acr.LoginServer });
infra.Add(new ProvisioningOutput("AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID", typeof(string)) { Value = mi.Id });
infra.Add(new ProvisioningOutput("AZURE_CONTAINER_APPS_ENVIRONMENT_NAME", typeof(string)) { Value = cae.Name });
infra.Add(new ProvisioningOutput("AZURE_CONTAINER_APPS_ENVIRONMENT_ID", typeof(string)) { Value = cae.Id });
infra.Add(new ProvisioningOutput("AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN", typeof(string)) { Value = cae.DefaultDomain });
Create A Resource Group At Subscription Scope
This example demonstrates creating a resource group at the subscription scope, which is useful when you need to manage resource groups themselves as part of your infrastructure.
// Create a new infra group scoped to our subscription and add
// the resource group
Infrastructure infra = new() { TargetScope = DeploymentScope.Subscription };
ResourceGroup rg = new("rg_test", "2024-03-01");
infra.Add(rg);
Troubleshooting
- File an issue via GitHub Issues.
- Check previous questions or ask new ones on Stack Overflow using Azure and .NET tags.
Next steps
Contributing
For details on contributing to this repository, see the contributing guide.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (for example, label, comment). Follow the instructions provided by the bot. You'll only need to do this action once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any other questions or comments.
Product | Versions 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 is compatible. 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. |
-
.NETStandard 2.0
- Azure.Core (>= 1.47.1)
-
net8.0
- Azure.Core (>= 1.47.1)
NuGet packages (49)
Showing the top 5 NuGet packages that depend on Azure.Provisioning:
Package | Downloads |
---|---|
Aspire.Hosting.Azure
Azure resource types for .NET Aspire. |
|
Azure.Provisioning.KeyVault
Azure.Provisioning.KeyVault simplifies declarative resource provisioning in .NET. |
|
Azure.Provisioning.Storage
Azure.Provisioning.Storage simplifies declarative resource provisioning in .NET for Azure Storage. |
|
Aspire.Hosting.Azure.Storage
Azure Storage resource types for .NET Aspire. |
|
Aspire.Hosting.Azure.KeyVault
Azure resource types for .NET Aspire. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Azure.Provisioning:
Repository | Stars |
---|---|
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
|
|
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK.
|
Version | Downloads | Last Updated |
---|---|---|
1.3.0 | 97 | 8/1/2025 |
1.2.1 | 4,869 | 7/14/2025 |
1.2.0 | 3,429 | 7/8/2025 |
1.1.0 | 7,767 | 6/17/2025 |
1.0.1 | 1,174 | 6/4/2025 |
1.0.0 | 855,814 | 10/25/2024 |
1.0.0-beta.1 | 15,584 | 10/5/2024 |
0.3.0 | 195,440 | 5/16/2024 |
0.2.0 | 67,853 | 4/27/2024 |
0.2.0-beta.2 | 260 | 4/9/2024 |
0.2.0-beta.1 | 9,578 | 4/5/2024 |
0.1.0-beta.2 | 9,874 | 3/29/2024 |
0.1.0-beta.1 | 96 | 3/26/2024 |