{"record":{"id":"086ffbc65330c957","repo":"microsoft/aspire","slug":"app-service-configuration-validation-failed-see-errors-above","errorCode":null,"errorMessage":"App Service configuration validation failed. See errors above.","messagePattern":"App Service configuration validation failed\\. See errors above\\.","errorType":"exception","errorClass":"DistributedApplicationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs","lineNumber":307,"sourceCode":"                // Context not found for this resource - skip\n            }\n        }\n\n        if (errors.Count > 0)\n        {\n            // Report each error through the activity reporter for user-friendly display\n            foreach (var error in errors)\n            {\n                context.ReportingStep.Log(LogLevel.Error, error);\n            }\n\n            await context.ReportingStep.CompleteAsync(\n                \"App Service configuration validation failed\",\n                CompletionState.CompletedWithError,\n                context.CancellationToken).ConfigureAwait(false);\n\n            // Throw to stop the pipeline - the error has already been reported through the activity reporter\n            throw new DistributedApplicationException(\"App Service configuration validation failed. See errors above.\");\n        }\n\n        await context.ReportingStep.CompleteAsync(\n            \"App Service configuration validated\",\n            CompletionState.Completed,\n            context.CancellationToken).ConfigureAwait(false);\n    }\n\n    private static string? ValidateEnvironmentVariableNames(IResource resource, AzureAppServiceWebsiteContext appServiceContext)\n    {\n        if (resource.HasAnnotationOfType<AzureAppServiceIgnoreEnvironmentVariableChecksAnnotation>())\n        {\n            return null;\n        }\n\n        // Azure App Service removes '-' from environment variable names at runtime.\n        // This breaks configuration binding for connection strings that use dashed names.\n        var problematicKeys = appServiceContext.EnvironmentVariables.Keys","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs#L289-L325","documentation":"ValidateAppServiceConfigurationAsync runs a validation step in the publish pipeline that collects App Service configuration errors and reports them through the activity reporter. If any validation errors were found, the step is completed with an error state and a DistributedApplicationException is thrown to halt the pipeline; the actionable details were already printed above this message.","triggerScenarios":"Publishing an AppHost whose App Service resources violate configuration rules — the individual rule failures (reported earlier in the output) trigger this aggregate throw from the validation step, invoked via validateStep.","commonSituations":"Invalid or conflicting App Service settings (missing environment, bad registry, slot issues) during publish-mode runs; CI publish runs failing after per-resource validation messages appear in logs.","solutions":["Read the errors printed above this message in the publish output — they identify the exact failing resources and rules.","Fix each reported App Service configuration issue (environment, registry, slots, customizations).","Re-run publish and confirm the 'App Service configuration validated' success step completes.","If errors are unclear, run with more verbose output to capture the per-error reporter entries."],"exampleFix":"// before (workflow)\n// hit 'App Service configuration validation failed' and stop without reading details\n// after (workflow)\n// 1. read the reported validation errors above the throw\n// 2. fix e.g. missing AddAzureAppServiceEnvironment / registry\n// 3. re-run publish","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await PublishAsync(); } catch (DistributedApplicationException ex) when (ex.Message.StartsWith(\"App Service configuration validation failed\")) { // per-resource errors were already reported above; surface the full publish log to the user }","preventionTips":["Always read the reported validation entries above this aggregate error before changing config.","Run publish locally before CI to catch App Service config violations early.","Keep App Service environment, registry, and slot configuration consistent across profiles."],"tags":["azure","appservice","validation","publish"],"backgroundTag":"schema-validation-failed","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}