Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 11, 2025

When using AddTableService() on Azure Storage, the generated Bicep was missing the required name property, resulting in invalid Bicep that fails validation.

Problem:

var storage = builder.AddAzureStorage("storage");
var table = storage.AddTableService();

Generated invalid Bicep:

resource storage_tables 'Microsoft.Storage/storageAccounts/tableServices@2024-01-01' = {
  parent: storage
  // Missing required 'name' property
}

Root cause:
The AzureTableStorageResource.ToProvisioningEntity() method creates a TableService instance but doesn't set the Name property. Unlike BlobService and QueueService which correctly generate name: 'default', TableService was missing this required property.

Solution:
Reverted to previous behavior where we don't add a testServices resource to the bicep since we don't have table children (yet).

To fix this for real we need Azure/azure-sdk-for-net#51210

Fixes #10328.

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Generated Bicep for TableService is missing required 'name' property Fix missing 'name' property in TableService Bicep generation Jul 11, 2025
Copilot finished work on behalf of eerhardt July 11, 2025 15:44
@Copilot Copilot AI requested a review from eerhardt July 11, 2025 15:44
This doesn't work because of Azure/azure-sdk-for-net#51210. Reverting back to the 9.3 behavior of not creating the bicep resource at all, which is fine for now since we don't have child table resources yet.
@eerhardt
Copy link
Member

@copilot - can you fix the tests by following the Snapshot Testing with Verify instructions to run dotnet verify accept -y

@eerhardt
Copy link
Member

@copilot - fix the tests by following the "Snapshot Testing with Verify" instructions at https://github.com/dotnet/aspire/blob/main/.github/copilot-instructions.md#snapshot-testing-with-verify. Use dotnet verify accept -y to accept all pending snapshot changes after running tests. Don't try to change the product code at all. It is how I want it. I just want you to update the test snapshot files.

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 11, 2025

@copilot - fix the tests by following the "Snapshot Testing with Verify" instructions at https://github.com/dotnet/aspire/blob/main/.github/copilot-instructions.md#snapshot-testing-with-verify. Use `d...

Fixed by updating test snapshot files with dotnet verify accept -y as requested. All Azure Storage tests (38/38) now pass. The snapshots were updated to reflect the removal of TableService from Bicep generation, which is the correct behavior after the recent changes. Commit: d2308bd

Copilot finished work on behalf of eerhardt July 11, 2025 17:15
@eerhardt eerhardt marked this pull request as ready for review July 11, 2025 21:47
@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 21:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to fix the missing name property in the generated TableService Bicep by removing the previous provisioning implementation and related TableStorageResource references. It also updates test snapshots to no longer expect a table service resource in Bicep output.

  • Removed the ToProvisioningEntity method and its import in AzureTableStorageResource
  • Dropped the TableStorageResource property and provisioning block in AzureStorageExtensions
  • Updated snapshots by removing table service resource entries

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting.Azure.Storage/AzureTableStorageResource.cs Removed ToProvisioningEntity method and unused import
src/Aspire.Hosting.Azure.Storage/AzureStorageResource.cs Removed TableStorageResource property
src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs Removed provisioning logic for table services and TableStorageResource assignment
tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureStorageExtensionsTests.*.verified.bicep Removed expected table service resource entries in snapshots
Comments suppressed due to low confidence (3)

src/Aspire.Hosting.Azure.Storage/AzureTableStorageResource.cs:42

  • Removing the ToProvisioningEntity method prevents generating the TableService resource altogether. Restore this method and ensure it sets the Name property to "default" on the provisioning entity.
    }

src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs:465

  • Removing the assignment of TableStorageResource prevents downstream provisioning from detecting the table service. Restore this line so the table resource is registered for provisioning.
        var resource = new AzureTableStorageResource(name, builder.Resource);

@eerhardt
Copy link
Member

/backport to release/9.4

Copy link
Contributor

Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16231014033

@davidfowl davidfowl merged commit 059b8ff into main Jul 12, 2025
276 checks passed
@davidfowl davidfowl deleted the copilot/fix-10328 branch July 12, 2025 07:30
eerhardt added a commit to ArcturusZhang/aspire that referenced this pull request Jul 18, 2025
github-actions bot pushed a commit that referenced this pull request Jul 18, 2025
davidfowl pushed a commit that referenced this pull request Jul 19, 2025
* update azure.provisioning.storage to 1.1.2

* Revert "Fix missing 'name' property in TableService Bicep generation (#10334)"

This reverts commit 059b8ff.

* Fix tests for latest updates.

---------

Co-authored-by: Arcturus Zhang <dapzhang@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
eerhardt added a commit that referenced this pull request Jul 19, 2025
* update azure.provisioning.storage to 1.1.2

* Revert "Fix missing 'name' property in TableService Bicep generation (#10334)"

This reverts commit 059b8ff.

* Fix tests for latest updates.

---------

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Aug 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated Bicep for TableService is missing required 'name' property
3 participants