From 3a670602fbc1f3fc31bfe8eeaa7406269fa6eb75 Mon Sep 17 00:00:00 2001 From: David Pine Date: Thu, 9 Jul 2026 06:36:26 -0500 Subject: [PATCH 1/2] Serve Azure Functions host over HTTPS Use Aspire's generated parameter support for the local Functions HTTPS certificate password and keep the experimental certificate API warning suppression scoped to the run-mode certificate configuration. Fixes #752 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../ImageGallery.AppHost/AppHost.cs | 30 ++++++++++++++++++- .../Properties/launchSettings.json | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs b/samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs index 1635d2dda..0f005e128 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs +++ b/samples/aspire-with-azure-functions/ImageGallery.AppHost/AppHost.cs @@ -34,7 +34,35 @@ // Queue Data Contributor role is required to send messages to the queue StorageBuiltInRole.StorageQueueDataContributor) .WithHostStorage(storage) - .WithUrlForEndpoint("http", u => u.DisplayText = "Functions App"); + .WithUrlForEndpoint("https", u => u.DisplayText = "Functions App"); + +if (builder.ExecutionContext.IsRunMode) +{ + // The Functions project's launchSettings.json passes '--useHttps' to the local Azure Functions host. + // Azure Functions Core Tools can't auto-generate a certificate on the .NET build of the tools, so the + // trusted ASP.NET Core developer certificate is exported to a password-protected PFX and handed to + // 'func host start' via its --cert/--password options. + var functionsCertPassword = builder.AddResource( + ParameterResourceBuilderExtensions.CreateGeneratedParameter( + builder, + "functions-cert-password", + secret: true, + parameterDefault: new GenerateParameterDefault())); + + // The developer certificate APIs used below to serve the Azure Functions host over HTTPS are experimental. +#pragma warning disable ASPIRECERTIFICATES001 + functions + .WithHttpsDeveloperCertificate(functionsCertPassword) + .WithHttpsCertificateConfiguration(context => + { + context.Arguments.Add("--cert"); + context.Arguments.Add(context.PfxPath); + context.Arguments.Add("--password"); + context.Arguments.Add(context.Password!); + return Task.CompletedTask; + }); +#pragma warning restore ASPIRECERTIFICATES001 +} builder.AddProject("frontend") .WithReference(queues) diff --git a/samples/aspire-with-azure-functions/ImageGallery.Functions/Properties/launchSettings.json b/samples/aspire-with-azure-functions/ImageGallery.Functions/Properties/launchSettings.json index b3a327183..91bce2786 100644 --- a/samples/aspire-with-azure-functions/ImageGallery.Functions/Properties/launchSettings.json +++ b/samples/aspire-with-azure-functions/ImageGallery.Functions/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "ImageGalleryFunctions": { "commandName": "Project", - "commandLineArgs": "--port 7221", + "commandLineArgs": "--port 7221 --useHttps", "launchBrowser": false } } From 53d8c9555fffe654dad4171128b2ac7f9ed6c463 Mon Sep 17 00:00:00 2001 From: David Pine Date: Thu, 9 Jul 2026 07:26:38 -0500 Subject: [PATCH 2/2] Fix CI audit failures Add explicit Microsoft.OpenApi references where restore resolved a vulnerable transitive version and update file-based AppHost Aspire package directives to 13.4.6 to avoid vulnerable MessagePack transitive dependencies. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../Metrics/ServiceDefaults/ServiceDefaults.csproj | 1 + .../AspireShop.CatalogService.csproj | 1 + .../AspireJavaScript.MinimalApi.csproj | 1 + samples/aspire-with-python/apphost.cs | 8 ++++---- samples/container-build/apphost.cs | 2 +- .../DatabaseContainers.ApiService.csproj | 1 + samples/image-gallery/api/api.csproj | 1 + samples/image-gallery/apphost.cs | 11 +++++------ samples/vite-csharp-postgres/api/Api.csproj | 1 + 9 files changed, 16 insertions(+), 11 deletions(-) diff --git a/samples/Metrics/ServiceDefaults/ServiceDefaults.csproj b/samples/Metrics/ServiceDefaults/ServiceDefaults.csproj index 0942bc69b..7c73b9376 100644 --- a/samples/Metrics/ServiceDefaults/ServiceDefaults.csproj +++ b/samples/Metrics/ServiceDefaults/ServiceDefaults.csproj @@ -9,6 +9,7 @@ + diff --git a/samples/aspire-shop/AspireShop.CatalogService/AspireShop.CatalogService.csproj b/samples/aspire-shop/AspireShop.CatalogService/AspireShop.CatalogService.csproj index 10a96a560..b4017bf44 100644 --- a/samples/aspire-shop/AspireShop.CatalogService/AspireShop.CatalogService.csproj +++ b/samples/aspire-shop/AspireShop.CatalogService/AspireShop.CatalogService.csproj @@ -13,6 +13,7 @@ + diff --git a/samples/aspire-with-javascript/AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj b/samples/aspire-with-javascript/AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj index 09bd33c98..520715408 100644 --- a/samples/aspire-with-javascript/AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj +++ b/samples/aspire-with-javascript/AspireJavaScript.MinimalApi/AspireJavaScript.MinimalApi.csproj @@ -9,6 +9,7 @@ + diff --git a/samples/aspire-with-python/apphost.cs b/samples/aspire-with-python/apphost.cs index fe88381fe..507dfbb42 100644 --- a/samples/aspire-with-python/apphost.cs +++ b/samples/aspire-with-python/apphost.cs @@ -1,7 +1,7 @@ -#:sdk Aspire.AppHost.Sdk@13.4.0 -#:package Aspire.Hosting.JavaScript@13.4.0 -#:package Aspire.Hosting.Python@13.4.0 -#:package Aspire.Hosting.Redis@13.4.0 +#:sdk Aspire.AppHost.Sdk@13.4.6 +#:package Aspire.Hosting.JavaScript@13.4.6 +#:package Aspire.Hosting.Python@13.4.6 +#:package Aspire.Hosting.Redis@13.4.6 var builder = DistributedApplication.CreateBuilder(args); diff --git a/samples/container-build/apphost.cs b/samples/container-build/apphost.cs index 5df3987d8..e28dcadb0 100644 --- a/samples/container-build/apphost.cs +++ b/samples/container-build/apphost.cs @@ -1,4 +1,4 @@ -#:sdk Aspire.AppHost.Sdk@13.4.0 +#:sdk Aspire.AppHost.Sdk@13.4.6 using Microsoft.Extensions.Hosting; diff --git a/samples/database-containers/DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj b/samples/database-containers/DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj index df5d557df..2aec7197f 100644 --- a/samples/database-containers/DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj +++ b/samples/database-containers/DatabaseContainers.ApiService/DatabaseContainers.ApiService.csproj @@ -17,6 +17,7 @@ + diff --git a/samples/image-gallery/api/api.csproj b/samples/image-gallery/api/api.csproj index 5b3df8db8..e59ffbeb9 100644 --- a/samples/image-gallery/api/api.csproj +++ b/samples/image-gallery/api/api.csproj @@ -22,6 +22,7 @@ + diff --git a/samples/image-gallery/apphost.cs b/samples/image-gallery/apphost.cs index e52d032d0..5167e83d6 100644 --- a/samples/image-gallery/apphost.cs +++ b/samples/image-gallery/apphost.cs @@ -1,11 +1,11 @@ #pragma warning disable ASPIRECSHARPAPPS001 #pragma warning disable ASPIREAZURE002 -#:sdk Aspire.AppHost.Sdk@13.4.0 -#:package Aspire.Hosting.Azure.Storage@13.4.0 -#:package Aspire.Hosting.Azure.Sql@13.4.0 -#:package Aspire.Hosting.JavaScript@13.4.0 -#:package Aspire.Hosting.Azure.AppContainers@13.4.0 +#:sdk Aspire.AppHost.Sdk@13.4.6 +#:package Aspire.Hosting.Azure.Storage@13.4.6 +#:package Aspire.Hosting.Azure.Sql@13.4.6 +#:package Aspire.Hosting.JavaScript@13.4.6 +#:package Aspire.Hosting.Azure.AppContainers@13.4.6 using Aspire.Hosting.Azure; using Azure.Provisioning.AppContainers; @@ -108,4 +108,3 @@ api.PublishWithContainerFiles(frontend, "wwwroot"); builder.Build().Run(); - diff --git a/samples/vite-csharp-postgres/api/Api.csproj b/samples/vite-csharp-postgres/api/Api.csproj index cb9011adc..a7de1313e 100644 --- a/samples/vite-csharp-postgres/api/Api.csproj +++ b/samples/vite-csharp-postgres/api/Api.csproj @@ -16,6 +16,7 @@ +