fix: validate location config before endpoint registration and deletion#281
Open
sellakumaran wants to merge 4 commits intomainfrom
Open
fix: validate location config before endpoint registration and deletion#281sellakumaran wants to merge 4 commits intomainfrom
sellakumaran wants to merge 4 commits intomainfrom
Conversation
Users with needDeployment:false do not require location in a365.config.json, but the endpoint registration API (both create and delete) requires the Location field. This caused a confusing BadRequest from the server when location was empty. Add early guards in BotConfigurator.CreateEndpointWithAgentBlueprintAsync and DeleteEndpointWithAgentBlueprintAsync that return a clear error message before making the API call. Add a matching guard in CleanupCommand.DeleteMessagingEndpointAsync so the error surfaces at the command layer with actionable instructions. Update CleanupBlueprint_WithEndpointOnlyAndInvalidLocation test to assert the corrected behavior: the API must not be called when location is missing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Enforce presence of the location field for Bot Framework endpoint registration and deletion, including for external hosting scenarios. - Added LocationRequirementCheck and integrated it into requirements validation. - Updated commands and BotConfigurator to check for missing location and provide clear, actionable error messages. - Centralized error messages for location requirements. - Improved IBotConfigurator documentation regarding location. - Added and updated unit tests to cover location validation logic.
…ess of needDeployment For external hosting (needDeployment: false), the wizard was silently deriving location from the resource group without asking the user. The Bot Framework endpoint registration API requires location in all cases, so the wizard now explicitly prompts for it in both paths, matching the same interactive region-selection UX used for new app service plans. Also removes the dead PromptForLocation(AzureAccountInfo) overload that was never called. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the Agent 365 CLI by adding comprehensive validation for the required location configuration field before attempting Bot Framework endpoint registration or deletion operations. The changes prevent unhelpful API errors by validating location early in the command flow and providing clear, actionable error messages with configuration guidance.
Changes:
- Added pre-call validation guards in
BotConfigurator,BlueprintSubcommand, andCleanupCommandto check for location before making API calls - Introduced
LocationRequirementCheckto the requirements subcommand for proactive configuration validation - Updated configuration wizard to always prompt for location, even for external hosting scenarios, with contextual messaging
- Standardized error messages using new
ErrorMessagesconstants for consistent user guidance across the CLI
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
LocationRequirementCheckTests.cs |
New test file validating location requirement check for both Azure and external hosting scenarios |
BotConfiguratorTests.cs |
Added tests verifying empty location strings prevent API calls in create/delete endpoint methods |
PublishCommandTests.cs |
Removed tests requiring interactive prompts; updated documentation comments for maintainability |
CleanupCommandTests.cs |
Updated test to verify location guard prevents API calls when location is missing |
BlueprintSubcommandTests.cs |
Added location field to test configs to satisfy new validation requirement |
LocationRequirementCheck.cs |
New requirement check validating location configuration with clear error messages |
IBotConfigurator.cs |
Added XML documentation for location parameter requirements in both create/delete methods |
ConfigurationWizardService.cs |
Updated wizard to always prompt for location with contextual messages for external hosting; removed duplicate method |
BotConfigurator.cs |
Added location validation guards returning early if location is null/whitespace |
ErrorMessages.cs |
Added new constants for location validation errors with consistent guidance messages |
RequirementsSubcommand.cs |
Added LocationRequirementCheck to requirements validation list |
BlueprintSubcommand.cs |
Added location validation before endpoint registration with early-exit pattern |
CleanupCommand.cs |
Added location validation with defense-in-depth approach before endpoint deletion |
src/Microsoft.Agents.A365.DevTools.Cli/Services/ConfigurationWizardService.cs
Outdated
Show resolved
Hide resolved
… lines Address PR #281 review comment: the closing brace of the else block and the Step 7 comment were improperly merged onto a single line with incorrect spacing. Split them into separate lines with proper indentation for readability. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds robust validation and improved user guidance for the required
locationfield in the Agent 365 CLI, especially for Bot Framework endpoint registration and deletion. It ensures that all relevant commands and services check for a configured location before attempting API calls, provides clear error messages and guidance if missing, and introduces a requirement check for location configuration. The changes also update tests to reflect the new validation logic.Validation and User Guidance Improvements:
locationfield in both endpoint registration and deletion flows inCleanupCommand,BlueprintSubcommand, andBotConfigurator, displaying clear error messages and usage guidance if missing. [1] [2] [3] [4] [5]ErrorMessagesfor missing or required location scenarios, including examples and context for both Azure and external hosting.Configuration and Requirement Checks:
LocationRequirementCheckto the requirements subcommand, ensuring the location is configured before proceeding with endpoint registration. [1] [2]API and Interface Consistency:
locationparameter requirements inIBotConfigurator, ensuring consumers are aware that API calls will not proceed without a valid location.Testing and Validation:
Closed #280