Skip to content

Bernard migrate migrate to autorest v4#28721

Open
Pan-Qi wants to merge 16 commits intomainfrom
bernard-migrate-migrate-to-autorest-v4
Open

Bernard migrate migrate to autorest v4#28721
Pan-Qi wants to merge 16 commits intomainfrom
bernard-migrate-migrate-to-autorest-v4

Conversation

@Pan-Qi
Copy link
Copy Markdown
Contributor

@Pan-Qi Pan-Qi commented Oct 20, 2025

Description

Preannouncement PR: #29131

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@Pan-Qi Pan-Qi added autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 Contains Breaking Change This PR contains breaking change labels Oct 27, 2025
@github-actions
Copy link
Copy Markdown

To the author of the pull request,
This PR was labeled "Contains Breaking Change" because breaking changes have been detected by the static analysis pipeline.

  • According to our policy, breaking changes can only take place during major release and they must be preannounced.
  • Please follow our guide on the detailed steps.
  • Required: Please fill in the task below to facilitate our contact,you will receive notifications related to breaking changes.

@minhsuanlee
Copy link
Copy Markdown
Contributor

@Pan-Qi Once #28869 merges to main, please take those changes here in this PR too. Thank you.

JoyerJin and others added 3 commits November 24, 2025 16:21
Fix error: Expression of type 'System.Management.Automation.ErrorRecord' cannot be used for assignment to type 'Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IEnableMigrationInput'
Copilot AI review requested due to automatic review settings January 23, 2026 00:10
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

This PR migrates the Az.Migrate module from AutoRest v3 to AutoRest v4. The changes primarily involve:

Changes:

  • Updated type namespaces from versioned API-specific namespaces (e.g., Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20250801.*) to non-versioned namespaces (e.g., Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.*)
  • Regenerated help documentation files to reflect the namespace changes
  • Updated AutoRest configuration in README.md to use AutoRest v4
  • Added new cmdlet Update-AzMigrateReplicationProtectionCluster
  • Fixed a typo in Restart-AzMigrateServerReplication.md ("replcating" → "replicating")

Reviewed changes

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

