diff --git a/src/Scaler.Demo/OrderProcessor/Keda.CosmosDb.Scaler.Demo.OrderProcessor.csproj b/src/Scaler.Demo/OrderProcessor/Keda.CosmosDb.Scaler.Demo.OrderProcessor.csproj index 2d07aa2..f696b13 100644 --- a/src/Scaler.Demo/OrderProcessor/Keda.CosmosDb.Scaler.Demo.OrderProcessor.csproj +++ b/src/Scaler.Demo/OrderProcessor/Keda.CosmosDb.Scaler.Demo.OrderProcessor.csproj @@ -5,6 +5,7 @@ + diff --git a/src/Scaler.Demo/OrderProcessor/Worker.cs b/src/Scaler.Demo/OrderProcessor/Worker.cs index 949a69d..eb2844a 100644 --- a/src/Scaler.Demo/OrderProcessor/Worker.cs +++ b/src/Scaler.Demo/OrderProcessor/Worker.cs @@ -3,6 +3,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Azure.Identity; using Keda.CosmosDb.Scaler.Demo.Shared; using Microsoft.Azure.Cosmos; using Microsoft.Extensions.Hosting; @@ -25,6 +26,10 @@ public Worker(CosmosDbConfig cosmosDbConfig, ILogger logger) public override async Task StartAsync(CancellationToken cancellationToken) { + var cosmosClient = _cosmosDbConfig.Connection.Contains("AccountKey") + ? new CosmosClient(_cosmosDbConfig.Connection) + : new CosmosClient(_cosmosDbConfig.Connection, new DefaultAzureCredential()); + Database leaseDatabase = await new CosmosClient(_cosmosDbConfig.LeaseConnection) .CreateDatabaseIfNotExistsAsync(_cosmosDbConfig.LeaseDatabaseId, cancellationToken: cancellationToken);