Skip to content

DI Refactor: Azure.Mcp.Tools.AzureMigrate#1909

Merged
conniey merged 5 commits intomainfrom
copilot/refactor-azuremigrate-dependency-injection
Mar 11, 2026
Merged

DI Refactor: Azure.Mcp.Tools.AzureMigrate#1909
conniey merged 5 commits intomainfrom
copilot/refactor-azuremigrate-dependency-injection

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

  • Inject IPlatformLandingZoneGuidanceService into GetGuidanceCommand via constructor
  • Inject IPlatformLandingZoneService and AzureMigrateProjectHelper into RequestCommand via constructor
  • Update HandleCreateMigrateProjectActionAsync to accept AzureMigrateProjectHelper as parameter
  • Update tests to pass services directly to command constructors
  • Add CHANGELOG entry for the DI refactor (with PR number 1909)
  • Replace null! in RequestCommandTests with a real AzureMigrateProjectHelper instance backed by mocked ISubscriptionService and ITenantService
Original prompt

This section details on the original issue you should resolve

<issue_title>DI Refactor: Azure.Mcp.Tools.AzureMigrate</issue_title>
<issue_description>## Summary

Refactor Azure.Mcp.Tools.AzureMigrate to use constructor dependency injection instead of resolving services via context.GetService<T>() in ExecuteAsync.

This is a sub-issue of #158.

Instructions

Follow the algorithm described in tools/di-refactor-plan.md with {ToolArea} = AzureMigrate.

An example PR is: #1815
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Azure.Mcp.Tools.AzureMigrate to use constructor DI DI Refactor: Azure.Mcp.Tools.AzureMigrate Mar 3, 2026
@akshayrohilla
Copy link
Copy Markdown
Contributor

@conniey - I've validated it. Is this still a WIP or has it been completed?

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
@conniey conniey marked this pull request as ready for review March 10, 2026 17:46
@conniey conniey requested review from a team and akshayrohilla as code owners March 10, 2026 17:46
@conniey conniey enabled auto-merge (squash) March 10, 2026 17:46
conniey
conniey previously approved these changes Mar 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Azure Migrate tool commands to use constructor dependency injection instead of resolving services from CommandContext during execution.

Changes:

  • Injected IPlatformLandingZoneGuidanceService into GetGuidanceCommand via constructor and removed context.GetService<T>() usage.
  • Injected IPlatformLandingZoneService and AzureMigrateProjectHelper into RequestCommand via constructor and adjusted helper usage accordingly.
  • Updated unit tests and added a server changelog entry for PR #1909.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.AzureMigrate/tests/Azure.Mcp.Tools.AzureMigrate.UnitTests/PlatformLandingZone/RequestCommandTests.cs Updates test construction of RequestCommand to pass DI dependencies directly.
tools/Azure.Mcp.Tools.AzureMigrate/tests/Azure.Mcp.Tools.AzureMigrate.UnitTests/PlatformLandingZone/GetGuidanceCommandTests.cs Updates test construction of GetGuidanceCommand to pass the injected guidance service.
tools/Azure.Mcp.Tools.AzureMigrate/src/Commands/PlatformLandingZone/RequestCommand.cs Switches RequestCommand to constructor injection and threads helper into create-project action handler.
tools/Azure.Mcp.Tools.AzureMigrate/src/Commands/PlatformLandingZone/GetGuidanceCommand.cs Switches GetGuidanceCommand to constructor injection and removes service resolution from context.
servers/Azure.Mcp.Server/changelog-entries/1773163668700.yaml Adds changelog entry documenting the DI refactor.

…pendencies in RequestCommandTests

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Hi @copilot. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates.

@github-actions github-actions Bot dismissed conniey’s stale review March 11, 2026 00:08

Hi @conniey. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates.

@conniey conniey merged commit c0ab5cf into main Mar 11, 2026
15 checks passed
@conniey conniey deleted the copilot/refactor-azuremigrate-dependency-injection branch March 11, 2026 00:12
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in Azure MCP Server Mar 11, 2026
@jongio jongio mentioned this pull request Apr 17, 2026
6 tasks
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 20, 2026
* Initial plan

* DI refactor: inject services via constructor in AzureMigrate commands

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>

* Add changelog entry for AzureMigrate DI refactor

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>

* Add PR number to changelog entry

Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

DI Refactor: Azure.Mcp.Tools.AzureMigrate

5 participants