Skip to content
DocsTry Aspire
DocsTry

AzureAppConfigurationExtensions Methods

ClassMethods6 members
Provides extension methods for adding the Azure AppConfiguration resources to the application model.
AddAzureAppConfiguration(IDistributedApplicationBuilder, string)Section titled AddAzureAppConfiguration(IDistributedApplicationBuilder, string)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe 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>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<AzureAppConfigurationResource>The Azure App Configuration resource builder.
configureEmulatorAction<IResourceBuilder<AzureAppConfigurationEmulatorResource>>optionalCallback 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<AzureAppConfigurationEmulatorResource>The builder for the AzureAppConfigurationEmulatorResource.
pathstring?optionalRelative 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<AzureAppConfigurationEmulatorResource>The builder for the AzureAppConfigurationEmulatorResource.
namestring?optionalThe 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<AzureAppConfigurationEmulatorResource>Builder for the Azure App Configuration emulator container
portint?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[])extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<T>The resource to which the specified roles will be assigned.
targetIResourceBuilder<AzureAppConfigurationResource>The target Azure App Configuration resource.
rolesAppConfigurationBuiltInRole[]The built-in App Configuration roles to be assigned.
IResourceBuilder<T>The updated ApplicationModel.IResourceBuilder`1 with the applied role assignments.
This overload is not available in polyglot app hosts. Use AzureAppConfigurationExtensions.WithRoleAssignments instead. 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);