microsoft/aspire · error · NotSupportedException

Unsupported endpoint property

Error message

Unsupported endpoint property {property}

What it means

GetEndpointValue maps an EndpointProperty to an actual value for a resolved App Service endpoint (host under azurewebsites.net, port 80/443, scheme, target port). When the requested EndpointProperty is not one of the handled members, the discard arm throws this NotSupportedException with the property name.

Solutions

  1. Restrict endpoint property references to supported ones: Host, Port, TargetPort, Scheme, HostAndPort, IPV4Host.
  2. Align Aspire.Hosting and Aspire.Hosting.Azure.AppService package versions.
  3. Compute the value manually instead of via endpoint references (e.g. hardcode the azurewebsites.net host expression).
  4. If a new EndpointProperty is needed, add a mapping arm to GetEndpointValue.

Example fix

// before
var v = websiteContext.GetEndpointValue(mapping, EndpointProperty.IPV4HostFallback); // hypothetical new member
// after
var v = websiteContext.GetEndpointValue(mapping, EndpointProperty.Host); // {host}.azurewebsites.net
Defensive patterns

Strategy: validation

Validate before calling

static bool IsSupportedGetEndpointValueProperty(EndpointProperty p) =>
    p is EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.TargetPort
        or EndpointProperty.Scheme or EndpointProperty.HostAndPort or EndpointProperty.IPV4Host;

Type guard

if (property is not (EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.TargetPort or EndpointProperty.Scheme or EndpointProperty.HostAndPort or EndpointProperty.IPV4Host))
    throw new ArgumentException($"{property} has no App Service endpoint mapping.");

Try / catch

try { var v = ctx.GetEndpointValue(mapping, property); }
catch (NotSupportedException ex) when (ex.Message.StartsWith("Unsupported endpoint property"))
{
    logger.LogWarning("Falling back to Host for {Property}", property);
    var v = ctx.GetEndpointValue(mapping, EndpointProperty.Host);
}

Prevention

When it happens

Trigger: Requesting EndpointProperty values such as IPV4Host or HostAndPort... wait, HostAndPort/IPV4Host are handled — the failing case is any other member (e.g. Host of an unrecognized kind, TlsEnabled, or a new EndpointProperty enum member added in a newer Aspire version that this switch doesn't cover), typically from ProcessValue resolving endpoint-derived environment values.

Common situations: Version skew where a newer Aspire.Hosting adds an EndpointProperty member while the AppService context wasn't updated; custom code requesting endpoint properties that have no App Service representation; endpoint references (e.g. from GetEndpoint("...") expressions) flowing into website environment variables with properties App Service can't express.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs:874

        infra.Add(new AspireSiteNetworkConfig("webappNetworkConfig")
        {
            Parent = webSite,
            SubnetResourceId = webSite.VirtualNetworkSubnetId
        });
    }

    private BicepValue<string> GetEndpointValue(EndpointMapping mapping, EndpointProperty property)
    {
        return property switch
        {
            EndpointProperty.Url => BicepFunction.Interpolate($"{mapping.Scheme}://{mapping.Host}.azurewebsites.net"),
            EndpointProperty.Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
            EndpointProperty.Port => mapping.Port.ToString(CultureInfo.InvariantCulture),
            EndpointProperty.TargetPort => mapping.TargetPort?.ToString(CultureInfo.InvariantCulture) ?? (BicepValue<string>)AllocateParameter(new ContainerPortReference(Resource)),
            EndpointProperty.Scheme => mapping.Scheme,
            EndpointProperty.HostAndPort => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
            EndpointProperty.IPV4Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
            _ => throw new NotSupportedException($"Unsupported endpoint property {property}")
        };
    }

    private BicepValue<string> AllocateKeyVaultSecretUriReference(IAzureKeyVaultSecretReference secretReference)
    {
        var secret = secretReference.AsKeyVaultSecret(Infra);

        // https://learn.microsoft.com/azure/app-service/app-service-key-vault-references?tabs=azure-cli#-understand-source-app-settings-from-key-vault
        return secret.Properties.SecretUri;
    }

    private ProvisioningParameter AllocateParameter(IManifestExpressionProvider parameter, SecretType secretType = SecretType.None)
    {
        return parameter.AsProvisioningParameter(Infra, isSecure: secretType == SecretType.Normal);
    }

    private RoleAssignment AddDashboardPermissionAndSettings(object webSite, ProvisioningParameter acrClientIdParameter, bool isSlot, BicepValue<string>? deploymentSlot = null)
    {

View on GitHub (pinned to 25830f84bd)