Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static IResourceBuilder<AzureAppServiceEnvironmentResource> AddAzureAppSe
else
{
// Create Log Analytics workspace
var logAnalyticsWorkspace = new OperationalInsightsWorkspace(prefix + "_law")
var logAnalyticsWorkspace = new OperationalInsightsWorkspace(Infrastructure.NormalizeBicepIdentifier($"{prefix}_law"))
Comment thread
eerhardt marked this conversation as resolved.
Outdated
Comment thread
eerhardt marked this conversation as resolved.
Outdated
{
Sku = new OperationalInsightsWorkspaceSku()
{
Expand All @@ -217,7 +217,7 @@ public static IResourceBuilder<AzureAppServiceEnvironmentResource> AddAzureAppSe
infra.Add(logAnalyticsWorkspace);

// Create Application Insights resource linked to the Log Analytics workspace
applicationInsights = new ApplicationInsightsComponent(prefix + "_ai")
applicationInsights = new ApplicationInsightsComponent(Infrastructure.NormalizeBicepIdentifier($"{prefix}_ai"))
Comment thread
eerhardt marked this conversation as resolved.
Outdated
Comment thread
eerhardt marked this conversation as resolved.
Outdated
{
ApplicationType = ApplicationInsightsApplicationType.Web,
Kind = "web",
Expand Down
21 changes: 21 additions & 0 deletions tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,27 @@ await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep");
}

[Fact]
public async Task AddAppServiceWithApplicationInsightsNormalizesBicepIdentifiers()
{
var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish);

builder.AddAzureAppServiceEnvironment("env-1").WithAzureApplicationInsights();

using var app = builder.Build();

await ExecuteBeforeStartHooksAsync(app, default);

var model = app.Services.GetRequiredService<DistributedApplicationModel>();

var environment = Assert.Single(model.Resources.OfType<AzureAppServiceEnvironmentResource>());

var (_, bicep) = await GetManifestWithBicep(environment);

Assert.Contains("resource env_1_law ", bicep);
Comment thread
eerhardt marked this conversation as resolved.
Outdated
Assert.Contains("resource env_1_ai ", bicep);
Comment thread
eerhardt marked this conversation as resolved.
Outdated
}

[Fact]
public async Task AddAppServiceWithApplicationInsightsLocationParam()
{
Expand Down
Loading