ContainerAppExtensions Methods
ConfigureCustomDomain(ContainerApp, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>) Section titled ConfigureCustomDomain(ContainerApp, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>) extension public static class ContainerAppExtensions{ public static void ConfigureCustomDomain( this ContainerApp app, IResourceBuilder<ParameterResource> customDomain, IResourceBuilder<ParameterResource> certificateName) { // ... }}Parameters
app ContainerApp The container app resource to configure for custom domain usage. customDomain IResourceBuilder<ParameterResource> A resource builder for a parameter resource capturing the name of the custom domain. certificateName IResourceBuilder<ParameterResource> A resource builder for a parameter resource capturing the name of the certificate configured in the Azure Portal. Exceptions
ArgumentException Throws if the container app resource is not parented to a Azure.AzureResourceInfrastructure. Remarks
The ContainerAppExtensions.ConfigureCustomDomain extension method simplifies the process of assigning a custom domain to a container app resource when it is deployed. It has no impact on local development.
The ContainerAppExtensions.ConfigureCustomDomain method is used in conjunction with the AzureContainerAppContainerExtensions.PublishAsAzureContainerApp callback. Assigning a custom domain to a container app resource is a multi-step process and requires multiple deployments.
The ContainerAppExtensions.ConfigureCustomDomain method takes two arguments which are parameter resource builders. The first is a parameter that represents the custom domain and the second is a parameter that represents the name of the managed certificate provisioned via the Azure Portal
When deploying with custom domains configured for the first time leave the certificateName parameter empty (when prompted by the Azure Developer CLI). Once the application is deployed successfully access to the Azure Portal to bind the custom domain to a managed SSL certificate. Once the certificate is successfully provisioned, subsequent deployments of the application can use this certificate name when the certificateName is prompted.
For deployments triggered locally by the Azure Developer CLI the config.json file in the .azure/{environment name} path can by modified with the certificate name since Azure Developer CLI will not prompt again for the value.
ContainerAppExtensions.ConfigureCustomDomain method via the AzureContainerAppContainerExtensions.PublishAsAzureContainerApp extension method. var builder = DistributedApplication.CreateBuilder();var customDomain = builder.AddParameter( "customDomain"); // Value provided at first deployment.var certificateName = builder.AddParameter( "certificateName"); // Value provided at second and subsequent deployments.builder.AddProject<Projects.InventoryService>("inventory") .PublishAsAzureContainerApp((module, app) => { app.ConfigureCustomDomain(customDomain, certificateName); });PublishAsAzureContainerAppJob(IResourceBuilder<T>, Action<AzureResourceInfrastructure, ContainerAppJob>) Section titled PublishAsAzureContainerAppJob(IResourceBuilder<T>, Action<AzureResourceInfrastructure, ContainerAppJob>) extension IResourceBuilder<T> public static class ContainerAppExtensions{ public static IResourceBuilder<T> PublishAsAzureContainerAppJob<T>( this IResourceBuilder<T> resource, Action<AzureResourceInfrastructure, ContainerAppJob> configure) { // ... }}Parameters
resource IResourceBuilder<T> The compute resource builder. configure Action<AzureResourceInfrastructure, ContainerAppJob> The configuration action for the container app job. Returns
IResourceBuilder<T> The updated compute resource builder. Remarks
builder.AddProject<Projects.Api>.PublishAsAzureContainerAppJob( (infrastructure, job) =>{ // Configure the container app job here job.Configuration.TriggerType = ContainerAppJobTriggerType.Schedule; job .Configuration .ScheduleTriggerConfig .CronExpression = "0 0 * * *"; // every day at midnight});PublishAsAzureContainerAppJob(IResourceBuilder<T>) Section titled PublishAsAzureContainerAppJob(IResourceBuilder<T>) extension IResourceBuilder<T> public static class ContainerAppExtensions{ public static IResourceBuilder<T> PublishAsAzureContainerAppJob<T>( this IResourceBuilder<T> resource) { // ... }}Parameters
resource IResourceBuilder<T> The compute resource builder. Returns
IResourceBuilder<T> The updated compute resource builder. Remarks
builder.AddProject<Projects.ProcessorJob>("processor-job") .PublishAsAzureContainerAppJob(); // Manual trigger (default)PublishAsScheduledAzureContainerAppJob(IResourceBuilder<T>, string, Action<AzureResourceInfrastructure, ContainerAppJob>) Section titled PublishAsScheduledAzureContainerAppJob(IResourceBuilder<T>, string, Action<AzureResourceInfrastructure, ContainerAppJob>) extension IResourceBuilder<T> public static class ContainerAppExtensions{ public static IResourceBuilder<T> PublishAsScheduledAzureContainerAppJob<T>( this IResourceBuilder<T> resource, string cronExpression, Action<AzureResourceInfrastructure, ContainerAppJob>? configure = null) { // ... }}Parameters
resource IResourceBuilder<T> The compute resource builder. cronExpression string The cron expression that defines the schedule for the job. configure Action<AzureResourceInfrastructure, ContainerAppJob> optional The configuration action for the container app job. Returns
IResourceBuilder<T> The updated compute resource builder. Remarks
ContainerAppExtensions.PublishAsAzureContainerAppJob that automatically configures the job with a schedule trigger using the specified cron expression. builder.AddProject<Projects.ProcessorJob>("job") .PublishAsScheduledAzureContainerAppJob( "0 0 * * *"); // Run every day at midnight