# AzureAppServiceComputeResourceExtensions Methods

- Package: [Aspire.Hosting.Azure.AppService](/reference/api/csharp/aspire.hosting.azure.appservice.md)
- Type: [AzureAppServiceComputeResourceExtensions](/reference/api/csharp/aspire.hosting.azure.appservice/azureappservicecomputeresourceextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for publishing compute resources as Azure App Service websites.

## PublishAsAzureAppServiceWebsite(IResourceBuilder<T>, Action<AzureResourceInfrastructure, WebSite>, Action<AzureResourceInfrastructure, WebSiteSlot>)

- Name: `PublishAsAzureAppServiceWebsite(IResourceBuilder<T>, Action<AzureResourceInfrastructure, WebSite>, Action<AzureResourceInfrastructure, WebSiteSlot>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<T>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.AppService/AzureAppServiceComputeResourceExtensions.cs#L40-L63)

Publishes the specified compute resource as an Azure App Service or Azure App Service Slot.

```csharp
public static class AzureAppServiceComputeResourceExtensions
{
    public static IResourceBuilder<T> PublishAsAzureAppServiceWebsite<T>(
        this IResourceBuilder<T> builder,
        Action<AzureResourceInfrastructure, WebSite>? configure = null,
        Action<AzureResourceInfrastructure, WebSiteSlot>? configureSlot = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<T>`)
  The compute resource builder.
- `configure` (`Action<AzureResourceInfrastructure, WebSite>`) `optional`
  The configuration action for the App Service WebSite resource.
- `configureSlot` (`Action<AzureResourceInfrastructure, WebSiteSlot>`) `optional`
  The configuration action for the App Service WebSite Slot resource.

## Returns

`IResourceBuilder<T>` -- The updated compute resource builder.

## Remarks

```csharp
builder.AddProject<Projects.Api>("name").PublishAsAzureAppServiceWebsite((infrastructure, app) =>
{
    // Configure the App Service WebSite resource here
});
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## SkipEnvironmentVariableNameChecks(IResourceBuilder<T>)

- Name: `SkipEnvironmentVariableNameChecks(IResourceBuilder<T>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<T>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.AppService/AzureAppServiceComputeResourceExtensions.cs#L83-L96)

Skips validation for environment variable names that Azure App Service may not support.

```csharp
public static class AzureAppServiceComputeResourceExtensions
{
    public static IResourceBuilder<T> SkipEnvironmentVariableNameChecks<T>(
        this IResourceBuilder<T> builder)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<T>`)
  The compute resource builder.

## Returns

`IResourceBuilder<T>` -- The updated compute resource builder.

## Exceptions

- `InvalidOperationException` -- Thrown when the resource is not configured for Azure App Service publishing.

## Remarks

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.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
