Add new support for Az.Migrate module for API versioning 2026-02-01#29333
Add new support for Az.Migrate module for API versioning 2026-02-01#29333anhdinh-msft wants to merge 3 commits intoAzure:mainfrom
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
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
Api20240901toApi20260201across cmdlets and help/docs. - Adds
-MigrateAsArcVMparameter toNew-AzMigrateLocalServerReplicationand 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 |
There was a problem hiding this comment.
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.
| - /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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
| } | ||
| 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() |
There was a problem hiding this comment.
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.
| $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 |
There was a problem hiding this comment.
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.
| $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' |
There was a problem hiding this comment.
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.
| [ValidateSet("true" , "false")] | ||
| [ArgumentCompleter( { "true" , "false" })] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] | ||
| [System.String] |
There was a problem hiding this comment.
-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.
| [ValidateSet("true" , "false")] | |
| [ArgumentCompleter( { "true" , "false" })] | |
| [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] | |
| [System.String] | |
| [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] | |
| [switch] |
| } | ||
| $HasMigrateAsArcVM = $PSBoundParameters.ContainsKey('MigrateAsArcVM') | ||
| if ($HasMigrateAsArcVM) { | ||
| $migrateAsArcVMEnabled = [System.Convert]::ToBoolean($MigrateAsArcVM) |
There was a problem hiding this comment.
-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.
| $migrateAsArcVMEnabled = [System.Convert]::ToBoolean($MigrateAsArcVM) | |
| $migrateAsArcVMEnabled = $MigrateAsArcVM |
| if ($HasMigrateAsArcVM) { | ||
| $customProperties.MigrateAsArcVM = $migrateAsArcVMEnabled | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good call, will look into adding unit tests.
|
|
||
|
|
There was a problem hiding this comment.
There are trailing blank lines at the end of the file. Please remove them to keep generated metadata files stable and reduce unnecessary diffs.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@microsoft-github-policy-service agree company="Microsoft" |
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.