diff --git a/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosExtensionServices.cs b/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosExtensionServices.cs index 664029e..f3fe7d2 100644 --- a/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosExtensionServices.cs +++ b/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosExtensionServices.cs @@ -6,6 +6,7 @@ using System.Reflection; using Azure.Core; using System.Text.RegularExpressions; +using System.Net; namespace Cosmos.DataTransfer.CosmosExtension { @@ -31,6 +32,10 @@ public static CosmosClient CreateClient(CosmosSettingsBase settings, string disp EnableContentResponseOnWrite = false, Serializer = cosmosSerializer, }; + + if (!string.IsNullOrEmpty(settings.WebProxy)){ + clientOptions.WebProxy = new WebProxy(settings.WebProxy); + } CosmosClient? cosmosClient; if (settings.UseRbacAuth) diff --git a/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosSettingsBase.cs b/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosSettingsBase.cs index 74fb17e..e074ac2 100644 --- a/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosSettingsBase.cs +++ b/Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension/CosmosSettingsBase.cs @@ -11,7 +11,7 @@ public abstract class CosmosSettingsBase : IValidatableObject [Required] public string? Container { get; set; } public ConnectionMode ConnectionMode { get; set; } = ConnectionMode.Gateway; - + public string? WebProxy { get; set; } public bool UseRbacAuth { get; set; } public string? AccountEndpoint { get; set; } public bool EnableInteractiveCredentials { get; set; } = true; diff --git a/Extensions/Cosmos/README.md b/Extensions/Cosmos/README.md index b3b9de2..dc8b60d 100644 --- a/Extensions/Cosmos/README.md +++ b/Extensions/Cosmos/README.md @@ -14,7 +14,7 @@ Source and sink settings also both require parameters to specify the data locati - `Database` - `Container` -Source supports an optional `IncludeMetadataFields` parameter (`false` by default) to enable inclusion of built-in Cosmos fields prefixed with `"_"`, for example `"_etag"` and `"_ts"`. An optional PartitionKeyValue setting allows for filtering to a single partition. The optional Query setting allows further filtering using a Cosmos SQL statement. +Source supports an optional `IncludeMetadataFields` parameter (`false` by default) to enable inclusion of built-in Cosmos fields prefixed with `"_"`, for example `"_etag"` and `"_ts"`. An optional PartitionKeyValue setting allows for filtering to a single partition. The optional Query setting allows further filtering using a Cosmos SQL statement. An optional `WebProxy` parameter (`null` by default) enables connections through a proxy. ### Source @@ -25,7 +25,8 @@ Source supports an optional `IncludeMetadataFields` parameter (`false` by defaul "Container":"myContainer", "IncludeMetadataFields": false, "PartitionKeyValue":"123", - "Query":"SELECT * FROM c WHERE c.category='event'" + "Query":"SELECT * FROM c WHERE c.category='event'", + "WebProxy":"http://yourproxy.server.com/" } ``` @@ -40,7 +41,8 @@ Or with RBAC: "Container":"myContainer", "IncludeMetadataFields": false, "PartitionKeyValue":"123", - "Query":"SELECT * FROM c WHERE c.category='event'" + "Query":"SELECT * FROM c WHERE c.category='event'", + "WebProxy":"http://yourproxy.server.com/" } ```