Skip to content
Docs Try Aspire

AzureAppConfigurationExtensions Methods

Class Methods 6 members
Provides extension methods for adding the Azure AppConfiguration resources to the application model.
AddAzureAppConfiguration(IDistributedApplicationBuilder, string) Section titled AddAzureAppConfiguration(IDistributedApplicationBuilder, string) extension IResourceBuilder<AzureAppConfigurationResource>
Adds an Azure App Configuration resource to the application model.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<AzureAppConfigurationResource> AddAzureAppConfiguration(
this IDistributedApplicationBuilder builder,
string name)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder.
name string The name of the resource. This name will be used as the connection string name when referenced in a dependency.
IResourceBuilder<AzureAppConfigurationResource> A reference to the ApplicationModel.IResourceBuilder`1.
By default references to the Azure App Configuration resource will be assigned the following roles: - AppConfigurationBuiltInRole.AppConfigurationDataOwner These can be replaced by calling AzureAppConfigurationExtensions.WithRoleAssignments.
RunAsEmulator(IResourceBuilder<AzureAppConfigurationResource>, Action<IResourceBuilder<AzureAppConfigurationEmulatorResource>>) Section titled RunAsEmulator(IResourceBuilder<AzureAppConfigurationResource>, Action<IResourceBuilder<AzureAppConfigurationEmulatorResource>>) extension IResourceBuilder<AzureAppConfigurationResource>
Configures an Azure App Configuration resource to be emulated. This resource requires an AzureAppConfigurationResource to be added to the application model.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<AzureAppConfigurationResource> RunAsEmulator(
this IResourceBuilder<AzureAppConfigurationResource> builder,
Action<IResourceBuilder<AzureAppConfigurationEmulatorResource>>? configureEmulator = null)
{
// ...
}
}
builder IResourceBuilder<AzureAppConfigurationResource> The Azure App Configuration resource builder.
configureEmulator Action<IResourceBuilder<AzureAppConfigurationEmulatorResource>> optional Callback that exposes underlying container used for emulation to allow for customization.
IResourceBuilder<AzureAppConfigurationResource> A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the / container image.
WithDataBindMount(IResourceBuilder<AzureAppConfigurationEmulatorResource>, string?) Section titled WithDataBindMount(IResourceBuilder<AzureAppConfigurationEmulatorResource>, string?) extension IResourceBuilder<AzureAppConfigurationEmulatorResource>
Adds a bind mount for the storage of an Azure App Configuration emulator resource.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<AzureAppConfigurationEmulatorResource> WithDataBindMount(
this IResourceBuilder<AzureAppConfigurationEmulatorResource> builder,
string? path = null)
{
// ...
}
}
builder IResourceBuilder<AzureAppConfigurationEmulatorResource> The builder for the AzureAppConfigurationEmulatorResource.
path string? optional Relative path to the AppHost where emulator storage is persisted between runs. Defaults to the path '.aace'
IResourceBuilder<AzureAppConfigurationEmulatorResource> A builder for the AzureAppConfigurationEmulatorResource.
WithDataVolume(IResourceBuilder<AzureAppConfigurationEmulatorResource>, string?) Section titled WithDataVolume(IResourceBuilder<AzureAppConfigurationEmulatorResource>, string?) extension IResourceBuilder<AzureAppConfigurationEmulatorResource>
Adds a named volume for the data folder to an Azure App Configuration emulator resource.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<AzureAppConfigurationEmulatorResource> WithDataVolume(
this IResourceBuilder<AzureAppConfigurationEmulatorResource> builder,
string? name = null)
{
// ...
}
}
builder IResourceBuilder<AzureAppConfigurationEmulatorResource> The builder for the AzureAppConfigurationEmulatorResource.
name string? optional The name of the volume. Defaults to an auto-generated name based on the application and resource names.
IResourceBuilder<AzureAppConfigurationEmulatorResource> A builder for the AzureAppConfigurationEmulatorResource.
WithHostPort(IResourceBuilder<AzureAppConfigurationEmulatorResource>, int?) Section titled WithHostPort(IResourceBuilder<AzureAppConfigurationEmulatorResource>, int?) extension IResourceBuilder<AzureAppConfigurationEmulatorResource>
Configures the host port for the Azure App Configuration emulator is exposed on instead of using randomly assigned port.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<AzureAppConfigurationEmulatorResource> WithHostPort(
this IResourceBuilder<AzureAppConfigurationEmulatorResource> builder,
int? port)
{
// ...
}
}
builder IResourceBuilder<AzureAppConfigurationEmulatorResource> Builder for the Azure App Configuration emulator container
port int? The port to bind on the host. If null is used, a random port will be assigned.
IResourceBuilder<AzureAppConfigurationEmulatorResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithRoleAssignments(IResourceBuilder<T>, IResourceBuilder<AzureAppConfigurationResource>, AppConfigurationBuiltInRole[]) Section titled WithRoleAssignments(IResourceBuilder<T>, IResourceBuilder<AzureAppConfigurationResource>, AppConfigurationBuiltInRole[]) extension IResourceBuilder<T>
Assigns the specified roles to the given resource, granting it the necessary permissions on the target Azure App Configuration resource. This replaces the default role assignments for the resource.
public static class AzureAppConfigurationExtensions
{
public static IResourceBuilder<T> WithRoleAssignments<T>(
this IResourceBuilder<T> builder,
IResourceBuilder<AzureAppConfigurationResource> target,
params AppConfigurationBuiltInRole[] roles)
{
// ...
}
}
builder IResourceBuilder<T> The resource to which the specified roles will be assigned.
target IResourceBuilder<AzureAppConfigurationResource> The target Azure App Configuration resource.
roles AppConfigurationBuiltInRole[] The built-in App Configuration roles to be assigned.
IResourceBuilder<T> The updated ApplicationModel.IResourceBuilder`1 with the applied role assignments.
Assigns the AppConfigurationDataReader role to the 'Projects.Api' project.
var builder = DistributedApplication.CreateBuilder(args);
var appStore = builder.AddAzureAppConfiguration("appStore");
var api = builder.AddProject<Projects.Api>("api")
.WithRoleAssignments(
appStore,
AppConfigurationBuiltInRole.AppConfigurationDataReader)
.WithReference(appStore);