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:
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 insideConnection 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/
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: