microsoft / microsoft/aspire

Random provision error

Open
#12,250 0 comments 0 reactions 0 assignees View on GitHub
area-deployment
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 deploying with `aspire deploy`, I encounter this error frequently in a random order, it sometimes goes through and sometimes fails, without changing anything:
```
✗ FAILED: Deploying labeling-worker-roles-amj-storage 00:00:00
Failed to provision labeling-worker-roles-amj-storage: Deployment failed: No output for principalId
```
sometimes it just takes running the command 2 times for it to pass, sometimes I do `aspire publish` then it works.
so my guess it's not related to my machine rather to azure deployment process (maybe wait for something to get updated?) maybe it's a race condition where the identity was not yet created?

so it could be an issue for `az/azd` rather than aspire, but I'm not very familiar with this toolset so...

### Expected Behavior

To create the role successfully

### Steps To Reproduce

my aspire setup:

```csharp
var storage = builder
.AddAzureStorage("amj-storage")
.ConfigureInfrastructure(infra =>
{
var storageAccount = infra.GetProvisionableResources()
.OfType()
.Single();

storageAccount.AccessTier = StorageAccountAccessTier.Hot;
storageAccount.Sku = new StorageSku { Name = StorageSkuName.StandardLrs };
})
.RunAsEmulator(azurite => { azurite.WithDataVolume(); });

var pdfStorage = storage
.AddBlobContainer("pdf-storage");

...
var labelingWorker =
builder.AddProject("labeling-worker")
.PublishAsDockerFile(container =>
container
.WithDockerfile("../", "Modules/Labeling/Labeling.Worker/Dockerfile")
)
.WaitAndReference(pdfStorage)
...
```

`WaitAndReference` is an extension that just combines waitfor and withreference.

I have not modified the generated bicep, but here they are anyway:

```bicep
module labeling_worker_identity 'labeling-worker-identity/labeling-worker-identity.bicep' = {
name: 'labeling-worker-identity'
scope: rg
params: {
location: location
}
}

module labeling_worker_roles_amj_storage 'labeling-worker-roles-amj-storage/labeling-worker-roles-amj-storage.bicep' = {
name: 'labeling-worker-roles-amj-storage'
scope: rg
params: {
location: location
amj_storage_outputs_name: amj_storage.outputs.name
principalId: labeling_worker_identity.outputs.principalId
}
}
```

### Exceptions (if any)

_No response_

### .NET Version info

.NET SDK:
Version: 9.0.305
Commit: 3fc74f3529
Workload version: 9.0.300-manifests.6fcb754b
MSBuild version: 17.14.21+8929ca9e3

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.305\

### Anything else?

```
aspire --version
9.5.1+286943594f648310ad076e3dbfc11f4bcc8a3d83

azd version
azd version 1.19.0 (commit b3d68cea969b2bfbaa7b7fa289424428edb93e97)
```

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.