microsoft/aspire · error · NotSupportedException

Azure Container App Jobs are not supported with Azure…

Error message

Azure Container App Jobs are not supported with Azure Functions.

What it means

Azure Container App Jobs cannot host Azure Functions. CreateContainerAppJob builds the job resource and throws NotSupportedException if the source resource carries an AzureFunctionsAnnotation, because the job model does not support the Functions hosting integration.

Solutions

  1. Remove the Azure Functions annotation (or the .WithFunctions call) from the resource if it should be a job
  2. Publish the resource as a regular Container App instead of a job if Functions support is required
  3. Split the workload: keep Functions in a container app and move non-Functions work to the job

Example fix

// before
builder.AddProject<Projects.Funcs>("funcs")
    .WithAzureFunctions()
    .PublishAsAzureContainerJob(env, job => { });
// after
builder.AddProject<Projects.Funcs>("funcs")
    .PublishAsAzureContainerApp(env, app => { });
Defensive patterns

Strategy: validation

Validate before calling

if (resource.HasAnnotationOfType<AzureFunctionsAnnotation>() &&
    resource.HasAnnotationOfType<AzureContainerAppJobCustomizationAnnotation>())
{
    throw new InvalidOperationException("Azure Functions resources cannot be published as Container App Jobs.");
}

Try / catch

try { PublishAsJob(resource); }
catch (NotSupportedException ex) when (ex.Message.Contains("Jobs are not supported with Azure Functions")) { /* use a container app instead */ }

Prevention

When it happens

Trigger: A resource annotated with .WithFunctions(...) style AzureFunctionsAnnotation is also published as a Container App Job (PublishAsAzureContainerJob / job customization annotation).

Common situations: Combining Aspire's Azure Functions hosting with a container app job in the same AppHost; migrating a Functions-based project to job publishing without removing the Functions annotation.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/03be87cfb921e157. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Azure.AppContainers/ContainerAppJobContext.cs:102

    }

    private ContainerAppJob CreateContainerAppJob()
    {
        var containerApp = new ContainerAppJob(Infrastructure.NormalizeBicepIdentifier(Resource.Name))
        {
            Name = NormalizedContainerAppName
        };

        var configuration = new ContainerAppJobConfiguration()
        {
            ReplicaTimeout = 1800,
            TriggerType = ContainerAppJobTriggerType.Manual,
        };
        containerApp.Configuration = configuration;

        if (Resource.HasAnnotationOfType<AzureFunctionsAnnotation>())
        {
            throw new NotSupportedException("Azure Container App Jobs are not supported with Azure Functions.");
        }

        return containerApp;
    }
}

View on GitHub (pinned to 25830f84bd)