From c00410122e378625f677eab40e9a737094360f89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 15 Jul 2025 22:13:15 +0000 Subject: [PATCH 1/2] Initial plan From 261dd4e5896e9242f884e469c367a1c69c78e931 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 15 Jul 2025 22:18:01 +0000 Subject: [PATCH 2/2] Fix Storage Account connection string handling Co-authored-by: mrsharm <68247673+mrsharm@users.noreply.github.com> --- Controllers/AppController.cs | 12 ++++++++++-- appsettings.Development.json | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Controllers/AppController.cs b/Controllers/AppController.cs index a06567a..3a44c92 100644 --- a/Controllers/AppController.cs +++ b/Controllers/AppController.cs @@ -83,7 +83,11 @@ public ActionResult sayhello() var connectionString = app.GetConnectionString("StorageAccount"); if (string.IsNullOrEmpty(connectionString)) { - throw new InvalidOperationException("Storage account connection string is not configured."); + return BadRequest(new { + error = "Storage account connection string is not configured.", + details = "Please configure the 'StorageAccount' connection string in app settings or appsettings.json", + configurationKey = "ConnectionStrings:StorageAccount" + }); } try @@ -94,7 +98,11 @@ public ActionResult sayhello() } catch (Exception ex) { - throw new InvalidOperationException($"Failed to connect to storage account: {ex.Message}", ex); + return StatusCode(500, new { + error = "Failed to connect to storage account", + details = ex.Message, + connectionString = connectionString.Length > 20 ? connectionString.Substring(0, 20) + "..." : connectionString + }); } } diff --git a/appsettings.Development.json b/appsettings.Development.json index 0c208ae..0b5f1ba 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -4,5 +4,8 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } + }, + "ConnectionStrings": { + "StorageAccount": "UseDevelopmentStorage=true" } }