From 3bb21a1af3309430f718ba1e059487e1978f1b28 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 12:18:44 +0100 Subject: [PATCH 01/13] De-emphasized connection strings in the Azure AI Search article --- .../azureai-search-document-integration.md | 74 ++++++------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/docs/azureai/azureai-search-document-integration.md b/docs/azureai/azureai-search-document-integration.md index bc19486018..a8f95cf1ec 100644 --- a/docs/azureai/azureai-search-document-integration.md +++ b/docs/azureai/azureai-search-document-integration.md @@ -31,6 +31,30 @@ dotnet add package Aspire.Hosting.Azure.Search For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies). +### Connect to an existing Azure AI Search service + +You might have an existing Azure AI Search service that you want to connect to. You can chain a call to annotate that your is an existing resource: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var existingSearchName = builder.AddParameter("existingSearchName"); +var existingSearchResourceGroup = builder.AddParameter("existingSearchResourceGroup"); + +var search = builder.AddAzureSearch("search") + .AsExisting(existingSearchName, existingSearchResourceGroup); + +builder.AddProject() + .WithReference(search); + +// After adding all resources, run the app... +``` + +For more information on treating Azure AI Search resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). + +> [!NOTE] +> Alternatively, instead of representing an Azure AI Search resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). + ### Add an Azure AI Search resource To add an to your app host project, call the method providing a name: @@ -82,56 +106,6 @@ The preceding code: There are many more configuration options available to customize the Azure AI Search resource. For more information, see [`Azure.Provisioning` customization](../azure/integrations-overview.md#azureprovisioning-customization). -### Connect to an existing Azure AI Search service - -You might have an existing Azure AI Search service that you want to connect to. You can chain a call to annotate that your is an existing resource: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var existingSearchName = builder.AddParameter("existingSearchName"); -var existingSearchResourceGroup = builder.AddParameter("existingSearchResourceGroup"); - -var search = builder.AddAzureSearch("search") - .AsExisting(existingSearchName, existingSearchResourceGroup); - -builder.AddProject() - .WithReference(search); - -// After adding all resources, run the app... -``` - -For more information on treating Azure AI Search resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). - -Alternatively, instead of representing an Azure AI Search resource, you can add a connection string to the app host. Which is a weakly-typed approach that's based solely on a `string` value. To add a connection to an existing Azure AI Search service, call the method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var search = builder.ExecutionContext.IsPublishMode - ? builder.AddAzureSearch("search") - : builder.AddConnectionString("search"); - -builder.AddProject() - .WithReference(search); - -// After adding all resources, run the app... -``` - -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under User Secrets, under the `ConnectionStrings` section: - -```json -{ - "ConnectionStrings": { - "search": "https://{account_name}.search.azure.com/" - } -} -``` - -For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). - ### Hosting integration health checks The Azure AI Search hosting integration doesn't currently implement any health checks. This limitation is subject to change in future releases. As always, feel free to [open an issue](https://github.com/dotnet/aspire/issues) if you have any suggestions or feedback. From 07be6fd00f3f800b5691ec424d5759475f0c7e95 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 14:24:28 +0100 Subject: [PATCH 02/13] De-emphasized connection strings in the Azure OpenAI article --- docs/azureai/azureai-openai-integration.md | 30 ++-------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/docs/azureai/azureai-openai-integration.md b/docs/azureai/azureai-openai-integration.md index a34f698ece..1d736b7141 100644 --- a/docs/azureai/azureai-openai-integration.md +++ b/docs/azureai/azureai-openai-integration.md @@ -125,34 +125,8 @@ builder.AddProject() For more information on treating Azure OpenAI resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -Alternatively, instead of representing an Azure OpenAI resource, you can add a connection string to the app host. Which is a weakly-typed approach that's based solely on a `string` value. To add a connection to an existing Azure OpenAI service, call the method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var openai = builder.ExecutionContext.IsPublishMode - ? builder.AddAzureOpenAI("openai") - : builder.AddConnectionString("openai"); - -builder.AddProject() - .WithReference(openai); - -// After adding all resources, run the app... -``` - -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under User Secrets, under the `ConnectionStrings` section: - -```json -{ - "ConnectionStrings": { - "openai": "https://{account_name}.openai.azure.com/" - } -} -``` - -For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). +> [!NOTE] +> Alternatively, instead of representing an Azure OpenAI resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ## Client integration From b3f0468aee58de37a175247dd3cfeddef91ba652 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 14:32:53 +0100 Subject: [PATCH 03/13] De-emphasized connection strings in the Azure SignalR article --- docs/real-time/azure-signalr-scenario.md | 28 ++---------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/docs/real-time/azure-signalr-scenario.md b/docs/real-time/azure-signalr-scenario.md index 144c867ae9..188cc7e5ae 100644 --- a/docs/real-time/azure-signalr-scenario.md +++ b/docs/real-time/azure-signalr-scenario.md @@ -114,32 +114,8 @@ builder.AddProject() For more information on treating Azure SignalR resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -Alternatively, instead of representing an Azure SignalR resource, you can add a connection string to the app host. Which is a weakly-typed approach that's based solely on a `string` value. To add a connection to an existing Azure SignalR Service, call the method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var signalr = builder.ExecutionContext.IsPublishMode - ? builder.AddAzureSignalR("signalr") - : builder.AddConnectionString("signalr"); - -builder.AddProject("apiService") - .WithReference(signalr); -``` - -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section: - -```json -{ - "ConnectionStrings": { - "signalr": "Endpoint=https://your-signalr-instance.service.signalr.net;AccessKey=your-access-key;Version=1.0;" - } -} -``` - -For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). +> [!NOTE] +> Alternatively, instead of representing an Azure SignalR Service resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Add an Azure SignalR Service emulator resource From ddfae74588ddc188d20da0b56a6910ff22b7d22c Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 14:39:47 +0100 Subject: [PATCH 04/13] De-emphasized connection strings in the Azure Web PubSub article. --- .../messaging/azure-web-pubsub-integration.md | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/docs/messaging/azure-web-pubsub-integration.md b/docs/messaging/azure-web-pubsub-integration.md index 6864e9366d..bf29949ba2 100644 --- a/docs/messaging/azure-web-pubsub-integration.md +++ b/docs/messaging/azure-web-pubsub-integration.md @@ -145,34 +145,8 @@ builder.AddProject() For more information on treating Azure Web PubSub resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -Alternatively, instead of representing an Azure Web PubSub resource, you can add a connection string to the app host. Which is a weakly-typed approach that's based solely on a `string` value. To add a connection to an existing Azure Web PubSub service, call the method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var webPubSub = builder.ExecutionContext.IsPublishMode - ? builder.AddAzureWebPubSub("web-pubsub") - : builder.AddConnectionString("web-pubsub"); - -builder.AddProject() - .WithReference(webPubSub); - -// After adding all resources, run the app... -``` - -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under User Secrets, under the `ConnectionStrings` section: - -```json -{ - "ConnectionStrings": { - "web-pubsub": "https://{account_name}.webpubsub.azure.com" - } -} -``` - -For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). +> [!NOTE] +> Alternatively, instead of representing an Azure AI Search resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ## Client integration From d33ac9beefcd738361f9db79859d5247cf084853 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 15:03:34 +0100 Subject: [PATCH 05/13] De-emphasized connection strings in the Azure Cache for Redis article. --- docs/caching/includes/azure-redis-app-host.md | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/docs/caching/includes/azure-redis-app-host.md b/docs/caching/includes/azure-redis-app-host.md index 980293ba97..939f2a250a 100644 --- a/docs/caching/includes/azure-redis-app-host.md +++ b/docs/caching/includes/azure-redis-app-host.md @@ -75,32 +75,27 @@ There are many more configuration options available to customize the Azure Cache ### Connect to an existing Azure Cache for Redis -You might have an existing Azure Cache for Redis that you want to connect to. Instead of representing a new Azure Cache for Redis resource, you can add a connection string to the app host. To add a connection to an existing Azure Cache for Redis, call the method: +You might have an existing Azure Cache for Redis resource that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var cache = builder.AddConnectionString("azure-redis"); +var existingRedisName = builder.AddParameter("existingRedisName"); +var existingRedisResourceGroup = builder.AddParameter("existingRedisResourceGroup"); -builder.AddProject("web") +var cache = builder.AddAzureRedis("azcache") + .AsExisting(existingRedisName, existingRedisResourceGroup); + +builder.AddProject() .WithReference(cache); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "azure-redis": ".redis.cache.windows.net:6380,ssl=true,abortConnect=False" - } -} -``` +For more information on treating Azure Cache for Redis resources as existing resources, see [Use existing Azure resources](../../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"azure-redis"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Cache for Redis resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Run Azure Cache for Redis resource as a container From 12e11b892165a698ba818c9e9f8ce9bfe6e87152 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Wed, 11 Jun 2025 17:24:11 +0100 Subject: [PATCH 06/13] De-emphasized connection strings in the Azure Cosmos DB article. --- docs/database/includes/cosmos-app-host.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/database/includes/cosmos-app-host.md b/docs/database/includes/cosmos-app-host.md index 73ae9dd568..12cadff99c 100644 --- a/docs/database/includes/cosmos-app-host.md +++ b/docs/database/includes/cosmos-app-host.md @@ -76,12 +76,16 @@ There are many more configuration options available to customize the Azure Cosmo ### Connect to an existing Azure Cosmos DB account -You might have an existing Azure Cosmos DB account that you want to connect to. Instead of representing a new Azure Cosmos DB resource, you can add a connection string to the app host. To add a connection to an existing Azure Cosmos DB account, call the method: +You might have an existing Azure Cosmos DB account that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var cosmos = builder.AddConnectionString("cosmos-db"); +var existingCosmosName = builder.AddParameter("existingCosmosName"); +var existingCosmosResourceGroup = builder.AddParameter("existingCosmosResourceGroup"); + +var cosmos = builder.AddAzureCosmosDB("cosmos-db") + .AsExisting(existingCosmosName, existingCosmosResourceGroup); builder.AddProject("web") .WithReference(cosmos); @@ -89,19 +93,10 @@ builder.AddProject("web") // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "cosmos-db": "AccountEndpoint=https://{account_name}.documents.azure.com:443/;AccountKey={account_key};" - } -} -``` +For more information on treating Azure Cosmos DB resources as existing resources, see [Use existing Azure resources](../../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"cosmos-db"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Cosmos DB resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Add Azure Cosmos DB database and container resources From 88faa7a0f9a5128f578eca2876e40e3e9cb4adca Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 12:35:31 +0100 Subject: [PATCH 07/13] De-emphasized connection strings in the Azure Event Hubs article. --- .../azureai-search-document-integration.md | 48 +++++++++---------- .../messaging/azure-event-hubs-integration.md | 25 ++++------ 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/docs/azureai/azureai-search-document-integration.md b/docs/azureai/azureai-search-document-integration.md index a8f95cf1ec..e85dc856c4 100644 --- a/docs/azureai/azureai-search-document-integration.md +++ b/docs/azureai/azureai-search-document-integration.md @@ -31,30 +31,6 @@ dotnet add package Aspire.Hosting.Azure.Search For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies). -### Connect to an existing Azure AI Search service - -You might have an existing Azure AI Search service that you want to connect to. You can chain a call to annotate that your is an existing resource: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var existingSearchName = builder.AddParameter("existingSearchName"); -var existingSearchResourceGroup = builder.AddParameter("existingSearchResourceGroup"); - -var search = builder.AddAzureSearch("search") - .AsExisting(existingSearchName, existingSearchResourceGroup); - -builder.AddProject() - .WithReference(search); - -// After adding all resources, run the app... -``` - -For more information on treating Azure AI Search resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). - -> [!NOTE] -> Alternatively, instead of representing an Azure AI Search resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). - ### Add an Azure AI Search resource To add an to your app host project, call the method providing a name: @@ -106,6 +82,30 @@ The preceding code: There are many more configuration options available to customize the Azure AI Search resource. For more information, see [`Azure.Provisioning` customization](../azure/integrations-overview.md#azureprovisioning-customization). +### Connect to an existing Azure AI Search service + +You might have an existing Azure AI Search service that you want to connect to. You can chain a call to annotate that your is an existing resource: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var existingSearchName = builder.AddParameter("existingSearchName"); +var existingSearchResourceGroup = builder.AddParameter("existingSearchResourceGroup"); + +var search = builder.AddAzureSearch("search") + .AsExisting(existingSearchName, existingSearchResourceGroup); + +builder.AddProject() + .WithReference(search); + +// After adding all resources, run the app... +``` + +For more information on treating Azure AI Search resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). + +> [!NOTE] +> Alternatively, instead of representing an Azure AI Search resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). + ### Hosting integration health checks The Azure AI Search hosting integration doesn't currently implement any health checks. This limitation is subject to change in future releases. As always, feel free to [open an issue](https://github.com/dotnet/aspire/issues) if you have any suggestions or feedback. diff --git a/docs/messaging/azure-event-hubs-integration.md b/docs/messaging/azure-event-hubs-integration.md index 6265c24862..0de97b2531 100644 --- a/docs/messaging/azure-event-hubs-integration.md +++ b/docs/messaging/azure-event-hubs-integration.md @@ -91,32 +91,27 @@ There are many more configuration options available to customize the Event Hubs ### Connect to an existing Azure Event Hubs namespace -You might have an existing Azure Event Hubs namespace that you want to connect to. Instead of representing a new Azure Event Hubs resource, you can add a connection string to the app host. To add a connection to an existing Azure Event Hubs namespace, call the method: +You might have an existing Azure Event Hubs service that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var eventHubs = builder.AddConnectionString("event-hubs"); +var existingEventHubsName = builder.AddParameter("existingEventHubsName"); +var existingEventHubsResourceGroup = builder.AddParameter("existingEventHubsResourceGroup"); -builder.AddProject("web") +var eventHubs = builder.AddAzureEventHubs("event-hubs") + .AsExisting(existingEventHubsName, existingEventHubsResourceGroup); + +builder.AddProject() .WithReference(eventHubs); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "event-hubs": "{your_namespace}.servicebus.windows.net" - } -} -``` +For more information on treating Azure Event Hubs resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"event-hubs"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Event Hubs resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Add Event Hub consumer group From 13ea52d8497e2a9a90fb29cb954fe11e6961f950 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 14:46:06 +0100 Subject: [PATCH 08/13] De-emphasized connection strings in the Azure Key Vault article. --- .../azure-security-key-vault-integration.md | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/docs/security/azure-security-key-vault-integration.md b/docs/security/azure-security-key-vault-integration.md index 2cfd98af69..f49187b649 100644 --- a/docs/security/azure-security-key-vault-integration.md +++ b/docs/security/azure-security-key-vault-integration.md @@ -87,32 +87,27 @@ There are many more configuration options available to customize the Key Vault r ### Connect to an existing Azure Key Vault instance -You might have an existing Azure Key Vault instance that you want to connect to. Instead of representing a new Azure Key Vault resource, you can add a connection string to the app host. To add a connection to an existing Azure Key Vault resource, call the method: +You might have an existing Azure AI Key Vault instance that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var keyVault = builder.AddConnectionString("key-vault"); +var existingKeyVaultName = builder.AddParameter("existingKeyVaultName"); +var existingKeyVaultResourceGroup = builder.AddParameter("existingKeyVaultResourceGroup"); -builder.AddProject("web") - .WithReference(keyVault); +var keyvault = builder.AddAzureKeyVault("ke-yvault") + .AsExisting(existingKeyVaultName, existingKeyVaultResourceGroup); + +builder.AddProject() + .WithReference(keyvault); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] +For more information on treating Azure Key Vault resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "key-vault": "https://{account_name}.vault.azure.net/" - } -} -``` - -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"key-vault"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Key Vault resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ## Client integration From acf45ecdaabb6fbb3c275ffbfd37ea6559641054 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 15:04:22 +0100 Subject: [PATCH 09/13] De-emphasized connection strings in the Azure PostgreSQL article. --- .../includes/postgresql-flexible-server.md | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/docs/database/includes/postgresql-flexible-server.md b/docs/database/includes/postgresql-flexible-server.md index a54a22c14f..58bb9033fd 100644 --- a/docs/database/includes/postgresql-flexible-server.md +++ b/docs/database/includes/postgresql-flexible-server.md @@ -88,32 +88,27 @@ There are many more configuration options available to customize the PostgreSQL ### Connect to an existing Azure PostgreSQL flexible server -You might have an existing Azure PostgreSQL flexible server that you want to connect to. Instead of representing a new Azure PostgreSQL flexible server resource, you can add a connection string to the app host. To add a connection to an existing Azure PostgreSQL flexible server, call the method: +You might have an existing Azure PostgreSQL flexible server that you want to connect to. Chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var postgres = builder.AddConnectionString("postgres"); +var existingPostgresName = builder.AddParameter("existingPostgresName"); +var existingPostgresResourceGroup = builder.AddParameter("existingPostgresResourceGroup"); -builder.AddProject("web") +var postgres = builder.AddAzurePostgresFlexibleServer("postgres") + .AsExisting(existingPostgresName, existingPostgresResourceGroup); + +builder.AddProject() .WithReference(postgres); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "postgres": "Server=.postgres.database.azure.com;Database=;Port=5432;Ssl Mode=Require;User Id=;" - } -} -``` +For more information on treating Azure PostgreSQL flexible server resources as existing resources, see [Use existing Azure resources](../../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"postgres"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure PostgreSQL flexible server resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Run Azure PostgreSQL resource as a container From 29752915b8d7a6987283372bfa7a496b0ee649d2 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 15:17:37 +0100 Subject: [PATCH 10/13] De-emphasized connection strings in the Azure Service Bus article. --- .../azure-service-bus-integration.md | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/messaging/azure-service-bus-integration.md b/docs/messaging/azure-service-bus-integration.md index 19e5c4ae1e..7545c9eb91 100644 --- a/docs/messaging/azure-service-bus-integration.md +++ b/docs/messaging/azure-service-bus-integration.md @@ -87,12 +87,16 @@ There are many more configuration options available to customize the Azure Servi ### Connect to an existing Azure Service Bus namespace -You might have an existing Azure Service Bus namespace that you want to connect to. Instead of representing a new Azure Service Bus resource, you can add a connection string to the app host. To add a connection to an existing Azure Service Bus namespace, call the method: +You might have an existing Azure Service Bus namespace that you want to connect to. Chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var serviceBus = builder.AddConnectionString("messaging"); +var existingServiceBusName = builder.AddParameter("existingServiceBusName"); +var existingServiceBusResourceGroup = builder.AddParameter("existingServiceBusResourceGroup"); + +var serviceBus = builder.AddAzureServiceBus("messaging") + .AsExisting(existingServiceBusName, existingServiceBusResourceGroup); builder.AddProject("web") .WithReference(serviceBus); @@ -100,19 +104,10 @@ builder.AddProject("web") // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "messaging": "Endpoint=sb://{namespace}.servicebus.windows.net/;SharedAccessKeyName={key_name};SharedAccessKey={key_value};" - } -} -``` +For more information on treating Azure Service Bus resources as existing resources, see [Use existing Azure resources](../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"messaging"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Service Bus resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Add Azure Service Bus queue From cb349e15a3efa19fa3a159da43eeb93abb1bc387 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 15:29:22 +0100 Subject: [PATCH 11/13] De-emphasized connection strings in the Azure SQL Database article. --- docs/database/includes/azure-sql-hosting.md | 28 +++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/docs/database/includes/azure-sql-hosting.md b/docs/database/includes/azure-sql-hosting.md index fb55df3e07..86b83ccca5 100644 --- a/docs/database/includes/azure-sql-hosting.md +++ b/docs/database/includes/azure-sql-hosting.md @@ -45,32 +45,28 @@ The preceding call to `AddAzureSqlServer` configures the Azure SQL server resour ### Connect to an existing Azure SQL server -You might have an existing Azure SQL database that you want to connect to. Instead of representing a new Azure SQL server resource, you can add a connection string to the app host. To add a connection to an existing Azure SQL server, call the method: +You might have an existing Azure SQL Database service that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var azureSql = builder.AddConnectionString("database"); +var existingSqlServerName = builder.AddParameter("existingSqlServerName"); +var existingSqlServerResourceGroup = builder.AddParameter("existingSqlServerResourceGroup"); -builder.AddProject("web") - .WithReference(azureSql); +var sqlserver = builder.AddAzureSqlServer("sqlserver") + .AsExisting(existingSqlServerName, existingSqlServerResourceGroup) + .AddDatabase("database"); + +builder.AddProject() + .WithReference(sqlserver); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "database": "Server=tcp:.database.windows.net,1433;Initial Catalog=;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;User ID=;" - } -} -``` +For more information on treating Azure SQL Database resources as existing resources, see [Use existing Azure resources](../../azure/integrations-overview.md#use-existing-azure-resources). -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"database"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure SQL Database resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Run Azure SQL server resource as a container From 5bfd6fb083796530da3a50623ced057403a9dc63 Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 16:00:54 +0100 Subject: [PATCH 12/13] De-emphasized connection strings in the Azure Storage articles. --- docs/storage/includes/storage-app-host.md | 28 ++++++++++------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/docs/storage/includes/storage-app-host.md b/docs/storage/includes/storage-app-host.md index a66e374331..422103205a 100644 --- a/docs/storage/includes/storage-app-host.md +++ b/docs/storage/includes/storage-app-host.md @@ -102,32 +102,28 @@ There are many more configuration options available to customize the Azure Stora ### Connect to an existing Azure Storage account -You might have an existing Azure Storage account that you want to connect to. Instead of representing a new Azure Storage resource, you can add a connection string to the app host. To add a connection to an existing Azure Storage account, call the method: +You might have an existing Azure Storage account that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var blobs = builder.AddConnectionString("blobs"); +var existingStorageName = builder.AddParameter("existingStorageName"); +var existingStorageResourceGroup = builder.AddParameter("existingStorageResourceGroup"); -builder.AddProject("web") - .WithReference(blobs); +var storageaccount = builder.AddAzureStorage("storage") + .AsExisting(existingStorageName, existingStorageResourceGroup) + .AddBlobs("blobs"); + +builder.AddProject() + .WithReference(storageaccount); // After adding all resources, run the app... ``` -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: +For more information on treating Azure Storage resources as existing resources, see [Use existing Azure resources](../../azure/integrations-overview.md#use-existing-azure-resources). -```json -{ - "ConnectionStrings": { - "blobs": "https://{account_name}.blob.core.windows.net/" - } -} -``` - -The dependent resource can access the injected connection string by calling the method, and passing the connection name as the parameter, in this case `"blobs"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. +> [!NOTE] +> Alternatively, instead of representing an Azure Storage account resource, you can add a connection string to the app host. This approach is weakly-typed, and doesn't work with role assignments or infrastructure customizations. For more information, see [Add existing Azure resources with connection strings](../../azure/integrations-overview.md#add-existing-azure-resources-with-connection-strings). ### Add Azure Storage emulator resource From f81c80e3f669870301952c90b72c7a1bff711aed Mon Sep 17 00:00:00 2001 From: AJ Matthews Date: Thu, 12 Jun 2025 16:23:11 +0100 Subject: [PATCH 13/13] Fixed one API path. --- docs/database/includes/azure-sql-hosting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/database/includes/azure-sql-hosting.md b/docs/database/includes/azure-sql-hosting.md index 86b83ccca5..283fbdee90 100644 --- a/docs/database/includes/azure-sql-hosting.md +++ b/docs/database/includes/azure-sql-hosting.md @@ -45,7 +45,7 @@ The preceding call to `AddAzureSqlServer` configures the Azure SQL server resour ### Connect to an existing Azure SQL server -You might have an existing Azure SQL Database service that you want to connect to. You can chain a call to annotate that your is an existing resource: +You might have an existing Azure SQL Database service that you want to connect to. You can chain a call to annotate that your is an existing resource: ```csharp var builder = DistributedApplication.CreateBuilder(args);