Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
[assembly: System.Reflection.AssemblyVersionAttribute("2.11.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]


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.
2 changes: 1 addition & 1 deletion src/Migrate/Migrate.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ input-file:
- $(repo)/specification/migrate/resource-manager/Microsoft.OffAzure/stable/2020-01-01/migrate.json
- $(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


module-version: 3.0.14
title: Migrate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "replicationFabrics",
"apiVersion": "2024-09-01",
"apiVersion": "2026-02-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.migrate"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# region Generated
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Migrate.private.dll')
$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'
Comment on lines +3 to +6
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.
if(Test-Path $internalModulePath) {
$null = Import-Module -Name $internalModulePath
}
Expand Down
2 changes: 1 addition & 1 deletion src/Migrate/Migrate.Autorest/custom/AzLocalDiskInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;

namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201
{
public class AzLocalDiskInput
{
Expand Down
2 changes: 1 addition & 1 deletion src/Migrate/Migrate.Autorest/custom/AzLocalNicInput.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201
{
public class AzLocalNicInput
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Get-AzMigrateLocalJob {
* See all possible breaking changes at https://go.microsoft.com/fwlink/?linkid=2333486 *`n
***************************************************************************************************")]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.IJobModel])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.IJobModel])]
[CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
param(
[Parameter(ParameterSetName = 'GetById', Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Get-AzMigrateLocalServerReplication {
* See all possible breaking changes at https://go.microsoft.com/fwlink/?linkid=2333486 *`n
***************************************************************************************************")]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.IProtectedItemModel])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.IProtectedItemModel])]
[CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
param(
[Parameter(ParameterSetName = 'GetByItemID', Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,12 @@ function Initialize-AzMigrateLocalReplicationInfrastructure {
}

# Setup Policy deployment parameters
$policyProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.PolicyModelProperties]::new()
$policyProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.PolicyModelProperties]::new()
if ($instanceType -eq $AzLocalInstanceTypes.HyperVToAzLocal) {
$policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHcipolicyModelCustomProperties]::new()
$policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHcipolicyModelCustomProperties]::new()
}
elseif ($instanceType -eq $AzLocalInstanceTypes.VMwareToAzLocal) {
$policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHcipolicyModelCustomProperties]::new()
$policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHcipolicyModelCustomProperties]::new()
}
else {
throw "Instance type '$($instanceType)' is not supported. Currently, for AzLocal scenario, only HyperV and VMware as the source is supported."
Expand Down Expand Up @@ -1133,15 +1133,15 @@ function Initialize-AzMigrateLocalReplicationInfrastructure {
}

# Setup Replication Extension deployment parameters
$replicationExtensionProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.ReplicationExtensionModelProperties]::new()
$replicationExtensionProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.ReplicationExtensionModelProperties]::new()

if ($instanceType -eq $AzLocalInstanceTypes.HyperVToAzLocal) {
$replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHcireplicationExtensionModelCustomProperties]::new()
$replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHcireplicationExtensionModelCustomProperties]::new()
$replicationExtensionCustomProperties.HyperVFabricArmId = $params.SourceFabricArmId

}
elseif ($instanceType -eq $AzLocalInstanceTypes.VMwareToAzLocal) {
$replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHcireplicationExtensionModelCustomProperties]::new()
$replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHcireplicationExtensionModelCustomProperties]::new()
$replicationExtensionCustomProperties.VMwareFabricArmId = $params.SourceFabricArmId
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocaldiskm
#>
function New-AzMigrateLocalDiskMappingObject {
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalDiskInput])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalDiskInput])]
[CmdletBinding(PositionalBinding = $false)]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -80,7 +80,7 @@ function New-AzMigrateLocalDiskMappingObject {
throw "PhysicalSectorSize must be 512 for VHD format but $PhysicalSectorSize is given."
}

$DiskObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalDiskInput]::new(
$DiskObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalDiskInput]::new(
$DiskID,
$isDynamicDisk,
$Size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocalnicma
#>
function New-AzMigrateLocalNicMappingObject {
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalNicInput])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalNicInput])]
[CmdletBinding(PositionalBinding = $false)]
param(
[Parameter(Mandatory)]
Expand Down Expand Up @@ -70,7 +70,7 @@ function New-AzMigrateLocalNicMappingObject {
$selectionTypeForFailover = $VMNicSelection.NotSelected
}

$NicObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalNicInput]::new(
$NicObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalNicInput]::new(
$NicID,
$TargetVirtualSwitchId,
$TargetTestVirtualSwitchId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocalserve
#>
function New-AzMigrateLocalServerReplication {
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.IJobModel])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.IJobModel])]
[CmdletBinding(DefaultParameterSetName = 'ByIdDefaultUser', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)]
Expand Down Expand Up @@ -65,6 +65,14 @@ function New-AzMigrateLocalServerReplication {
# Specifies if RAM is dynamic or not.
${IsDynamicMemoryEnabled},

[Parameter()]
[ValidateSet("true" , "false")]
[ArgumentCompleter( { "true" , "false" })]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
Comment on lines +69 to +72
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.
# Specifies whether the VM should be migrated as an Arc VM.
${MigrateAsArcVM},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.Int64]
Expand All @@ -73,13 +81,13 @@ function New-AzMigrateLocalServerReplication {

[Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalDiskInput[]]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalDiskInput[]]
# Specifies the disks on the source server to be included for replication.
${DiskToInclude},

[Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.AzLocalNicInput[]]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.AzLocalNicInput[]]
# Specifies the NICs on the source server to be included for replication.
${NicToInclude},

Expand Down Expand Up @@ -185,6 +193,10 @@ function New-AzMigrateLocalServerReplication {
if ($HasIsDynamicMemoryEnabled) {
$isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled)
}
$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.
}
$HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam')
$HasTargetVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetVirtualSwitchId')
$HasTargetTestVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId')
Expand All @@ -198,6 +210,7 @@ function New-AzMigrateLocalServerReplication {
$null = $PSBoundParameters.Remove('TargetVirtualSwitchId')
$null = $PSBoundParameters.Remove('TargetTestVirtualSwitchId')
$null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled')
$null = $PSBoundParameters.Remove('MigrateAsArcVM')
$null = $PSBoundParameters.Remove('TargetVMRam')
$null = $PSBoundParameters.Remove('DiskToInclude')
$null = $PSBoundParameters.Remove('NicToInclude')
Expand Down Expand Up @@ -633,16 +646,16 @@ function New-AzMigrateLocalServerReplication {
}

# Construct create protected item request object
$protectedItemProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.ProtectedItemModelProperties]::new()
$protectedItemProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.ProtectedItemModelProperties]::new()
$protectedItemProperties.PolicyName = $policyName
$protectedItemProperties.ReplicationExtensionName = $replicationExtensionName

if ($SiteType -eq $SiteTypes.HyperVSites) {
$customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHCIProtectedItemModelCustomProperties]::new()
$customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHciprotectedItemModelCustomProperties]::new()
$isSourceDynamicMemoryEnabled = $machine.IsDynamicMemoryEnabled
}
elseif ($SiteType -eq $SiteTypes.VMwareSites) {
$customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHCIProtectedItemModelCustomProperties]::new()
$customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHciprotectedItemModelCustomProperties]::new()
$isSourceDynamicMemoryEnabled = $false
}

Expand All @@ -658,6 +671,9 @@ function New-AzMigrateLocalServerReplication {
$customProperties.TargetResourceGroupId = $TargetResourceGroupId
$customProperties.TargetVMName = $TargetVMName
$customProperties.IsDynamicRam = if ($HasIsDynamicMemoryEnabled) { $isDynamicRamEnabled } else { $isSourceDynamicMemoryEnabled }
if ($HasMigrateAsArcVM) {
$customProperties.MigrateAsArcVM = $migrateAsArcVMEnabled
}
Comment on lines +674 to +676
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.


# Determine target VM Hyper-V Generation
if ($SiteType -eq $SiteTypes.HyperVSites) {
Expand Down Expand Up @@ -710,7 +726,7 @@ function New-AzMigrateLocalServerReplication {
}

# Construct default dynamic memory config
$memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.ProtectedItemDynamicMemoryConfig]::new()
$memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.ProtectedItemDynamicMemoryConfig]::new()
$memoryConfig.MinimumMemoryInMegaByte = [System.Math]::Min($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMinDynamicMemoryInMB)
$memoryConfig.MaximumMemoryInMegaByte = [System.Math]::Max($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMaxDynamicMemoryInMB)
$memoryConfig.TargetMemoryBufferPercentage = $RAMConfig.DefaultTargetMemoryBufferPercentage
Expand Down Expand Up @@ -835,12 +851,12 @@ function New-AzMigrateLocalServerReplication {
}

if ($SiteType -eq $SiteTypes.HyperVSites) {
$customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHCIDiskInput[]]$disks
$customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.HyperVToAzStackHCINicInput[]]$nics
$customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHcidiskInput[]]$disks
$customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.HyperVToAzStackHcinicInput[]]$nics
}
elseif ($SiteType -eq $SiteTypes.VMwareSites) {
$customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHCIDiskInput[]]$disks
$customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.VMwareToAzStackHCINicInput[]]$nics
$customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHcidiskInput[]]$disks
$customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20260201.VMwareToAzStackHcinicInput[]]$nics
}

$protectedItemProperties.CustomProperty = $customProperties
Expand Down
Loading
Loading