`addAzureAppServiceEnvironment` always produces ACR
- 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
When running `aspire publish` my Azure App Service Environment setup is attempting to create another Azure Container Registry, even if one is provided to it already.
### Expected Behavior
`addAzureAppServiceEnvironment` should not attempt to create an additional Azure Container Registry when one is already provided.
### Steps To Reproduce
```typescript
const acr = await builder.addAzureContainerRegistry('application-acr')
.publishAsExisting('playgroundoverviewacr', { resourceGroup: 'application' })
const appservice = await builder.addAzureAppServiceEnvironment('application')
.withAzureContainerRegistry(acr)
.withAcrPullIdentity(key)
.publishAsExisting('application', { resourceGroup: 'application' })
```
1. Add the above code to Typescript file `apphost.mts`
2. Attempt to run `aspire publish`
### Exceptions (if any)
> ❌ Capability Error: Cannot add resource of type 'Aspire.Hosting.Azure.AzureContainerRegistryResource' with name 'application-acr' because resource of
type 'Aspire.Hosting.Azure.AzureContainerRegistryResource' with that name already exists. resource names are case-insensitive.
Code: INTERNAL_ERROR
Capability: Aspire.Hosting.Azure.AppService/addAzureAppServiceEnvironment
❌ An unexpected error occurred: The TypeScript (Node.js) apphost failed.
### Aspire doctor output
```
PS C:\path\to\application> aspire doctor
Aspire Environment Check
========================
Aspire
✅ Aspire CLI version 13.4.6 (channel: stable)
AppHost
✅ AppHost version 13.4.6 (aspire-apphost\apphost.mts)
Container Runtime
⚠️ Docker: installed but not running ← active
Start Docker Desktop
Environment
✅ TypeScript AppHost tooling found (npm, npx).
✅ HTTPS development certificate is trusted
Summary: 4 passed, 1 warnings, 0 failed
For detailed prerequisites: https://aka.ms/aspire-prerequisites
Aspire CLI Installations
========================
╭────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────┬──────────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────┼──────────────┼─────────────┤
│ C:\Users\{redacted}\.aspire\npm\13.4.6\win-x64\bin\aspire.exe │ 13.4.6+87fe259e4fc244c599019a7b1304c85a1488f248 │ stable │ (unknown) │ not on PATH │
│ (current) │ │ │ │ │
│ C:\Users\{redacted}\AppData\Roaming\npm\aspire.CMD │ (not probed) │ (not probed) │ (not probed) │ active │
│ C:\Users\{redacted}\AppData\Local\Microsoft\WinGet\Packages\Mic│ (not probed) │ (not probed) │ (not probed) │ shadowed │
│ rosoft.Aspire_Microsoft.Winget.Source_8wekyb3d8bbwe\aspire.EXE │ │ │ │ │
╰────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────┴──────────────┴──────────────┴─────────────╯
```
### Anything else?
If the names do not collide no error is generated, but this just means it *successfully* creates a bicep for another Azure Container Registry.
Contributor guide
Research direction
Start with the TypeScript AppHost example in apphost.mts and run the reported aspire publish reproduction using addAzureAppServiceEnvironment and withAzureContainerRegistry. Trace why the App Service Environment tries to add an Azure Container Registry despite the provided resource, then confirm that publishing with the existing ACR no longer creates a duplicate or a second registry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100