microsoft / microsoft/aspire

WithAdminDeploymentScriptStorage causes Azure SQL deployment script provisioning to fail

Open
#17,418 1 comment 0 reactions 0 assignees View on GitHub
area-deployment 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

Using WithAdminDeploymentScriptStorage(...) with AddAzureSqlServer(...) results in a deployment failure during the SQL role-assignment provisioning step.

The custom storage account is picked up for the deployment-script flow, but the publish/deploy step fails with a preflight validation error instead of successfully provisioning.

Looking at the bicep file for the deploymentScript after running aspire publish, I see that only storageAccountSettings.storageAccountName is set, but not the storageAccountKey - I think this could be the issue.

### Expected Behavior

Using WithAdminDeploymentScriptStorage(...) should allow the Azure SQL deployment-script flow to succeed when deploying/publishing an Aspire app.

### Steps To Reproduce

Repro at https://github.com/stiglyt/aspire-sql-deploymentscript-repro

### Exceptions (if any)

Failed to provision apiservice-roles-sql: Deployment failed: Error code = DeploymentPreflightValidationFailed, Message = Access key was not
specified for storage account 'xxx'. Make sure to use the correct storage account access key. Please refer to https://aka.ms/DeploymentScriptsTroubleshoot for more
deployment script information.

### Aspire doctor output

Aspire Environment Check
========================

.NET SDK
✅ .NET 10.0.300 installed (x64)

Container Runtime
✅ Docker v29.4.3: running (auto-detected (default)) ← active

Environment
✅ HTTPS development certificate is trusted

Summary: 3 passed, 0 warnings, 0 failed

### Anything else?

- .NET SDK: 10.0.300
- AppHost SDK: Aspire.AppHost.Sdk 13.3.5
- Relevant packages: - Aspire.Hosting.Azure.AppContainers 13.3.5
- Aspire.Hosting.Azure.Sql 13.3.5
- Aspire.Hosting.Azure.Storage 13.3.5
- OS: Windows
- The failure happens in the Azure SQL role-assignment deployment-script step after configuring a custom storage account with WithAdminDeploymentScriptStorage(...).

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.