Skip to content

Docs: replace non-Azure AsExisting examples with AddConnectionString - #1076

Merged
David Pine (IEvangelist) merged 5 commits into
mainfrom
ievangelist/dapine-audit-asexisting-docs
Jun 2, 2026
Merged

David Pine (IEvangelist) merged 5 commits into
mainfrom
ievangelist/dapine-audit-asexisting-docs

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented May 26, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR fixes the docs guidance behind #1074 by removing non-Azure AsExisting(...) examples that don't match available APIs.

The updated guidance now models existing external resources with AddConnectionString(...) / addConnectionString(...) instead.

What changed

  • Replaced non-Azure existing-instance snippets that used AsExisting(connectionStringParameter: ...).
  • Added C# and TypeScript examples using AddConnectionString / addConnectionString.
  • Clarified that these values are resolved from AppHost configuration keys such as ConnectionStrings:<name> / ConnectionStrings__<name>.
  • Clarified that this connection-string pattern does not inject typed resource-specific connection-property variables.

Files updated

  • src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx
  • src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx
  • src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx
  • src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx
  • src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx
  • src/frontend/src/content/docs/get-started/glossary.mdx

Fixes #1074

Switch non-Azure existing-instance docs from AsExisting guidance to AddConnectionString modeling in Redis, Garnet, Valkey, RabbitMQ, Elasticsearch, and glossary patterns.\n\nCo-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates Aspire integration docs to stop recommending non-existent/non-exposed AsExisting(...) patterns for non-Azure resources, replacing them with connection-string based modeling to address issue #1074.

Changes:

  • Replace C# AddX(...).AsExisting(...) examples with AddConnectionString(...) across several integration Host docs.
  • Replace TypeScript explanatory text with concrete addConnectionString(...) + withReference(...) examples.
  • Update the glossary “Existing resource pattern” snippet to use AddConnectionString(...).

Reviewed changes

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

Show a summary per file
File Description
src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx Switch existing-Redis example to connection-string resource; adds TS code sample.
src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx Switch existing-Garnet example to connection-string resource; adds TS code sample.
src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx Switch existing-Valkey example to connection-string resource; adds TS code sample.
src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx Switch existing-RabbitMQ example to connection-string resource; adds TS code sample.
src/frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-host.mdx Switch existing-Elasticsearch example to connection-string resource; adds TS code sample.
src/frontend/src/content/docs/get-started/glossary.mdx Update “Existing resource pattern” snippet to use AddConnectionString(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add explicit notes that AddConnectionString/addConnectionString resolve from ConnectionStrings configuration and inject connection-string values, not typed resource connection-property variables.\n\nCo-authored-by: Copilot <[email protected]>
@IEvangelist

Copy link
Copy Markdown
Member Author

Addressed the Copilot review feedback in b51f231:

  • Added clarification in each updated integration page that AddConnectionString / addConnectionString resolves values from ConnectionStrings:<name> (or ConnectionStrings__<name>) in AppHost configuration.
  • Clarified that this pattern injects a connection string value rather than typed resource-specific connection-property variables.
  • Added the same configuration-source note to the glossary AddConnectionString("db") example.

@IEvangelist
David Pine (IEvangelist) enabled auto-merge (squash) May 26, 2026 20:31
@mitchdenny

Copy link
Copy Markdown
Member

I'm wondering whether it might be a more meaningful story if we show using AddGarnet locally and switching to AddConnectionString for deployment? The thing we need to figure out there is the differences in how the strings are handled because we won't deconstruct a connection string into REDIS_HOST and the like.

Call out that ConnectionStrings__{name} is passed through as a single connection string value and is not deconstructed into resource connection-property variables.\n\nCo-authored-by: Copilot <[email protected]>
@IEvangelist

Copy link
Copy Markdown
Member Author

Follow-up update in bfca595:

I strengthened the wording in each affected section to explicitly call out format behavior:

  • ConnectionStrings__{name} / ConnectionStrings:{name} is a single pass-through connection string value.
  • It is not deconstructed into resource connection-property variables.
  • Each page now includes concrete examples of the resource-specific variables that are not emitted in this pattern.

Document when resource connection properties are available and when AddConnectionString/addConnectionString provides only a single ConnectionStrings value that is not deconstructed.\n\nCo-authored-by: Copilot <[email protected]>
@IEvangelist

Copy link
Copy Markdown
Member Author

Expanded scope in 02ec0e7 to the corresponding *-connect pages (Redis, Garnet, Valkey, RabbitMQ, Elasticsearch).

Each now explicitly documents the distinction:

  • connection-property env vars are available when the AppHost models a typed resource.
  • AddConnectionString / addConnectionString provides a single ConnectionStrings value (ConnectionStrings:{name} / ConnectionStrings__{name}), and it is not deconstructed into per-property variables.

…le formats

Adds explicit documentation to connection pages (Redis, RabbitMQ, Garnet, Valkey,
Elasticsearch) explaining the critical difference in how Aspire exposes connection
information:

- WithReference (typed resources): Individual [RESOURCE]_[PROPERTY] environment
  variables (e.g., CACHE_HOST, CACHE_PORT, CACHE_PASSWORD, CACHE_URI)
- AddConnectionString (external strings): Single ConnectionStrings__name value only

This clarifies that connection properties are NOT available when using AddConnectionString
for external resources, and consuming apps must parse the connection string themselves.

Addresses feedback that these format differences were not being called out clearly.
@IEvangelist

Copy link
Copy Markdown
Member Author

Environment Variable Documentation Added

I have pushed an additional commit that clarifies the critical difference in how Aspire exposes connection information when using different patterns. This addresses the feedback about distinguishing between connection property formats.

Key distinction documented:

Using WithReference (typed resources):

  • Individual environment variables are created: [RESOURCE]_[PROPERTY]
  • Examples: CACHE_HOST, CACHE_PORT, CACHE_PASSWORD, CACHE_URI
  • Consuming apps can access specific properties individually

Using AddConnectionString (external connection strings):

  • Single environment variable: ConnectionStrings__resourcename
  • NO individual property variables are created
  • Consuming apps must parse the connection string themselves

Updated pages:

  • Redis connect page
  • RabbitMQ connect page
  • Garnet connect page
  • Valkey connect page
  • Elasticsearch connect page

Each now includes an explicit "Environment variables and connection string formats" section that explains both patterns and when each is available.

@IEvangelist
David Pine (IEvangelist) merged commit c74c0bf into main Jun 2, 2026
9 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the ievangelist/dapine-audit-asexisting-docs branch June 2, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis: Add an existing Redis instance Not Found Method AsExisting

4 participants