microsoft / microsoft/aspire

Validate Sql database names that will get converted at deployment

Open
#4,405 3 comments 0 reactions 0 assignees View on GitHub
area-deployment area-integrations azure sqlserver
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

Hi,

using
```c#
var sqlServer = builder
.AddSqlServer("somesqlservername")
.PublishAsAzureSqlDatabase()
;
var sqlDb = sqlServer
.AddDatabase("somedbresourcename", "**DB_NAME_WITH_UNDERSCORE**")

```
will cause an issue.
DB_NAME_WITH_UNDERSCORE will be converted into DBNAMEWITHUNDERSCORE at deployment.
But the generated Db connection string will still reference the original name "DB_NAME_WITH_UNDERSCORE"
This will cause the connection to fail.
I'm sure there are more restrictions regarding names of Azure resources. Length, case, valid characters, uniqness...

I would suggest introducing more non primitive types that validate names according to Azure rules.
see attachment for a proposal
[AspireNames.txt](https://github.com/user-attachments/files/15613872/AspireNames.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.