Skip to content

Commit 0b3fd6e

Browse files
authored
Azure cosmosdb support in aspire (dotnet#359)
* Initial addition of CosmosDB support, based on SqlServer * Remove Healthchecks support from CosmosDB EF Component * Cleanup connection string handling in Cosmos EF * Cleanup connection string handling in Cosmos component * Update CosmosDB package to get OTel support * Use the parent name for the connection * Udpate manifest strings * Add CosmosDB components to Progress and Telemetry * Rename CosmosDB components to Aspire.Azure.Data.Cosmos[.EntityFrameworkCore] * Rename options -> settings * Rename Cosmos Components to follow naming guidelines * Update to CosmosDB preview package and pin to get OpenTelemetry support * Update comments and add Keyed DI to Aspire.Microsoft.Azure.Cosmos * Add log categories to Cosmos Component schemas * Add basic support for CosmosClientOptions (no IConfiguration binding yet) * Remove healthchecks support from CosmosDB Component * Add README for Aspire.Microsoft.Azure.Cosmos * Add README for Aspire.Microsoft.EntityFrameworkCore.Cosmos, and rename a couple of things * Update config schema to be nested for Aspire.Microsoft.EntityFramework.Cosmos and Aspire.Microsoft.Azure.Cosmos * Rename AzureDataCosmosSettings -> AzureCosmosDBSettings * Update Aspire_Components_Progress.md * Add PackageTags, Descriptions, and Icons * Add AccountEndpoint to ConfigurationScheama.json * Fix DB context builder config * Add xml doc comments for CosmosDB hosting methods and types * Move Cosmos DB hosting to Aspire.Hosting.Azure * Update manifest type names * Respond to PR feedback
1 parent 0282715 commit 0b3fd6e

25 files changed

+1254
-2
lines changed

Aspire.sln

+28
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Hosting.Azure.Provis
133133
EndProject
134134
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eShopLite", "eShopLite", "{A68BA1A5-1604-433D-9778-DC0199831C2A}"
135135
EndProject
136+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.Azure.Cosmos", "src\Components\Aspire.Microsoft.Azure.Cosmos\Aspire.Microsoft.Azure.Cosmos.csproj", "{23298562-C1D4-41CD-83FE-426C94FEE35F}"
137+
EndProject
138+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.EntityFrameworkCore.Cosmos", "src\Components\Aspire.Microsoft.EntityFrameworkCore.Cosmos\Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj", "{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}"
139+
EndProject
140+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.Azure.Cosmos.Tests", "tests\Aspire.Microsoft.Azure.Cosmos.Tests\Aspire.Microsoft.Azure.Cosmos.Tests.csproj", "{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}"
141+
EndProject
142+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests", "tests\Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests\Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests.csproj", "{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}"
143+
EndProject
136144
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CatalogDb", "samples\eShopLite\CatalogDb\CatalogDb.csproj", "{A84C4EE3-2601-4804-BCDC-E9948E164A22}"
137145
EndProject
138146
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{991DB378-6CB5-4441-BFC3-657400690FC3}"
@@ -370,6 +378,22 @@ Global
370378
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
371379
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
372380
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Release|Any CPU.Build.0 = Release|Any CPU
381+
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
382+
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
383+
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
384+
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Release|Any CPU.Build.0 = Release|Any CPU
385+
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
386+
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Debug|Any CPU.Build.0 = Debug|Any CPU
387+
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Release|Any CPU.ActiveCfg = Release|Any CPU
388+
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Release|Any CPU.Build.0 = Release|Any CPU
389+
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
390+
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
391+
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
392+
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Release|Any CPU.Build.0 = Release|Any CPU
393+
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
394+
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Debug|Any CPU.Build.0 = Debug|Any CPU
395+
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Release|Any CPU.ActiveCfg = Release|Any CPU
396+
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Release|Any CPU.Build.0 = Release|Any CPU
373397
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
374398
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Debug|Any CPU.Build.0 = Debug|Any CPU
375399
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -446,6 +470,10 @@ Global
446470
{E2EC79D0-80F7-4471-9613-D7C8C3D52F95} = {B80354C7-BE58-43F6-8928-9F3A74AB7F47}
447471
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D} = {B80354C7-BE58-43F6-8928-9F3A74AB7F47}
448472
{A68BA1A5-1604-433D-9778-DC0199831C2A} = {D173887B-AF42-4576-B9C1-96B9E9B3D9C0}
473+
{23298562-C1D4-41CD-83FE-426C94FEE35F} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
474+
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
475+
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
476+
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
449477
{A84C4EE3-2601-4804-BCDC-E9948E164A22} = {A68BA1A5-1604-433D-9778-DC0199831C2A}
450478
{4D8A92AB-4E77-4965-AD8E-8E206DCE66A4} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
451479
{165411FE-755E-4869-A756-F87F455860AC} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}

