Skip to content

Add new support for Az.Migrate module for API versioning 2026-02-01#29333

Draft
anhdinh-msft wants to merge 3 commits intoAzure:mainfrom
anhdinh-msft:user/anhdinh/new-azmigrate-ps-module
Draft

Add new support for Az.Migrate module for API versioning 2026-02-01#29333
anhdinh-msft wants to merge 3 commits intoAzure:mainfrom
anhdinh-msft:user/anhdinh/new-azmigrate-ps-module

Conversation

@anhdinh-msft
Copy link
Copy Markdown
Member

Description

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

Copilot AI review requested due to automatic review settings March 27, 2026 20:41
@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.

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

Updates the Az.Migrate module to use the Microsoft.DataReplication API version 2026-02-01, regenerating models/help and introducing a new -MigrateAsArcVM option for local server replication.

Changes:

  • Bumps model/documentation types from Api20240901 to Api20260201 across cmdlets and help/docs.
  • Adds -MigrateAsArcVM parameter to New-AzMigrateLocalServerReplication and flows it into request custom properties.
  • Updates generation/config metadata (solution/project GUID, generate-info, UX apiVersion, docs/help paths).

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/Migrate/Migrate/help/Start-AzMigrateLocalServerMigration.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/Set-AzMigrateLocalServerReplication.md Updates parameter/output model types to Api20260201 in help.
src/Migrate/Migrate/help/Remove-AzMigrateLocalServerReplication.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/New-AzMigrateLocalServerReplication.md Updates types and documents new -MigrateAsArcVM parameter.
src/Migrate/Migrate/help/New-AzMigrateLocalNicMappingObject.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/New-AzMigrateLocalDiskMappingObject.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/Get-AzMigrateLocalServerReplication.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/Get-AzMigrateLocalReplicationFabric.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/help/Get-AzMigrateLocalJob.md Updates output model type to Api20260201 in help.
src/Migrate/Migrate/Az.Migrate.psd1 Regeneration timestamp update.
src/Migrate/Migrate.sln Updates Az.Migrate project GUID mapping in solution.
src/Migrate/Migrate.Autorest/test/README.md Normalizes relative path wording to ../custom.
src/Migrate/Migrate.Autorest/resources/README.md Normalizes relative path wording to ../custom.
src/Migrate/Migrate.Autorest/generate-info.json Updates generation id metadata.
src/Migrate/Migrate.Autorest/docs/Start-AzMigrateLocalServerMigration.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Set-AzMigrateLocalServerReplication.md Updates parameter/output model types to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateLocalServerReplication.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/README.md Normalizes relative doc links to ../....
src/Migrate/Migrate.Autorest/docs/New-AzMigrateLocalServerReplication.md Updates types and documents new -MigrateAsArcVM parameter.
src/Migrate/Migrate.Autorest/docs/New-AzMigrateLocalNicMappingObject.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/New-AzMigrateLocalDiskMappingObject.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Get-AzMigrateLocalServerReplication.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Get-AzMigrateLocalReplicationFabric.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Get-AzMigrateLocalJob.md Updates output model type to Api20260201 in docs.
src/Migrate/Migrate.Autorest/docs/Az.Migrate.md Updates module GUID in generated docs.
src/Migrate/Migrate.Autorest/custom/Start-AzMigrateLocalServerMigration.ps1 Updates model instantiations/output type to Api20260201.
src/Migrate/Migrate.Autorest/custom/Set-AzMigrateLocalServerReplication.ps1 Updates model types/casts to Api20260201.
src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateLocalServerReplication.ps1 Updates output type to Api20260201.
src/Migrate/Migrate.Autorest/custom/README.md Normalizes relative doc links to ../....
src/Migrate/Migrate.Autorest/custom/New-AzMigrateLocalServerReplication.ps1 Adds -MigrateAsArcVM and updates model types/casts to Api20260201.
src/Migrate/Migrate.Autorest/custom/New-AzMigrateLocalNicMappingObject.ps1 Updates output type and constructed type to Api20260201.
src/Migrate/Migrate.Autorest/custom/New-AzMigrateLocalDiskMappingObject.ps1 Updates output type and constructed type to Api20260201.
src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateLocalReplicationInfrastructure.ps1 Updates model instantiations to Api20260201.
src/Migrate/Migrate.Autorest/custom/Get-AzMigrateLocalServerReplication.ps1 Updates output type to Api20260201.
src/Migrate/Migrate.Autorest/custom/Get-AzMigrateLocalJob.ps1 Updates output type to Api20260201.
src/Migrate/Migrate.Autorest/custom/AzLocalNicInput.cs Moves custom model namespace to Api20260201.
src/Migrate/Migrate.Autorest/custom/AzLocalDiskInput.cs Moves custom model namespace to Api20260201.
src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1 Switches to ../... paths for module imports.
src/Migrate/Migrate.Autorest/UX/Microsoft.DataReplication/replicationFabrics.json Bumps UX apiVersion to 2026-02-01.
src/Migrate/Migrate.Autorest/README.md Updates DataReplication spec input-file reference to 2026-02-01.
src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs Adds trailing blank lines.

