diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json deleted file mode 100644 index 028030099b..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "CosmosDBEndPointUrl": "https://localhost:8081", - "CosmosDBAuthorizationKey": "Super secret key", - "ApplicationInsightsConnectionString": "Super secret connection string" -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj index 59162abaca..2ade53a665 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj @@ -1,10 +1,8 @@ - + Exe net6.0 - Cosmos.Samples.ApplicationInsights - Cosmos.Samples.ApplicationInsights latest @@ -15,11 +13,9 @@ - - + PreserveNewest - diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs index 288ce80c64..fbc1ae7894 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs @@ -4,12 +4,10 @@ using System.Threading.Tasks; using Newtonsoft.Json; using Microsoft.Azure.Cosmos; - using Microsoft.Extensions.Logging; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.WorkerService; - using Microsoft.Extensions.Logging.ApplicationInsights; internal class Program { @@ -26,13 +24,13 @@ static async Task Main() .AddJsonFile("AppSettings.json") .Build(); - string endpoint = configuration["CosmosDBEndPointUrl"]; + string endpoint = configuration["EndPointUrl"]; if (string.IsNullOrEmpty(endpoint)) { throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json"); } - string authKey = configuration["CosmosDBAuthorizationKey"]; + string authKey = configuration["AuthorizationKey"]; if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key")) { throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json"); diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/AppSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/AppSettings.json deleted file mode 100644 index f6b062537f..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/AppSettings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "CosmosDBEndPointUrl": "https://localhost:8081", - "CosmosDBAuthorizationKey": "Super secret key" -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/CustomDiagnosticAndEventListener.csproj b/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/CustomDiagnosticAndEventListener.csproj index 342b8d2571..eeb17eb145 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/CustomDiagnosticAndEventListener.csproj +++ b/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/CustomDiagnosticAndEventListener.csproj @@ -1,4 +1,4 @@ - + Exe @@ -12,9 +12,8 @@ - - + PreserveNewest diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/Program.cs index 551519d29b..77580936f7 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/CustomDiagnosticAndEventListener/Program.cs @@ -1,6 +1,5 @@ namespace Cosmos.Samples.ApplicationInsights { - using System.Net; using Microsoft.Azure.Cosmos; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; @@ -17,13 +16,13 @@ static async Task Main() .AddJsonFile("AppSettings.json") .Build(); - string endpoint = configuration["CosmosDBEndPointUrl"]; + string endpoint = configuration["EndPointUrl"]; if (string.IsNullOrEmpty(endpoint)) { throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json"); } - string authKey = configuration["CosmosDBAuthorizationKey"]; + string authKey = configuration["AuthorizationKey"]; if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key")) { throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json"); diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json deleted file mode 100644 index e0d21e3e09..0000000000 --- a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Logging": { - "OpenTelemetry": { - "LogLevel": { - "Azure.Cosmos.Operation.Request.Diagnostics": "Warning" - } - } - }, - "CosmosDBEndPointUrl": "https://localhost:8081", - "CosmosDBAuthorizationKey": "Super secret key", - "ApplicationInsightsConnectionString": "Super secret connection string" -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj index 83224d4570..20ddd0e96d 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj +++ b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj @@ -14,11 +14,9 @@ - - + PreserveNewest - diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs index b4729e41c7..8fb38c3fdb 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs @@ -28,13 +28,13 @@ static async Task Main() .AddJsonFile("AppSettings.json") .Build(); - string endpoint = configuration["CosmosDBEndPointUrl"]; + string endpoint = configuration["EndPointUrl"]; if (string.IsNullOrEmpty(endpoint)) { throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json"); } - string authKey = configuration["CosmosDBAuthorizationKey"]; + string authKey = configuration["AuthorizationKey"]; if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key")) { throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json"); diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/appSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/appSettings.json index 64a8acc501..8285d9b99e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/appSettings.json +++ b/Microsoft.Azure.Cosmos.Samples/Usage/appSettings.json @@ -1,4 +1,12 @@ { "EndPointUrl": "https://localhost:8081", - "AuthorizationKey": "Super secret key" + "AuthorizationKey": "Super secret key", + "ApplicationInsightsConnectionString": "Super secret connection string", + "Logging": { + "OpenTelemetry": { + "LogLevel": { + "Azure.Cosmos.Operation.Request.Diagnostics": "Warning" + } + } + } }