Show a summary per file
File Description
src/Migrate/Migrate/ChangeLog.md Added changelog entry for AutoRest v4 migration
src/Migrate/Migrate/Az.Migrate.psd1 Updated module manifest with new cmdlet and generation date
src/Migrate/Migrate/help/*.md Updated help documentation with simplified type names
src/Migrate/Migrate.Autorest/custom/*.ps1 Updated PowerShell scripts to use non-versioned namespaces
src/Migrate/Migrate.Autorest/custom/*.cs Updated C# custom classes with new namespaces
src/Migrate/Migrate.Autorest/test/*.ps1 Updated test files with new type references
src/Migrate/Migrate.Autorest/README.md Updated AutoRest configuration and directives
src/Migrate/Migrate.sln Updated project GUID

- Additional information about change #1
-->
## Upcoming Release
* Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249).
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The ChangeLog entry needs more detail. According to the coding guidelines (CodingGuidelineID: 1000003), changelog entries should be written from the user's perspective and explain what changed and how it affects their usage. The current entry is too vague with just a link. Please add specific details about what improvements were made and what breaking changes users should expect.

Copilot generated this review using guidance from repository custom instructions.
Copilot AI review requested due to automatic review settings January 29, 2026 07:59
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

Copilot reviewed 162 out of 172 changed files in this pull request and generated no new comments.

@JiaSeng-v JiaSeng-v marked this pull request as ready for review January 30, 2026 03:41
Copilot AI review requested due to automatic review settings January 30, 2026 03:41
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

Copilot reviewed 159 out of 169 changed files in this pull request and generated no new comments.

@prsadhu-ms-idc
Copy link
Copy Markdown

  • Added new cmdlet Update-AzMigrateReplicationProtectionCluster

Why was this added?

@prsadhu-ms-idc
Copy link
Copy Markdown

Changes look good. In some files, like e.g. https://github.com/Azure/azure-powershell/pull/28721/changes#diff-58ae8c9b84dbd0266820cddfd30b7356ae7609d91b2ef04ab3cf4a5821731837, subscriptionId handling has been explicitly added, where as in other files it has not been. In what scenarios is this change needed?

- from: Microsoft.RecoveryServices/SiteRecovery/stable/2025-08-01/service.json
where:
verb: Invoke$
subject: ^ResyncReplicationMigrationItem
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ResyncReplicationMigrationItem is mentioned above as well, can we not add the new variant in above line ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok I had removed the duplicate variant from it

- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
verb: Remove
subject: VCenterVcenter
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think the spelling of subject is correct. VCenter is mentioned in next block as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this one is to remove a file that was generated wrongly, this block cannot be removed

suppress-format: true
- where:
verb: Update
subject: ReplicationProtectionCluster
Copy link
Copy Markdown

@prsadhu-ms-idc prsadhu-ms-idc Feb 2, 2026

Choose a reason for hiding this comment

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

This is removing the cmdlet, but in comments it's said added.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yup this is removing the cmdlet, which I followed up with Abhishek to confirm this cmdlet is not needed.

Copilot AI review requested due to automatic review settings February 3, 2026 02:42
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

Copilot reviewed 159 out of 169 changed files in this pull request and generated no new comments.

@JiaSeng-v JiaSeng-v added autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 and removed autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 labels Feb 4, 2026
@JiaSeng-v
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings March 30, 2026 08:43
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

Copilot reviewed 153 out of 163 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (8)

src/Migrate/Migrate.Autorest/test/Set-AzMigrateServerReplication.Tests.ps1:1

  • Get-AzMigrateServerReplication is being called with -SqlServerLicenseType, which appears to be a parameter for Set-AzMigrateServerReplication, not Get-AzMigrateServerReplication. This will fail parameter binding at runtime. Remove -SqlServerLicenseType from the GET call (keep it on the SET call), or switch to the correct cmdlet/parameter if the intent was different.
    src/Migrate/Migrate.Autorest/test/Remove-AzMigrateProject.Recording.json:1
  • The committed HTTP recordings contain tenantId/objectId and other identifying metadata in headers. Even if not secrets, these are environment-identifying and typically should be sanitized/filtered consistently (similar to Authorization). Consider adding these header fields to the recording sanitizer (or removing them from recorded output) to avoid leaking tenant/user identifiers and to reduce churn across re-recordings.
    src/Migrate/Migrate.Autorest/test/utils.ps1:1
  • The test environment setup hardcodes specific subscription/resource IDs and resource group names. This makes tests brittle for other developers/CI environments and increases the chance of committing environment-specific identifiers. Prefer loading these values from localEnv.json/pipeline variables (and/or using sanitized placeholders for recordings) so tests can be replayed/recorded consistently across environments.
    tools/StaticAnalysis/Exceptions/Az.Migrate/ExampleIssues.csv:1
  • This exceptions CSV contains machine/agent-specific absolute paths (e.g., D:\\a\\_work\\...) and also includes duplicated exception rows (e.g., Get-AzMigrateLocalJob appears twice). To keep the exception list stable across environments, store only repo-relative paths (or omit Extent paths if allowed by the tooling) and deduplicate identical entries.
    tools/StaticAnalysis/Exceptions/Az.Migrate/ExampleIssues.csv:1
  • This exceptions CSV contains machine/agent-specific absolute paths (e.g., D:\\a\\_work\\...) and also includes duplicated exception rows (e.g., Get-AzMigrateLocalJob appears twice). To keep the exception list stable across environments, store only repo-relative paths (or omit Extent paths if allowed by the tooling) and deduplicate identical entries.
    src/Migrate/Migrate.Autorest/test/Update-AzMigrateReplicationProtectionCluster.Tests.ps1:1
  • All tests for Update-AzMigrateReplicationProtectionCluster are currently skipped and contain only NotImplementedException placeholders. If this cmdlet is part of the v4 migration surface, please replace these with at least one real test (playback/mock or LiveOnly) that validates parameter binding and a successful response shape; otherwise, consider removing the placeholder test file to avoid giving a false sense of coverage.
    src/Migrate/Migrate.Autorest/test/Update-AzMigrateReplicationProtectionCluster.Tests.ps1:1
  • All tests for Update-AzMigrateReplicationProtectionCluster are currently skipped and contain only NotImplementedException placeholders. If this cmdlet is part of the v4 migration surface, please replace these with at least one real test (playback/mock or LiveOnly) that validates parameter binding and a successful response shape; otherwise, consider removing the placeholder test file to avoid giving a false sense of coverage.
    src/Migrate/Migrate/help/Get-AzMigrateSite.md:1
  • The help shows three near-identical identity parameter sets (SubscriptionInputObject, Subscription1InputObject, Subscription2InputObject), which is confusing for users and suggests a generation/config issue. Consider consolidating these into a single identity parameter set (one ...InputObject parameter) or adjusting the AutoRest configuration so only the intended variant(s) are emitted and documented.

Comment on lines +25 to 27
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.ModelCmdletAttribute()]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareCbtNicInput])]
[CmdletBinding(DefaultParameterSetName = 'VMwareCbt', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The file name includes a trailing space (New-AzMigrateTestNicMapping .ps1). This is error-prone on different shells/OSes and can break module packaging/import and build scripts. Rename the file to remove the trailing space and ensure any references/manifests point to the corrected path.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +14
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This file lives under custom/, but the header states it is code-generated and will be lost if regenerated. If this is intended to be a hand-maintained customization layer, this header is misleading; update it to reflect the file’s ownership (custom vs generated) to prevent accidental overwrites or confusion during regeneration.

Suggested change
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# This file resides in the 'custom' folder and is intended to be hand-maintained
# as part of the Azure Migrate PowerShell customization layer. It will not be
# overwritten by AutoRest code generation.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 Contains Breaking Change This PR contains breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants