diff --git a/src/commands/appSettings/connectionSettings/durableTaskScheduler/custom/DTSConnectionCustomPromptStep.ts b/src/commands/appSettings/connectionSettings/durableTaskScheduler/custom/DTSConnectionCustomPromptStep.ts index 830191e9b..7e576962f 100644 --- a/src/commands/appSettings/connectionSettings/durableTaskScheduler/custom/DTSConnectionCustomPromptStep.ts +++ b/src/commands/appSettings/connectionSettings/durableTaskScheduler/custom/DTSConnectionCustomPromptStep.ts @@ -20,11 +20,44 @@ export class DTSConnectionCustomPromptStep;Authentication="'); + } + + // Validate that the endpoint URL is properly formatted + const endpoint = endpointMatch[1]; + try { + const url = new URL(endpoint); + // Ensure it's using a valid protocol + if (!['http:', 'https:'].includes(url.protocol)) { + return localize('invalidDTSEndpointProtocol', 'DTS endpoint must use HTTP or HTTPS protocol. Found: {0}', url.protocol); + } + } catch (error) { + return localize('invalidDTSEndpointURL', 'DTS endpoint is not a valid URL: {0}', endpoint); + } + + // Check if the connection string contains an Authentication parameter with a non-empty value + const authMatch = connectionString.match(/Authentication=([^;]*)/); + if (!authMatch) { + return localize('missingDTSAuthentication', 'DTS connection string must contain an "Authentication=" parameter. Expected format: "Endpoint=;Authentication="'); + } + + // Validate that the Authentication parameter has a non-empty value + const authValue = authMatch[1]; + if (!authValue || authValue.trim() === '') { + return localize('emptyDTSAuthentication', 'DTS Authentication parameter cannot be empty. Expected format: "Endpoint=;Authentication="'); + } + return undefined; } }