- $(repo)/specification/migrateprojects/resource-manager/Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
- $(repo)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/SiteRecovery/stable/2025-08-01/service.json
- $(repo)/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/DataReplication/stable/2024-09-01/recoveryservicesdatareplication.json
- /azure-rest-api-specs-pr/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/DataReplication/stable/2026-02-01/recoveryservicesdatareplication.json
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The input-file entry is now an absolute path (/azure-rest-api-specs-pr/...), which will break Autorest generation in other environments/agents. Use the repo-relative form consistent with the other entries (e.g., $(repo)/specification/.../2026-02-01/...json) so generation is portable.

Suggested change
- /azure-rest-api-specs-pr/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/DataReplication/stable/2026-02-01/recoveryservicesdatareplication.json
- $(repo)/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/DataReplication/stable/2026-02-01/recoveryservicesdatareplication.json

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Only local testing for now. Will update back to $(repo) once the new spec is checked in


if ($SiteType -eq $SiteTypes.HyperVSites) {
$customPropertiesUpdate = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate]::new()
$customPropertiesUpdate = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHciprotectedItemModelCustomPropertiesUpdate]::new()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

These Api20260201 type names look malformed (notably the casing/word breaks like HciprotectedItem... and HcinicInput). If the generated model types are actually HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate / HyperVToAzStackHCINicInput, the current literals will fail type resolution at runtime. Update the type literals/casts to match the exact generated type names in the Api20260201 assembly.

Copilot uses AI. Check for mistakes.
}
elseif ($SiteType -eq $SiteTypes.VMwareSites) {
$customPropertiesUpdate = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate]::new()
$customPropertiesUpdate = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHciprotectedItemModelCustomPropertiesUpdate]::new()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

These Api20260201 type names look malformed (notably the casing/word breaks like HciprotectedItem... and HcinicInput). If the generated model types are actually HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate / HyperVToAzStackHCINicInput, the current literals will fail type resolution at runtime. Update the type literals/casts to match the exact generated type names in the Api20260201 assembly.

Copilot uses AI. Check for mistakes.
Comment on lines +333 to +336
$customPropertiesUpdate.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHcinicInput[]]$nics
}
elseif ($SiteType -eq $SiteTypes.VMwareSites) {
$customPropertiesUpdate.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHCINicInput[]]$nics
$customPropertiesUpdate.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHcinicInput[]]$nics
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

These Api20260201 type names look malformed (notably the casing/word breaks like HciprotectedItem... and HcinicInput). If the generated model types are actually HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate / HyperVToAzStackHCINicInput, the current literals will fail type resolution at runtime. Update the type literals/casts to match the exact generated type names in the Api20260201 assembly.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.Migrate.private.dll')

# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Migrate.internal.psm1'
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.Migrate.internal.psm1'
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Using Join-Path with a single child argument that already contains ../ and forward slashes is less robust than passing path segments (e.g., Join-Path $PSScriptRoot '..' 'bin' 'Az.Migrate.private.dll'). Splitting into segments improves cross-platform path normalization and avoids edge cases with separator handling.

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +72
[ValidateSet("true" , "false")]
[ArgumentCompleter( { "true" , "false" })]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

-MigrateAsArcVM is modeled as a string constrained to true/false, then converted to boolean. For PowerShell UX and pipeline correctness, prefer a [switch] (or [bool]) parameter instead of a string+ValidateSet; it simplifies invocation (-MigrateAsArcVM or -MigrateAsArcVM:$false) and removes the need for manual conversion.

Suggested change
[ValidateSet("true" , "false")]
[ArgumentCompleter( { "true" , "false" })]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[switch]

Copilot uses AI. Check for mistakes.
}
$HasMigrateAsArcVM = $PSBoundParameters.ContainsKey('MigrateAsArcVM')
if ($HasMigrateAsArcVM) {
$migrateAsArcVMEnabled = [System.Convert]::ToBoolean($MigrateAsArcVM)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

-MigrateAsArcVM is modeled as a string constrained to true/false, then converted to boolean. For PowerShell UX and pipeline correctness, prefer a [switch] (or [bool]) parameter instead of a string+ValidateSet; it simplifies invocation (-MigrateAsArcVM or -MigrateAsArcVM:$false) and removes the need for manual conversion.

Suggested change
$migrateAsArcVMEnabled = [System.Convert]::ToBoolean($MigrateAsArcVM)
$migrateAsArcVMEnabled = $MigrateAsArcVM

Copilot uses AI. Check for mistakes.
Comment on lines +674 to +676
if ($HasMigrateAsArcVM) {
$customProperties.MigrateAsArcVM = $migrateAsArcVMEnabled
}
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

New behavior is introduced by conditionally setting CustomProperty.MigrateAsArcVM. Add/update Pester coverage to assert the request payload sets (and omits) MigrateAsArcVM correctly based on the parameter, including validation/conversion behavior.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call, will look into adding unit tests.

Comment on lines +27 to +28


Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

There are trailing blank lines at the end of the file. Please remove them to keep generated metadata files stable and reduce unnecessary diffs.

Suggested change

Copilot uses AI. Check for mistakes.
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 27, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@anhdinh-msft
Copy link
Copy Markdown
Member Author

@microsoft-github-policy-service agree company="Microsoft"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants