Repository navigation
Floci Azure: add WithStorage child resource and fix dev account key - #2223
Conversation
Adds WithStorage(), which models floci-az's Blob, Queue and Table APIs as a FlociAzureStorageResource child alongside WithCosmos and WithServiceBus. The child reports the Floci container's health, so dependents can WaitFor it without redirecting Aspire's AzureStorageResource, whose health checks never initialize when redirected. Storage endpoints use the IPv4 host so the Azure Storage SDKs read the account name from the path. Also corrects DefaultAccountKey to the well-known devstoreaccount1 key; floci-az rejected SharedKey requests signed with the old value. Closes CommunityToolkit#2222
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 2223Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 2223" |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The documented TypeScript export lacks coverage in the existing generated AppHost test, and one credential comment is now inaccurate.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds first-class Floci Azure Storage child-resource support and corrects SharedKey authentication.
Changes:
- Adds exported
WithStorage()and storage connection metadata. - Corrects the development account key.
- Adds unit, functional, and usage documentation coverage.
| File | Description |
|---|---|
WithReferenceTests.cs |
Tests storage references, health, naming, and validation. |
CommunityToolkit.Aspire.Hosting.Floci.Tests.csproj |
Adds the Blob SDK dependency. |
AzureStorageFunctionalTests.cs |
Tests Blob operations and SAS authentication. |
README.md |
Documents C# and TypeScript usage. |
FlociHostingExtension.Azure.cs |
Adds the exported WithStorage() API. |
FlociAzureStorageResource.cs |
Defines the Storage child resource and connection string. |
FlociAzureContainerResource.cs |
Corrects the development account key. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /// <param name="builder">The Floci Azure resource builder.</param> | ||
| /// <param name="name">The name of the Storage resource (default: <c>storage</c>).</param> | ||
| /// <returns>A reference to the <see cref="IResourceBuilder{FlociAzureStorageResource}"/> for further configuration.</returns> | ||
| [AspireExport] |
There was a problem hiding this comment.
Fixed in d8dfaf8. The TypeScript AppHost now calls withStorage({ name: 'storage' }) on the runtime path, reads accountName(), serviceEndpoint() and connectionStringExpression(), and passes the handle to withReference(storage) and waitFor(storage) on floci-api. TypeScriptAppHostCompilesAndStarts passes locally.
afscrome
left a comment
There was a problem hiding this comment.
Sorry, missed the copilot comments. If you could address those, everything else LGTM
…Key comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Closes #2222
Adds
WithStorage(), which models floci-az's Blob, Queue and Table APIs as aFlociAzureStorageResourcechild. It follows the existingWithCosmos()/FlociAzureCosmosResourcepattern: aResourcethat implementsIResourceWithParent<FlociAzureContainerResource>andIResourceWithConnectionString, usesWithParentRelationship, and works with Aspire's standardWithReferenceflow.ResourceHealthCheckServiceapplies ancestor health checks, so the child reports the Floci container's/_floci/healthandWaitFor(storage)works. This removes the reason AppHosts redirectAzureStorageResourceto Floci, which leaves Aspire's blob health check permanentlyUnhealthy("Connection string is not initialized.").BlobEndpoint,QueueEndpointandTableEndpointuseEndpointProperty.IPV4Hostrather thanlocalhost. The Azure Storage SDKs only take the account name from the path for IP hosts, so withlocalhost,BlobServiceClient.AccountNameresolves tolocalhostand SAS generation signs for the wrong account.FlociAzureContainerResource.DefaultAccountKeyended in...GMh0==; the well-known devstoreaccount1 key ends in...GMGw==. floci-az validates SharedKey signatures, so requests signed with the old key failed withAuthenticationFailed. The new functional test failed for this reason before the fix. The fix also correctsAZURE_STORAGE_CONNECTION_STRINGfromWithReference(azure).PR Checklist
Other information
Tests:
WithReferenceTestscovers the child resource and parent relationship, the connection string shape (including the IPv4 host), custom names, argument validation, and that the child inherits the parent's health check rather than adding its own.[RequiresDocker]AzureStorageFunctionalTestsstarts floci-az, waits for the storage child to become healthy, then round-trips a blob withBlobServiceClient. It also checks thatAccountNameisdevstoreaccount1and that a generated SAS URI downloads the blob.CommunityToolkit.Aspire.Hosting.Floci.Testspass. The one failure,TypeScriptAppHostTests.TypeScriptAppHostCompilesAndStarts, also fails on unmodifiedmainon my Windows machine: thefloci-mountbind-mount container never starts. It is unrelated to this change.I did not hand-edit the generated
api/*.csfile, per the repo instructions.The issue has not been triaged yet. I'm opening this PR alongside it so maintainers can see the concrete shape; I'm happy to rework it if a different API is preferred.