microsoft / microsoft/aspire

Allow periods `.` in Foundry deployment names

Open
#17,495 2 comments 0 reactions 0 assignees View on GitHub
area-app-model triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

In Foundry (e.g. Azure OpenAI) it's very common to use the name of the model as the name of the deployment (e.g. `gpt-5.4`). Without this, some libraries (like the GitHub Copilot SDK) would require specifying the model name separately, which is both error-prone and currently not injected by Aspire into the consuming service's process.

(Side note: the currently injected `ModelName` environment variable is also misleading because it's actually the deployment name).

### Expected Behavior

Allow periods in deployment names

### Steps To Reproduce

```
const string OpenAIModel = "gpt-5.4";
var openai = builder.AddAzureOpenAI("openai");
openai.AddDeployment(OpenAIModel, OpenAIModel, "2026-03-05");
```

### Exceptions (if any)

```
Unhandled exception. System.ArgumentException: Resource name 'gpt-5.4' is invalid. Name must contain only ASCII letters, digits, and hyphens. (Parameter 'name')
at Aspire.Hosting.ApplicationModel.ModelName.ValidateName(String target, String name, Nullable`1 maxLength, Boolean validateStartsWithLetter, Boolean validateAllowedCharacters, Boolean
validateNoConsecutiveHyphens, Boolean validateNoTrailingHyphen) in /_/src/Aspire.Hosting/ApplicationModel/ModelName.cs:line 55
at Aspire.Hosting.DistributedApplicationBuilder.ValidateResourceName(IResource resource) in /_/src/Aspire.Hosting/DistributedApplicationBuilder.cs:line 861
at Aspire.Hosting.DistributedApplicationBuilder.AddResource[T](T resource) in /_/src/Aspire.Hosting/DistributedApplicationBuilder.cs:line 780
at Aspire.Hosting.AzureOpenAIExtensions.AddDeployment(IResourceBuilder`1 builder, String name, String modelName, String modelVersion) in
/_/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs:line 196
```

### Aspire doctor output

_No response_

### Anything else?

_No response_

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.