Directory.Packages.props

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.5.0" />
1515
<PackageVersion Include="Azure.Storage.Blobs" Version="12.18.0" />
1616
<PackageVersion Include="Azure.Storage.Queues" Version="12.16.0" />
17+
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.36.0-preview" />
1718
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.1" />
1819
<!-- Azure Management SDK for .NET dependencies -->
1920
<PackageVersion Include="Azure.ResourceManager.KeyVault" Version="1.2.0-beta.2" />
@@ -45,6 +46,7 @@
4546
<!-- sql client dependencies -->
4647
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.1" />
4748
<!-- efcore dependencies -->
49+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="$(EfCoreVersion)" />
4850
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfCoreVersion)" />
4951
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EfCoreVersion)" />
5052
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfCoreVersion)" />
@@ -101,4 +103,4 @@
101103
<PackageVersion Include="Microsoft.Signed.Wix" Version="1.0.0-v3.14.0.5722" />
102104
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.23371.1" />
103105
</ItemGroup>
104-
</Project>
106+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Aspire.Hosting.ApplicationModel;
5+
using Aspire.Hosting.Azure.Data.Cosmos;
6+
using System.Text.Json;
7+
8+
namespace Aspire.Hosting;
9+
10+
/// <summary>
11+
/// Provides extension methods for adding Azure Cosmos DB resources to an <see cref="IDistributedApplicationBuilder"/>.
12+
/// </summary>
13+
public static class AzureCosmosDBCloudApplicationBuilderExtensions
14+
{
15+
/// <summary>
16+
/// Adds an Azure Cosmos DB connection to the application model.
17+
/// </summary>
18+
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>.</param>
19+
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
20+
/// <param name="connectionString">The connection string.</param>
21+
/// <returns>A reference to the <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.</returns>
22+
public static IResourceBuilder<AzureCosmosDBConnectionResource> AddAzureCosmosDB(
23+
this IDistributedApplicationBuilder builder,
24+
string name,
25+
string? connectionString = null)
26+
{
27+
var connection = new AzureCosmosDBConnectionResource(name, connectionString);
28+
return builder.AddResource(connection)
29+
.WithAnnotation(new ManifestPublishingCallbackAnnotation(jsonWriter => WriteCosmosDBConnectionToManifest(jsonWriter, connection)));
30+
}
31+
32+
private static void WriteCosmosDBConnectionToManifest(Utf8JsonWriter jsonWriter, AzureCosmosDBConnectionResource cosmosDbConnection)
33+
{
34+
jsonWriter.WriteString("type", "azure.cosmosdb.connection.v0");
35+
jsonWriter.WriteString("connectionString", cosmosDbConnection.GetConnectionString());
36+
}
37+
38+
private static void WriteCosmosDBDatabaseToManifest(Utf8JsonWriter jsonWriter, AzureCosmosDatabaseResource cosmosDatabase)
39+
{
40+
jsonWriter.WriteString("type", "azure.cosmosdb.database.v0");
41+
jsonWriter.WriteString("parent", cosmosDatabase.Parent.Name);
42+
jsonWriter.WriteString("databaseName", cosmosDatabase.Name);
43+
}
44+
45+
/// <summary>
46+
/// Adds an Azure Cosmos DB database to a <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.
47+
/// </summary>
48+
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>.</param>
49+
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
50+
/// <returns>A reference to the <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.</returns>
51+
public static IResourceBuilder<AzureCosmosDatabaseResource> AddDatabase(this IResourceBuilder<AzureCosmosDBConnectionResource> builder, string name)
52+
{
53+
var cosmosDatabase = new AzureCosmosDatabaseResource(name, builder.Resource);
54+
return builder
55+
.ApplicationBuilder
56+
.AddResource(cosmosDatabase)
57+
.WithAnnotation(new ManifestPublishingCallbackAnnotation(
58+
(json) => WriteCosmosDBDatabaseToManifest(json, cosmosDatabase)));
59+
}
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Aspire.Hosting.ApplicationModel;
5+
6+
namespace Aspire.Hosting.Azure.Data.Cosmos;
7+
8+
/// <summary>
9+
/// Represents a connection to an Azure Cosmos DB account.
10+
/// </summary>
11+
/// <param name="name">The resource name.</param>
12+
/// <param name="connectionString">The connection string to use to connect.</param>
13+
public class AzureCosmosDBConnectionResource(string name, string? connectionString)
14+
: Resource(name), IResourceWithConnectionString
15+
{
16+
/// <summary>
17+
/// Gets the connection string to use for this database.
18+
/// </summary>
19+
/// <returns>The connection string to use for this database.</returns>
20+
public string? GetConnectionString() => connectionString;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Aspire.Hosting.ApplicationModel;
5+
6+
namespace Aspire.Hosting.Azure.Data.Cosmos;
7+
8+
/// <summary>
9+
/// Represents an Azure Cosmos DB database.
10+
/// </summary>
11+
/// <param name="name">The database name.</param>
12+
/// <param name="parent">The parent <see cref="AzureCosmosDBConnectionResource"/>.</param>
13+
public class AzureCosmosDatabaseResource(string name, AzureCosmosDBConnectionResource parent)
14+
: Resource(name), IResourceWithParent<AzureCosmosDBConnectionResource>, IResourceWithConnectionString
15+
{
16+
/// <summary>
17+
/// Gets the parent <see cref="AzureCosmosDBConnectionResource"/>.
18+
/// </summary>
19+
public AzureCosmosDBConnectionResource Parent { get; } = parent;
20+
21+
/// <summary>
22+
/// Gets the connection string to use for this database.
23+
/// </summary>
24+
/// <returns>The connection string to use for this database.</returns>
25+
public string? GetConnectionString()
26+
{
27+
return Parent.GetConnectionString();
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(NetCurrent)</TargetFramework>
5+
<IsPackable>true</IsPackable>
6+
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator>
7+
<IsAotCompatible>false</IsAotCompatible>
8+
<PackageTags>$(ComponentAzurePackageTags) cosmos cosmosdb data database db</PackageTags>
9+
<Description>A client for Azure Cosmos DB that integrates with Aspire, including logging and telemetry.</Description>
10+
<PackageIconFullPath>$(SharedDir)AzureCosmosDB_256x.png</PackageIconFullPath>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Azure.Identity" />
15+
<PackageReference Include="Microsoft.Azure.Cosmos" />
16+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
17+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
18+
</ItemGroup>
19+
20+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Aspire.Microsoft.Azure.Cosmos;
5+
using Azure.Identity;
6+
using Microsoft.Azure.Cosmos;
7+
using Microsoft.Extensions.Configuration;
8+
using Microsoft.Extensions.DependencyInjection;
9+
10+
namespace Microsoft.Extensions.Hosting;
11+
12+
/// <summary>
13+
/// Azure CosmosDB extension
14+
/// </summary>
15+
public static class AspireAzureCosmosDBExtensions
16+
{
17+
private const string DefaultConfigSectionName = "Aspire:Microsoft:Azure:Cosmos";
18+
19+
/// <summary>
20+
/// Registers <see cref="CosmosClient" /> as a singleton in the services provided by the <paramref name="builder"/>.
21+
/// Configures logging and telemetry for the <see cref="CosmosClient" />.
22+
/// </summary>
23+
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
24+
/// <param name="connectionName">The connection name to use to find a connection string.</param>
25+
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="AzureCosmosDBSettings"/>. It's invoked after the settings are read from the configuration.</param>
26+
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
27+
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos" section.</remarks>
28+
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
29+
public static void AddAzureCosmosDB(
30+
this IHostApplicationBuilder builder,
31+
string connectionName,
32+
Action<AzureCosmosDBSettings>? configureSettings = null,
33+
Action<CosmosClientOptions>? configureClientOptions = null)
34+
{
35+
AddAzureCosmosDB(builder, DefaultConfigSectionName, configureSettings, configureClientOptions, connectionName, serviceKey: null);
36+
}
37+
38+
/// <summary>
39+
/// Registers <see cref="CosmosClient" /> as a singleton for given <paramref name="name" /> in the services provided by the <paramref name="builder"/>.
40+
/// Configures logging and telemetry for the <see cref="CosmosClient" />.
41+
/// </summary>
42+
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
43+
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
44+
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="AzureCosmosDBSettings"/>. It's invoked after the settings are read from the configuration.</param>
45+
/// <param name="configureClientOptions">An optional method that can be used for customizing the <see cref="CosmosClientOptions"/>.</param>
46+
/// <remarks>Reads the configuration from "Aspire:Microsoft:Azure:Cosmos:{name}" section.</remarks>
47+
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
48+
public static void AddKeyedAzureCosmosDB(
49+
this IHostApplicationBuilder builder,
50+
string name,
51+
Action<AzureCosmosDBSettings>? configureSettings = null,
52+
Action<CosmosClientOptions>? configureClientOptions = null)
53+
{
54+
AddAzureCosmosDB(builder, $"{DefaultConfigSectionName}:{name}", configureSettings, configureClientOptions, connectionName: name, serviceKey: name);
55+
}
56+
57+
private static void AddAzureCosmosDB(
58+
this IHostApplicationBuilder builder,
59+
string configurationSectionName,
60+
Action<AzureCosmosDBSettings>? configureSettings,
61+
Action<CosmosClientOptions>? configureClientOptions,
62+
string connectionName,
63+
string? serviceKey)
64+
{
65+
ArgumentNullException.ThrowIfNull(builder);
66+
67+
var settings = new AzureCosmosDBSettings();
68+
builder.Configuration.GetSection(configurationSectionName).Bind(settings);
69+
70+
if (builder.Configuration.GetConnectionString(connectionName) is string connectionString)
71+
{
72+
if (Uri.TryCreate(connectionString, UriKind.Absolute, out var uri))
73+
{
74+
settings.AccountEndpoint = uri;
75+
}
76+
else
77+
{
78+
settings.ConnectionString = connectionString;
79+
}
80+
}
81+
82+
configureSettings?.Invoke(settings);
83+
84+
var clientOptions = new CosmosClientOptions();
85+
// Needs to be enabled for either logging or tracing to work.
86+
clientOptions.CosmosClientTelemetryOptions.DisableDistributedTracing = false;
87+
if (settings.Tracing)
88+
{
89+
builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
90+
{
91+
tracerProviderBuilder.AddSource("Azure.Cosmos.Operation");
92+
});
93+
}
94+
95+
configureClientOptions?.Invoke(clientOptions);
96+
97+
if (serviceKey is null)
98+
{
99+
builder.Services.AddSingleton(_ => ConfigureDb());
100+
}
101+
else
102+
{
103+
builder.Services.AddKeyedSingleton(serviceKey, (sp, key) => ConfigureDb());
104+
}
105+
106+
CosmosClient ConfigureDb()
107+
{
108+
if (!string.IsNullOrEmpty(settings.ConnectionString))
109+
{
110+
return new CosmosClient(settings.ConnectionString, clientOptions);
111+
}
112+
else if (settings.AccountEndpoint is not null)
113+
{
114+
var credential = settings.Credential ?? new DefaultAzureCredential();
115+
return new CosmosClient(settings.AccountEndpoint.OriginalString, credential, clientOptions);
116+
}
117+
else
118+
{
119+
throw new InvalidOperationException(
120+
$"A CosmosClient could not be configured. Ensure valid connection information was provided in 'ConnectionStrings:{connectionName}' or either " +
121+
$"{nameof(settings.ConnectionString)} or {nameof(settings.AccountEndpoint)} must be provided " +
122+
$"in the '{configurationSectionName}' configuration section.");
123+
}
124+
}
125+
}
126+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Azure.Core;
5+
6+
namespace Aspire.Microsoft.Azure.Cosmos;
7+
8+
/// <summary>
9+
/// The settings relevant to accessing Azure Cosmos DB.
10+
/// </summary>
11+
public sealed class AzureCosmosDBSettings
12+
{
13+
/// <summary>
14+
/// Gets or sets the connection string of the Azure Cosmos database to connect to.
15+
/// </summary>
16+
public string? ConnectionString { get; set; }
17+
18+
/// <summary>
19+
/// <para>Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is enabled or not.</para>
20+
/// <para>Enabled by default.</para>
21+
/// </summary>
22+
public bool Tracing { get; set; } = true;
23+
24+
/// <summary>
25+
/// A <see cref="Uri"/> referencing the Azure Cosmos DB Endpoint.
26+
/// This is likely to be similar to "https://{account_name}.queue.core.windows.net".
27+
/// </summary>
28+
/// <remarks>
29+
/// Must not contain shared access signature.
30+
/// Used along with <see cref="Credential"/> to establish the connection.
31+
/// </remarks>
32+
public Uri? AccountEndpoint { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the credential used to authenticate to the Azure Cosmos DB endpoint.
36+
/// </summary>
37+
public TokenCredential? Credential { get; set; }
38+
}
39+

0 commit comments

Comments
 (0)