Conversation
- Pass the IKeyVaultSecretReference to the SecretResolver - Don't add the default keyvault when using the emulator.
… support for CosmosDB and other resources
…t if the Azure resource is emulated or container in run mode.
Member
|
@davidfowl - I think this is ready for review. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the issue where a KeyVault resource is added in scenarios when the resource is either running as a container (for Redis and Postgres) or as an emulator (for CosmosDB). The changes update both test coverage and resource provisioning logic to conditionally remove the KeyVault resource based on the runtime mode and authentication type.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Azure.Tests/AzureRedisExtensionsTests.cs | Added test to verify that KeyVault is not included when running Redis as a container. |
| tests/Aspire.Hosting.Azure.Tests/AzurePostgresExtensionsTests.cs | Added test to verify that KeyVault is not included when running Postgres as a container. |
| tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs | Updated tests to validate KeyVault behavior for CosmosDB in both access key and emulator scenarios. |
| tests/Aspire.Hosting.Azure.Tests/AzureBicepResourceTests.cs | Added tests and updated secret resolver usage to support the new signature. |
| src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs | Modified the secret resolver lambda to use IKeyVaultSecretReference. |
| src/Aspire.Hosting.Azure/IKeyVaultResource.cs | Updated the interface signature for SecretResolver to accept IKeyVaultSecretReference. |
| src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs | Added an event subscription to remove the KeyVault when running in container mode. |
| src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs | Added an analogous event subscription for Postgres to remove the KeyVault when appropriate. |
| src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultSecretReference.cs | Changed the secret resolver invocation to pass the secret reference instead of just the secret name. |
| src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResource.cs | Updated the internal handling of SecretResolver to reflect the new delegate signature. |
| src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBResource.cs | Altered the connection string generation to bypass secret references when running as an emulator. |
| src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs | Updated event subscription to remove the KeyVault resource when the resource is in emulator mode. |
eerhardt
reviewed
Apr 2, 2025
sebastienros
approved these changes
Apr 2, 2025
davidfowl
commented
Apr 2, 2025
Member
|
/backport to release/9.2 |
Contributor
|
Started backporting to release/9.2: https://github.com/dotnet/aspire/actions/runs/14223464886 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Don't add the keyvault if the resource is a container.
Fixes #8364