Skip to content

Normalize App Service Application Insights Bicep identifiers - #16539

Merged
Eric Erhardt (eerhardt) merged 4 commits into
mainfrom
copilot/fix-bicep-identifier-for-app-insights
Apr 29, 2026
Merged

Eric Erhardt (eerhardt) merged 4 commits into
mainfrom
copilot/fix-bicep-identifier-for-app-insights

Conversation

Copilot AI commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Azure App Service environment names may contain hyphens, but generated Bicep identifiers may not. Enabling Application Insights for an environment such as env-1 produced invalid identifiers for the generated Log Analytics workspace and Application Insights component.

  • Normalize generated observability resource identifiers:
    • env-1_law → env_1_law
    • env-1_ai → env_1_ai
  • Preserve existing _law / _ai suffixes for non-hyphenated names.
  • Add focused regression coverage for a hyphenated App Service environment with Application Insights enabled.
builder.AddAzureAppServiceEnvironment("env-1")
    .WithAzureApplicationInsights();

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1s1vsblobprodcus386.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false de/node/bin/nodex64 (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false git (dns block)
  • 7k6vsblobprodcus337.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet test --project tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj --no-launch-profile -- --filter-method *.AddAppServiceWithApplicationInsightsDefaultLocation --filter-method *.AddAppServiceWithApplicationInsightsLocation --filter-method *.AddAppServiceWithApplicationInsightsLocationParam --filter-not-trait quarantined=true --filter-not-trait outerloop=true (dns block)
  • c78vsblobprodcus322.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false de/node/bin/nodex64 (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false git (dns block)
  • kxqvsblobprodcus376.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false it (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false de/node/bin/nodex64 (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false git (dns block)
  • pkvvsblobprodcus321.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false it (dns block)
  • u3hvsblobprodcus371.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false it (dns block)
  • v53vsblobprodcus320.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false it (dns block)
  • yluvsblobprodcus367.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false it (dns block)
  • ytvvsblobprodcus310.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false de/node/bin/nodex64 (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/dotnet /home/REDACTED/work/aspire/aspire/.dotnet/sdk/10.0.201/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix invalid Bicep identifier for Application Insights Normalize App Service Application Insights Bicep identifiers Apr 29, 2026
@github-actions

github-actions Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16539

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16539"

@eerhardt
Eric Erhardt (eerhardt) marked this pull request as ready for review April 29, 2026 15:17
Copilot AI review requested due to automatic review settings April 29, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Normalizes generated Bicep symbolic identifiers for App Service Application Insights resources so hyphenated environment names (e.g., env-1) don’t produce invalid Bicep, and adds a regression test.

Changes:

  • Normalize Log Analytics Workspace and Application Insights Bicep identifiers using Infrastructure.NormalizeBicepIdentifier.
  • Add a regression unit test covering a hyphenated App Service environment with Application Insights enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs Adds a regression test asserting normalized Bicep identifiers are emitted for env-1.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentExtensions.cs Normalizes the Bicep symbolic names for the generated LAW and AI resources.

@eerhardt
Eric Erhardt (eerhardt) enabled auto-merge (squash) April 29, 2026 15:36
@eerhardt
Eric Erhardt (eerhardt) merged commit 8e88d7b into main Apr 29, 2026
285 checks passed
@github-actions github-actions Bot added this to the 13.3 milestone Apr 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit 6823410)

View all recordings
Status Test Recording
❔ AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
❔ AddPackageWhileAppHostRunningDetached ▶️ View Recording
❔ AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
❔ AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
❔ AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
❔ AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
❔ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
❔ Banner_DisplayedOnFirstRun ▶️ View Recording
❔ Banner_DisplayedWithExplicitFlag ▶️ View Recording
❔ Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
❔ CertificatesClean_RemovesCertificates ▶️ View Recording
❔ CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
❔ CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
❔ ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
❔ CreateAndRunAspireStarterProject ▶️ View Recording
❔ CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
❔ CreateAndRunEmptyAppHostProject ▶️ View Recording
❔ CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
❔ CreateAndRunJsReactProject ▶️ View Recording
❔ CreateAndRunPythonReactProject ▶️ View Recording
❔ CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
❔ CreateAndRunTypeScriptStarterProject ▶️ View Recording
❔ CreateJavaAppHostWithViteApp ▶️ View Recording
❔ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
❔ DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
❔ DeployK8sBasicApiService ▶️ View Recording
❔ DeployK8sWithGarnet ▶️ View Recording
❔ DeployK8sWithMongoDB ▶️ View Recording
❔ DeployK8sWithMySql ▶️ View Recording
❔ DeployK8sWithPostgres ▶️ View Recording
❔ DeployK8sWithRabbitMQ ▶️ View Recording
❔ DeployK8sWithRedis ▶️ View Recording
❔ DeployK8sWithSqlServer ▶️ View Recording
❔ DeployK8sWithValkey ▶️ View Recording
❔ DeployTypeScriptAppToKubernetes ▶️ View Recording
❔ DescribeCommandResolvesReplicaNames ▶️ View Recording
❔ DescribeCommandShowsRunningResources ▶️ View Recording
❔ DetachFormatJsonProducesValidJson ▶️ View Recording
❔ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View Recording
❔ DoListStepsShowsPipelineSteps ▶️ View Recording
❔ DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View Recording
❔ DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
❔ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ View Recording
❔ DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
❔ DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
❔ GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
❔ GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
❔ GlobalMigration_PreservesAllValueTypes ▶️ View Recording
❔ GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
❔ GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
❔ InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
❔ InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
❔ InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
❔ LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
❔ LogsCommandShowsResourceLogs ▶️ View Recording
❔ OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
❔ PsCommandListsRunningAppHost ▶️ View Recording
❔ PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
❔ PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
❔ PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
❔ PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
❔ RestoreGeneratesSdkFiles ▶️ View Recording
❔ RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
❔ RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
❔ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
❔ RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
❔ SecretCrudOnDotNetAppHost ▶️ View Recording
❔ SecretCrudOnTypeScriptAppHost ▶️ View Recording
❔ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
❔ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
❔ StopAllAppHostsFromAppHostDirectory ▶️ View Recording
❔ StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
❔ StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
❔ StopNonInteractiveSingleAppHost ▶️ View Recording
❔ StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
❔ UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25118321267

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

This is an internal bug fix that normalizes Bicep identifiers for App Service environments with hyphenated names (e.g., env-1 → env_1 prefix in generated Bicep). No public APIs were added or changed, no user-facing configuration options were modified, and no documented behavior was altered. The fix only corrects invalid Bicep identifier generation that would have caused deployment failures for hyphenated environment names.

Generated by PR Documentation Check for issue #16539 · ● 128.8K · ◷

@eerhardt

Copy link
Copy Markdown
Member

/backport to release/13.3

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
…ft#16539)

* Initial plan

* Normalize app service app insights bicep identifiers

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/e848458a-5173-4241-b442-80d01de3d5c2

Co-authored-by: eerhardt <[email protected]>

* Preserve app insights bicep suffix separators

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/e848458a-5173-4241-b442-80d01de3d5c2

Co-authored-by: eerhardt <[email protected]>

* Address PR feedback

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eerhardt <[email protected]>
Co-authored-by: Eric Erhardt <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators May 30, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

5 participants