{"record":{"id":"a2c477ea3da168cd","repo":"microsoft/ailab","slug":"the-storage-account-connectionstring-is-not-valid","errorCode":null,"errorMessage":"The storage account connectionstring is not valid.","messagePattern":"The storage account connectionstring is not valid\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"VirtualStage/Speaker.Recorder/Speaker.Recorder/Services/UploadManager.cs","lineNumber":50,"sourceCode":"            this.disposeCancellation = new CancellationTokenSource();\n            this.StorageConnectionString = configuration.GetValue<string>(\"Data:AzureBlobConnection\");\n            this.GlobalIdentifier = identificationService.GetSanitizedIdentifier();\n            this.logger = logger;\n            var connections = configuration.GetValue(\"Data:DefaultConnectionLimit\", Environment.ProcessorCount - 2);\n            ServicePointManager.DefaultConnectionLimit = Math.Max(connections, 1);\n\n            this.uploadRetries = configuration.GetValue(\"Data:UploadRetries\", 10);\n\n            this.cloudBlobContainerTask = this.InitializeContainerAsync();\n        }\n\n        private async Task<CloudBlobContainer> InitializeContainerAsync()\n        {\n            if (string.IsNullOrEmpty(this.StorageConnectionString) || !CloudStorageAccount.TryParse(this.StorageConnectionString, out var account))\n            {\n                this.IsUploadAvailable = false;\n                this.logger.LogError($\"The storage account connectionstring is not valid.\");\n                throw new InvalidOperationException(\"The storage account connectionstring is not valid.\");\n            }\n\n            this.IsUploadAvailable = true;\n            this.logger.LogInformation($\"Initializing Cloud storage for {GlobalIdentifier} in {account.BlobEndpoint}\");\n            CloudBlobClient blobClient = account.CreateCloudBlobClient();\n            blobClient.DefaultRequestOptions.MaximumExecutionTime = TimeSpan.FromSeconds(10);\n            blobClient.DefaultRequestOptions.ServerTimeout = TimeSpan.FromSeconds(10);\n            CloudBlobContainer blobContainer = blobClient.GetContainerReference(GlobalIdentifier);\n            if (await blobContainer.CreateIfNotExistsAsync().ConfigureAwait(false))\n            {\n                this.logger.LogInformation($\"The Cloud storage for {GlobalIdentifier} did not exists and was created\");\n            }\n            return blobContainer;\n        }\n\n        public bool ExistsUploadFile(Session session)\n        {\n            var journalFile = new FileInfo(this.GetJournalFileForSession(session.LocalRecordingFolderPath));","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/microsoft/ailab/blob/89fe2fc62081145ec5408d42059cbcb7c4a033c8/VirtualStage/Speaker.Recorder/Speaker.Recorder/Services/UploadManager.cs#L32-L68","documentation":"UploadManager.InitializeContainerAsync reads the Azure Blob connection string from configuration (Data:AzureBlobConnection) and calls CloudStorageAccount.Parse during startup; this validation guard fires when that string cannot be parsed into a valid storage account — i.e. the configuration key is missing, empty, or malformed, so no blob container can be initialized for uploads.","triggerScenarios":"Thrown at VirtualStage/Speaker.Recorder/Speaker.Recorder/Services/UploadManager.cs:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the Data:AzureBlobConnection value in appsettings.json/environment to a full 'DefaultEndpointsProtocol=...;AccountName=...;AccountKey=...' connection string","Use CloudStorageAccount.TryParse and fail fast with a clear startup message when configuration is absent","Validate configuration at application start (IStartupFilter or options validation) so misconfiguration is caught before uploads are attempted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89fe2fc62081145ec5408d42059cbcb7c4a033c8","analyzedAt":"2026-09-13T20:10:53.835Z","contentChangedAt":"2026-09-13T20:10:53.835Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}