Not allowing underscores in resource names (`ASPIRE006` warning) conflicts with POSIX environment variable restrictions
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
I just spent 2 to 3 hours debugging and trying to understand why my applications were not able to read configured connection strings in Azure and it turns out it is a combination of POSIX environment variables not allowing the `-` (hyphen) character, and Azure portal silently removing `-` characters from configuration entries inside `Connection Strings`.
After much deliberation and seeing the nasty impacts of using hyphens (kebab-case) for our connection string and service names, I decided to just switch everything to snake_case (underscores) instead.
Then, I hit this limitation in the Aspire AppHost:
https://aspire.dev/diagnostics/aspire006/
> Resource name 'appconfig_common' is invalid. Name must contain only ASCII letters, digits, and hyphens.
- Aspire allows hyphens, prohibits underscores.
- POSIX environment variables prohibit hyphens, allow underscores
- Azure Portal allows configuring a connection string with hyphens, but then strips it out
Now I can't configure my connection string from the outside anymore and I'm forced to change the name to something else.
This all feels completely broken to me.
Can someone on the Aspire team explain why underscores are not allowed in resource names? How am I supposed to reconcile these limitations I just mentioned? If I use hyphen in my connection string resources/databases, then I can't configure them at all.
This feels like a _terrible_ default for Aspire to not only explicitly disallow underscores, but then silently promote the use of hyphens which then create this massive compatibility problem with environment variables and Linux.
Related:
- https://github.com/microsoft/aspire.dev/issues/477
Contributor guide
Research direction
Start with the ASPIRE006 diagnostic page and the AppHost resource-name validation that produces it; compare its allowed characters with POSIX environment-variable and Azure Connection Strings behavior described here. Review the related aspire.dev issue, then define what naming policy or guidance would reconcile these constraints and how completion should be verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, linux
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100