[New article]: Document existing resource support in Aspire #2549
Labels
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
in-pr
okr-freshness
OKR: Freshness of content
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
📦 release-9.1
Used to track doc updates for release 9.1 of .NET Aspire.
Proposed topic or title
Referencing existing resources in Aspire
Location in table of contents.
/Integrations / Azure / Overview / Add connection to existing Azure resources
Reason for the article
In addition to the pre-existing
AddConnectionString
API, we're adding expanded support for being able to reference existing Azure resources in Aspire that we should document.Article abstract
Below is a Copilot-generated/Safia-enhanced summary of the feature to help with documentation.
Documentation for PublishAsExisting and RunAsExisting APIs
Overview
The
PublishAsExisting
andRunAsExisting
APIs are used to define and manage existing Azure resources within Aspire applications. They allow developers to reference already-deployed Azure resources, configure them, and generate appropriate deployment manifests using Bicep templates.RunAsExisting
Purpose
The
RunAsExisting
method is used when a distributed application is running in "Run" mode. In this mode, it assumes that the referenced Azure resource already exists and integrates with it during execution without provisioning the resource.Example Usage
PublishAsExisting
Purpose
The
PublishAsExisting
method is used in "Publish" mode when the intent is to declare and reference an already-existing Azure resource during publish mode. This API faciliating the creation of manifests and templates that include resource definitions that map to existing resources in Bicep.Example Usage
Generated Manifest Example
Generated Bicep Template Example
AsExisting
Purpose
The
AsExisting
method is used when a distributed application is running in "Run" or "Publish" mode. Because theAsExisting
method can operate in both scenarios, it can only support a parameterized reference to the resource name or resource group name.Example Usage
Use Cases
RunAsExisting
when you need to dynamically interact with an existing resource during runtime without needing to deploy or update it.PublishAsExisting
when declaring existing resources as part of a deployment configuration, ensuring the correct scopes and permissions are applied.PublishAsExisting
when declaring existing resources in both configurations, with a requirement to parameterize the references.Additional Examples
Storage Account Example (with
PublishAsExisting
)Generated Manifest:
Generated Bicep Template:
Some additional notes on the
RunAsExisting
/PublishAsExisting
APIs:ParameterResources
or strings. UsingParameterResource
allows the end-user to configure the target properties dynamically.resourceGroup
argument is optional. When it's not provided, the implementation will use an existing resource defined in the same resoruce group as the deployment.name
argument is always required.Relevant searches
No response
Associated WorkItem - 375712
The text was updated successfully, but these errors were encountered: