Skip to content
DocsTry Aspire
DocsTry

AzureAppServiceComputeResourceExtensions Methods

ClassMethods2 members
Provides extension methods for publishing compute resources as Azure App Service websites.
PublishAsAzureAppServiceWebsite(IResourceBuilder<T>, Action<AzureResourceInfrastructure, WebSite>, Action<AzureResourceInfrastructure, WebSiteSlot>)Section titled PublishAsAzureAppServiceWebsite(IResourceBuilder<T>, Action<AzureResourceInfrastructure, WebSite>, Action<AzureResourceInfrastructure, WebSiteSlot>)extensionIResourceBuilder<T>
Publishes the specified compute resource as an Azure App Service or Azure App Service Slot.
public static class AzureAppServiceComputeResourceExtensions
{
public static IResourceBuilder<T> PublishAsAzureAppServiceWebsite<T>(
this IResourceBuilder<T> builder,
Action<AzureResourceInfrastructure, WebSite>? configure = null,
Action<AzureResourceInfrastructure, WebSiteSlot>? configureSlot = null)
{
// ...
}
}
builderIResourceBuilder<T>The compute resource builder.
configureAction<AzureResourceInfrastructure, WebSite>optionalThe configuration action for the App Service WebSite resource.
configureSlotAction<AzureResourceInfrastructure, WebSiteSlot>optionalThe configuration action for the App Service WebSite Slot resource.
IResourceBuilder<T>The updated compute resource builder.
builder.AddProject<Projects.Api>(
"name").PublishAsAzureAppServiceWebsite((infrastructure, app) =>
{
// Configure the App Service WebSite resource here
});
SkipEnvironmentVariableNameChecks(IResourceBuilder<T>)Section titled SkipEnvironmentVariableNameChecks(IResourceBuilder<T>)extensionIResourceBuilder<T>
Skips validation for environment variable names that Azure App Service may not support.
public static class AzureAppServiceComputeResourceExtensions
{
public static IResourceBuilder<T> SkipEnvironmentVariableNameChecks<T>(
this IResourceBuilder<T> builder)
{
// ...
}
}
builderIResourceBuilder<T>The compute resource builder.
IResourceBuilder<T>The updated compute resource builder.
InvalidOperationExceptionThrown when the resource is not configured for Azure App Service publishing.
When running on Azure App Service, environment variable names can't contain hyphens. This can cause Aspire client integrations that rely on the original environment variable names to fail. By default, Aspire performs validation to ensure environment variable names are compatible with Azure App Service, failing to publish if any invalid names are found.