Publish to azure: The endpoint blob is not allocated for the resource storage #5882
-
Is there an existing issue for this?
Describe the bugIssue DescriptionThe project runs and API works as expected when running locally.CodeProgram.cs (host)
Program.cs (api)
Expected BehaviorI expect to be able to deploy my Azure Blob Storage to Azure. Steps To ReproducePublish Azure Container App for .NET AspireThe process fails with an InvalidOperationException indicating that the endpoint blob is not allocated for the resource storage.Exceptions (if any)Details:• Command: azd init The endpoint 'blob' is not allocated for the resource 'storage'.• Stack Trace: .NET Version info[aspire] Anything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Change your code to be this: using Microsoft.Extensions.Hosting;
using Projects;
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage");
var blobs = storage.AddBlobs("blobs");
if (builder.Environment.IsDevelopment())
{
storage.RunAsEmulator(c => c.WithImageTag("3.31.0"));
}
builder.AddProject<BlobStorage_Api>("blobstorageapi").WithReference(blobs);
builder.Build().Run(); |
Beta Was this translation helpful? Give feedback.
-
It worked! Thank you |
Beta Was this translation helpful? Give feedback.
Change your code to be this: