diff --git a/src/Migrate/Migrate.Autorest/README.md b/src/Migrate/Migrate.Autorest/README.md
index d3a89f7ee618..8a9dd79f6d53 100644
--- a/src/Migrate/Migrate.Autorest/README.md
+++ b/src/Migrate/Migrate.Autorest/README.md
@@ -52,9 +52,10 @@ commit: 0dd49a444195fef7f3555cad038cb7665cbd928c
require:
- $(this-folder)/../../readme.azure.noprofile.md
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/stable/2023-01-01/service.json
+ - $(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/stable/2023-01-01/service.json
+ - $(repo)/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
module-version: 1.0.1
title: Migrate
@@ -105,6 +106,22 @@ directive:
- ProtectionContainerMappingProviderSpecificDetails
- MigrateProjectProperties
- FabricProperties
+ - FabricModelProperties
+ - FabricModelCustomProperties
+ - AzStackHCIFabricModelCustomProperties
+ - HyperVMigrateFabricModelCustomProperties
+ - VMwareMigrateFabricModelCustomProperties
+ - PolicyModelProperties
+ - ReplicationExtensionModelProperties
+ - ProtectedItemModelProperties
+ - ProtectedItemModelCustomProperties
+ - HyperVToAzStackHCIProtectedItemModelCustomProperties
+ - VMwareToAzStackHCIProtectedItemModelCustomProperties
+ - PlannedFailoverModelProperties
+ - WorkflowModelProperties
+ - WorkflowModelCustomProperties
+ - TaskModel
+ - TaskModelCustomProperties
# Remove variants not in scope
- from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
where:
@@ -224,10 +241,6 @@ directive:
verb: New$|Remove$|Update$
subject: ^Site
remove: true
- - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
- where:
- subject: ^HyperV
- remove: true
- from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
where:
subject: ^Job|^VMwareOperationsStatus
@@ -244,7 +257,12 @@ directive:
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
verb: Set$|Remove$|Update$
- subject: ^Solution|ProjectSummary$
+ subject: ProjectSummary$
+ remove: true
+ - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
+ where:
+ verb: Remove$|Update$
+ subject: ^Solution
remove: true
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
@@ -261,7 +279,7 @@ directive:
remove: true
- from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
where:
- subject: ^Commit|^Planned|^Renew|^Reprotect|^Unplanned|VaultHealth$|ComputeSize$|FabricConsistency$
+ subject: ^Commit|^Renew|^Reprotect|^Unplanned|VaultHealth$|ComputeSize$|FabricConsistency$
remove: true
- from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
where:
@@ -298,7 +316,74 @@ directive:
verb: New
subject: ^ReplicationVaultSetting|^SupportedOperatingSystem|^ReplicationProtectionIntent
remove: true
+ - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
+ where:
+ verb: Get
+ subject: ^HyperV(Cluster|Host|Job|OperationsStatus)$
+ remove: true
+ - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
+ where:
+ verb: Set
+ subject: ^HyperV(Cluster|Host)$
+ remove: true
+ - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
+ where:
+ verb: New|Remove|Update
+ subject: ^HyperV
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Test|Invoke
+ subject: NameAvailability$|DeploymentPreflight
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Get|New
+ subject: ^EmailConfiguration
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Get
+ subject: ^(Dra|ProtectedItem|Vault|Workflow)OperationStatus$
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Get
+ subject: ^FabricOperationsStatus$
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: New
+ subject: ^(Dra|Vault)
+ remove: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Update
+ subject: ^Vault
+ remove: true
+ - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
+ where:
+ verb: Invoke
+ subject: ^PlannedReplication
+ remove: true
+ # Rename cmdlets for AzStackHCI
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Get
+ subject: ^Fabric$
+ set:
+ subject: HCIReplicationFabric
# Hide cmldets used by custom
+ - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
+ where:
+ verb: Set$
+ subject: ^Solution
+ hide: true
+ - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
+ where:
+ verb: Get$
+ subject: ToAzureMigrate$
+ hide: true
- from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
where:
verb: Get$
@@ -344,6 +429,15 @@ directive:
verb: Resume$
subject: ^ReplicationMigrationItemReplication
hide: true
+ - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json
+ where:
+ subject: ^Planned
+ hide: true
+ - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
+ where:
+ verb: Get
+ subject: ^HyperV(Site|RunAsAccount)$
+ hide: true
# Hide cmdlets not to be visible to user.
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
@@ -373,6 +467,11 @@ directive:
verb: New$
variant: ^CreateViaIdentity
hide: true
+ - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json
+ where:
+ verb: Get$|Invoke$|New$|Remove$|Test$|Update$
+ subject: ^Dra|^Fabric|^Policy|^EmailConfiguration|^ProtectedItem|^ReplicationExtension|^Vault|^Workflow
+ hide: true
- where:
verb: New$|Set$|Update$
subject: Site$|VCenter$
diff --git a/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.cs b/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.cs
new file mode 100644
index 000000000000..779629268edc
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.cs
@@ -0,0 +1,40 @@
+// 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.Api20210216Preview
+{
+ public class AzStackHCIDiskInput
+ {
+ public AzStackHCIDiskInput(
+ string diskId,
+ bool isDynamic,
+ long diskSizeGB,
+ string diskFileFormat,
+ bool isOsDisk)
+ {
+ DiskId = diskId;
+ IsDynamic = isDynamic;
+ DiskSizeGb = diskSizeGB;
+ DiskFileFormat = diskFileFormat;
+ IsOSDisk = isOsDisk;
+ }
+
+ /// Gets or sets the type of the virtual hard disk, vhd or vhdx.
+ public string DiskFileFormat { get; set; }
+
+ /// Gets or sets the disk Id.
+ public string DiskId { get; set; }
+
+ /// Gets or sets the disk size in GB.
+ public long DiskSizeGb { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard
+ /// disk.
+ ///
+ public bool? IsDynamic { get; set; }
+
+ /// Gets or sets a value indicating whether disk is os disk.
+ public bool IsOSDisk { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs b/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs
new file mode 100644
index 000000000000..44929f7ddf97
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs
@@ -0,0 +1,32 @@
+// 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.Api20210216Preview
+{
+ public class AzStackHCINicInput
+ {
+ public AzStackHCINicInput(
+ string nicId,
+ string targetNetworkId,
+ string testNetworkId,
+ string selectionTypeForFailover)
+ {
+ NicId = nicId;
+ TargetNetworkId = targetNetworkId;
+ TestNetworkId = testNetworkId;
+ SelectionTypeForFailover = selectionTypeForFailover;
+ }
+
+ /// Gets or sets the NIC Id.
+ public string NicId { get; set; }
+
+ /// Gets or sets the target network Id within AzStackHCI Cluster.
+ public string TargetNetworkId { get; set; }
+
+ /// Gets or sets the target test network Id within AzStackHCI Cluster.
+ public string TestNetworkId { get; set; }
+
+ /// Gets or sets the selection type of the NIC.
+ public string SelectionTypeForFailover { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1
index 1dd26a2c2cf7..e0cb94cc8db0 100644
--- a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1
+++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1
@@ -23,8 +23,10 @@ https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscovered
#>
function Get-AzMigrateDiscoveredServer {
- [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])]
- [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+ [OutputType(
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine],
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])]
+ [CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param (
[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
@@ -38,30 +40,38 @@ function Get-AzMigrateDiscoveredServer {
# Specifies the resource group name.
${ResourceGroupName},
- [Parameter(ParameterSetName='Get', Mandatory)]
- [Parameter(ParameterSetName='GetInSite', Mandatory)]
+ [Parameter(ParameterSetName = 'Get', Mandatory)]
+ [Parameter(ParameterSetName = 'GetInSite', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
- # Specifies the VMware machine name. This is an internal Name. For users, use display name.
+ # Specifies the source machine name. This is an internal Name. For users, use display name.
${Name},
- [Parameter(ParameterSetName='List')]
- [Parameter(ParameterSetName='ListInSite')]
+ [Parameter(ParameterSetName = 'List')]
+ [Parameter(ParameterSetName = 'ListInSite')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
- # Specifies the VMware machine display name.
+ # Specifies the source machine display name.
${DisplayName},
- [Parameter(ParameterSetName='GetInSite', Mandatory)]
- [Parameter(ParameterSetName='ListInSite', Mandatory)]
+ [Parameter(ParameterSetName = 'GetInSite', Mandatory)]
+ [Parameter(ParameterSetName = 'ListInSite', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the appliance name. This internally maps to a site.
${ApplianceName},
[Parameter()]
+ [ValidateSet("VMware", "HyperV")]
+ [ArgumentCompleter( { "VMware", "HyperV" })]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
- [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Specifies the source machine type. Currently, only HyperV and VMware are supported.
+ ${SourceMachineType} = "VMware",
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
[System.String[]]
# Specifies the subscription id.
${SubscriptionId}
@@ -69,117 +79,159 @@ function Get-AzMigrateDiscoveredServer {
process {
$parameterSet = $PSCmdlet.ParameterSetName
+ $hasApplianceName = $PSBoundParameters.ContainsKey("ApplianceName")
$discoverySolutionName = "Servers-Discovery-ServerDiscovery"
- $discoverySolution = Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
- if ($discoverySolution.Name -ne $discoverySolutionName) {
+ $discoverySolution = Az.Migrate\Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
+ if ($discoverySolution.Name -ne $discoverySolutionName)
+ {
throw "Server Discovery Solution not found."
}
$appMap = @{}
- if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) {
+ if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"])
+ {
$appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
# Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map.
- foreach ($item in $appMapV2) {
+ foreach ($item in $appMapV2)
+ {
$appMap[$item.ApplianceName] = $item.SiteId
}
}
- if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) {
+ if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"])
+ {
$appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json
- foreach ($item in $appMapV3) {
+ foreach ($item in $appMapV3)
+ {
$t = $item.psobject.properties
$appMap[$t.Name] = $t.Value.SiteId
}
}
if ($null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] -And
- $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] ) {
+ $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] )
+ {
throw "Server Discovery Solution missing Appliance Details. Invalid Solution."
}
# Regex to match site name.
- $r = '(?<=/Microsoft.OffAzure/VMwareSites/).*$'
- $siteNameTmp = ""
- if ($parameterSet -match "Site") {
- #Fetch by site scenario. This is when site name filter is provided.
- $siteFound = 0
- foreach ($kvp in $appMap.GetEnumerator()) {
- if ($kvp.Key -eq $ApplianceName) {
- $siteArmId = $kvp.Value
- if ($siteArmId -match $r) {
- $siteNameTmp = $Matches[0]
- $siteFound = 1
- if ($parameterSet -eq 'GetInSite') {
- return Get-AzMigrateMachine -Name $Name -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId
- }
- elseif ($parameterSet -eq 'ListInSite') {
- $siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId
-
- if ($DisplayName) {
- $filteredMachines = $siteMachines | Where-Object {$_.DisplayName -match $DisplayName}
- return $filteredMachines
- }
- else {
- return $siteMachines
- }
- }
- }
+ if ($SourceMachineType -eq "VMware")
+ {
+ $siteRegex = "(?<=/Microsoft.OffAzure/VMwareSites/).*$"
+ }
+ else {
+ $siteRegex = "(?<=/Microsoft.OffAzure/HyperVSites/).*$"
+ }
+
+ if ($parameterSet -match 'Get')
+ {
+ # Get or GetInSite
+ foreach ($kvp in $appMap.GetEnumerator())
+ {
+ if (($kvp.Value -match $siteRegex) -and
+ (-not (($parameterSet -eq 'GetInSite') -and ($kvp.Key -ne $ApplianceName))))
+ {
+ $siteNameTmp = $Matches[0]
+ if ($SourceMachineType -eq "VMware")
+ {
+ $machine = Az.Migrate.Internal\Get-AzMigrateMachine `
+ -Name $Name `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $siteNameTmp `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ }
+ else {
+ # HyperV
+ $machine = Az.Migrate.Internal\Get-AzMigrateHyperVMachine `
+ -MachineName $Name `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $siteNameTmp `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ }
+
+ # Remove server marked as Deleted.
+ if ($null -ne $machine -and $machine.IsDeleted)
+ {
+ $machine = $null
+ }
+
+ if ($null -ne $machine)
+ {
+ return $machine
+ }
}
}
- if ($siteFound -eq 0) {
- throw "Appiance: $ApplianceName not found in project $ProjectName."
+ $errorMsg = "No machine with machine Name '$Name' of Type '$SourceMachineType' found in Project '$ProjectName'"
+ if ($hasApplianceName)
+ {
+ $errorMsg += " with Appliance '$ApplianceName'"
}
+
+ throw $errorMsg
}
else {
- # Fetch across project. All machines or by name.
- $projectSdsMachines = [System.Collections.ArrayList]::new()
+ # List or ListInSite
+ $allMachines = [System.Collections.ArrayList]::new()
+ foreach ($kvp in $appMap.GetEnumerator())
+ {
+ if (($kvp.Value -match $siteRegex) -and
+ (-not (($parameterSet -eq 'ListInSite') -and ($kvp.Key -ne $ApplianceName))))
+ {
+ $siteNameTmp = $Matches[0]
+ if ($SourceMachineType -eq "VMware")
+ {
+ $machines = Az.Migrate.Internal\Get-AzMigrateMachine `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $siteNameTmp `
+ -SubscriptionId $SubscriptionId
+ }
+ else {
+ # HyperV
+ $machines = Az.Migrate.Internal\Get-AzMigrateHyperVMachine `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $siteNameTmp `
+ -SubscriptionId $SubscriptionId
+ }
- if ($parameterSet -eq 'List') {
- foreach ($kvp in $appMap.GetEnumerator()) {
- $siteArmId = $kvp.Value
-
- if ($siteArmId -match $r) {
- $siteNameTmp = $Matches[0]
- $siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId
- if ($null -ne $siteMachines) {
- $projectSdsMachines.AddRange($siteMachines)
- }
+ if ($null -ne $machines)
+ {
+ $allMachines.AddRange($machines)
}
}
+ }
- if ($DisplayName) {
- $filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName -match $DisplayName}
- return $filteredMachines
- }
- else {
- return $projectSdsMachines
- }
+ # Remove servers marked as Deleted.
+ $allMachines = $allMachines | Where-Object { !$_.IsDeleted }
+
+ if ($allMachines.Count -gt 0 -and $DisplayName)
+ {
+ $allMachines = $allMachines | Where-Object { $_.DisplayName -match $DisplayName }
}
- elseif ($parameterSet -eq 'Get') {
- foreach ($kvp in $appMap.GetEnumerator()) {
- $siteArmId = $kvp.Value
-
- if ($siteArmId -match $r) {
- $siteNameTmp = $Matches[0]
-
- try {
- $siteMachine = Get-AzMigrateMachine -Name $Name -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId
- if ($null -ne $siteMachine) {
- return $siteMachine
- }
- }
- catch {
- $theError = $_
- Write-Host $theError
- }
- }
+
+ if ($allMachines.Count -eq 0)
+ {
+ $errorMsg = "No machine of Type '$SourceMachineType' found in Project '$ProjectName'"
+ if ($hasApplianceName)
+ {
+ $errorMsg += " with Appliance '$ApplianceName'"
+ }
+
+ if ($DisplayName)
+ {
+ $errorMsg += " with matching machine DisplayName '$DisplayName'"
}
- throw "Machine with Id $Name not found in project $ProjectName."
+ throw $errorMsg
}
+
+ return $allMachines
}
}
}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1
new file mode 100644
index 000000000000..f360c51a956e
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1
@@ -0,0 +1,188 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Retrieves the status of an Azure Migrate job.
+.Description
+The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob
+#>
+function Get-AzMigrateHCIJob {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
+ param(
+ [Parameter(ParameterSetName = 'GetById', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the job id for which the details needs to be retrieved.
+ ${ID},
+
+ [Parameter(ParameterSetName = 'GetByName', Mandatory)]
+ [Parameter(ParameterSetName = 'ListByName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # The name of the resource group where the recovery services vault is present.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName = 'GetByName', Mandatory)]
+ [Parameter(ParameterSetName = 'ListByName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # The name of the migrate project.
+ ${ProjectName},
+
+ [Parameter(ParameterSetName = 'GetByName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Job identifier
+ ${Name},
+
+ [Parameter(ParameterSetName = 'GetByInputObject', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity]
+ # Specifies the job object of the replicating server.
+ ${InputObject},
+
+ [Parameter(ParameterSetName = 'ListById', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+ ${ResourceGroupID},
+
+ [Parameter(ParameterSetName = 'ListById', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Azure Migrate Project in which servers are replicating.
+ ${ProjectID},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $null = $PSBoundParameters.Remove('ID')
+ $null = $PSBoundParameters.Remove('ResourceGroupName')
+ $null = $PSBoundParameters.Remove('ProjectName')
+ $null = $PSBoundParameters.Remove('Name')
+ $null = $PSBoundParameters.Remove('InputObject')
+ $null = $PSBoundParameters.Remove('ResourceGroupID')
+ $null = $PSBoundParameters.Remove('ProjectID')
+
+ if (($parameterSet -match 'Name') -or ($parameterSet -eq 'ListById')) {
+ if ($parameterSet -eq 'ListById') {
+ $ProjectIdArray = $ProjectID.Split("/")
+ if ($ProjectIdArray.Length -lt 9) {
+ throw "Invalid Project ID '$ProjectID'"
+ }
+ $ProjectName = $ProjectIdArray[8]
+ $ResourceGroupName = $ResourceGroupID.Split("/")[4]
+ }
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication")
+ $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName)
+
+ $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters
+ if ($solution -and ($solution.Count -ge 1)) {
+ $vaultId = $solution.DetailExtendedDetail["vaultId"]
+ $vaultIdArray = $vaultId.Split("/")
+ if ($vaultIdArray.Length -lt 9) {
+ throw "Invalid Vault ID '$vaultId'"
+ }
+ $vaultName = $vaultIdArray[8]
+ }
+ else {
+ throw "Solution not found."
+ }
+
+ $null = $PSBoundParameters.Remove("ResourceGroupName")
+ $null = $PSBoundParameters.Remove("Name")
+ $null = $PSBoundParameters.Remove("MigrateProjectName")
+ }
+ else {
+ if ($parameterSet -eq 'GetByInputObject') {
+ $ID = $InputObject.Id
+ }
+ $jobIdArray = $ID.split('/')
+ if ($jobIdArray.Length -lt 11) {
+ throw "Invalid Job ID '$ID'"
+ }
+ $ResourceGroupName = $jobIdArray[4]
+ $vaultName = $jobIdArray[8]
+ $Name = $jobIdArray[10]
+ }
+
+ $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
+ $null = $PSBoundParameters.Add('VaultName', $vaultName)
+ if ($parameterSet -match 'Get') {
+ $null = $PSBoundParameters.Add('JobName', $Name)
+ }
+
+ return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1
new file mode 100644
index 000000000000..25a19d1ba311
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1
@@ -0,0 +1,280 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Retrieves the details of the replicating server.
+.Description
+The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication
+#>
+function Get-AzMigrateHCIServerReplication {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
+ param(
+ [Parameter(ParameterSetName = 'GetByItemID', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the replicating server ARM ID.
+ ${TargetObjectID},
+
+ [Parameter(ParameterSetName = 'ListByName', Mandatory)]
+ [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName = 'ListByName', Mandatory)]
+ [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Azure Migrate project in the current subscription.
+ ${ProjectName},
+
+ [Parameter(ParameterSetName = 'GetBySDSID', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the machine ID of the discovered server.
+ ${DiscoveredMachineId},
+
+ [Parameter(ParameterSetName = 'GetByInputObject', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity]
+ # Specifies the machine object of the replicating server.
+ ${InputObject},
+
+ [Parameter(ParameterSetName = 'ListById', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+ ${ResourceGroupID},
+
+ [Parameter(ParameterSetName = 'ListById', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Azure Migrate Project in which servers are replicating.
+ ${ProjectID},
+
+ [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the display name of the replicating machine.
+ ${MachineName},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1
+
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $null = $PSBoundParameters.Remove('TargetObjectID')
+ $null = $PSBoundParameters.Remove('ResourceGroupName')
+ $null = $PSBoundParameters.Remove('ProjectName')
+ $null = $PSBoundParameters.Remove('DiscoveredMachineId')
+ $null = $PSBoundParameters.Remove('InputObject')
+ $null = $PSBoundParameters.Remove('ResourceGroupID')
+ $null = $PSBoundParameters.Remove('ProjectID')
+ $null = $PSBoundParameters.Remove('MachineName')
+
+ if ($parameterSet -eq 'GetBySDSID') {
+ $machineIdArray = $DiscoveredMachineId.Split("/")
+ if ($machineIdArray.Length -lt 11) {
+ throw "Invalid machine ID '$DiscoveredMachineId'"
+ }
+ $siteType = $machineIdArray[7]
+ $siteName = $machineIdArray[8]
+ $ResourceGroupName = $machineIdArray[4]
+ $ProtectedItemName = $machineIdArray[10]
+
+ $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
+ $null = $PSBoundParameters.Add('SiteName', $siteName)
+
+ if (($siteType -ne $SiteTypes.HyperVSites) -and ($siteType -ne $SiteTypes.VMwareSites)) {
+ throw "Unknown machine site '$siteName' with Type '$siteType'."
+ }
+
+ # Occasionally, Get Machine Site will not return machine site even when the site exist,
+ # hence retry get machine site.
+ $attempts = 4
+ for ($i = 1; $i -le $attempts; $i++) {
+ try {
+ if ($siteType -eq $SiteTypes.VMwareSites) {
+ $siteObject = Az.Migrate\Get-AzMigrateSite @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ }
+ elseif ($siteType -eq $SiteTypes.HyperVSites) {
+ $siteObject = Az.Migrate.Internal\Get-AzMigrateHyperVSite @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ }
+
+ if ($null -eq $siteObject) {
+ throw "Machine site not found."
+ }
+ else {
+ $ProjectName = $siteObject.DiscoverySolutionId.Split("/")[8]
+ }
+
+ break;
+ }
+ catch {
+ if ($i -lt $attempts)
+ {
+ Write-Host "Machine site not found. Retrying in 30 seconds..."
+ Start-Sleep -Seconds 30
+ }
+ else
+ {
+ throw "Machine site '$siteName' with Type '$siteType' not found."
+ }
+ }
+ }
+
+ $null = $PSBoundParameters.Remove('SiteName')
+
+ $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication")
+ $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName)
+
+ $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters
+ if ($solution -and ($solution.Count -ge 1)) {
+ $VaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8]
+ }
+ else {
+ throw "Solution not found."
+ }
+
+ $null = $PSBoundParameters.Remove("Name")
+ $null = $PSBoundParameters.Remove("MigrateProjectName")
+
+ $null = $PSBoundParameters.Add("VaultName", $VaultName)
+ $null = $PSBoundParameters.Add("Name", $ProtectedItemName)
+
+ return Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ }
+
+ if (($parameterSet -match 'List') -or ($parameterSet -eq 'GetByMachineName')) {
+ # Retrieve ResourceGroupName, ProjectName if ListByID
+ if ($parameterSet -eq 'ListByID') {
+ $resourceGroupIdArray = $ResourceGroupID.Split('/')
+ if ($resourceGroupIdArray.Length -lt 5) {
+ throw "Invalid resource group Id '$ResourceGroupID'."
+ }
+
+ $ResourceGroupName = $resourceGroupIdArray[4]
+
+ $projectIdArray = $ProjectID.Split('/')
+ if ($projectIdArray.Length -lt 9) {
+ throw "Invalid migrate project Id '$ProjectID'."
+ }
+
+ $ProjectName = $projectIdArray[8]
+ }
+
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication")
+ $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName)
+
+ $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters
+ if ($solution -and ($solution.Count -ge 1)) {
+ $VaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8]
+ }
+ else {
+ throw "Solution not found."
+ }
+
+ $null = $PSBoundParameters.Remove("Name")
+ $null = $PSBoundParameters.Remove("MigrateProjectName")
+ $null = $PSBoundParameters.Add("VaultName", $VaultName)
+
+ $replicatingItems = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+
+ if ($parameterSet -eq "GetByMachineName") {
+ $replicatingItems = $replicatingItems | Where-Object { $_.Property.FabricObjectName -eq $MachineName }
+ }
+ return $replicatingItems
+ }
+
+ if (($parameterSet -eq "GetByInputObject") -or ($parameterSet -eq "GetByItemID")) {
+ if ($parameterSet -eq 'GetByInputObject') {
+ $TargetObjectID = $InputObject.Id
+ }
+ $objectIdArray = $TargetObjectID.Split("/")
+ if ($objectIdArray.Length -lt 11) {
+ throw "Invalid target object ID '$TargetObjectID'."
+ }
+
+ $ResourceGroupName = $objectIdArray[4]
+ $VaultName = $objectIdArray[8]
+ $ProtectedItemName = $objectIdArray[10]
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("VaultName", $VaultName)
+ $null = $PSBoundParameters.Add("Name", $ProtectedItemName)
+
+ return Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1 b/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1
new file mode 100644
index 000000000000..b358ef4b966e
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1
@@ -0,0 +1,78 @@
+$AzStackHCIInstanceTypes = @{
+ HyperVToAzStackHCI = "HyperVToAzStackHCI";
+ VMwareToAzStackHCI = "VMwareToAzStackHCI";
+}
+
+# Fabric instances
+$FabricInstanceTypes = @{
+ HyperVInstance = "HyperVMigrate";
+ VMwareInstance = "VMwareMigrate";
+ AzStackHCIInstance = "AzStackHCI";
+}
+
+$ReplicationDetails = @{
+ PolicyDetails = @{
+ DefaultCrashConsistentFrequencyInMinutes = 60;
+ DefaultAppConsistentFrequencyInMinutes = 240;
+ DefaultRecoveryPointHistoryInMinutes = 4320;
+ };
+ ReplicationPollDelaySeconds = 180;
+ ReplicationTimeoutSeconds = 1800;
+}
+
+$ApiVersions = @{
+ ReplicationPolicy = "2021-02-16-preview";
+ ReplicationFabric = "2021-02-16-preview";
+ ReplicationExtension = "2021-02-16-preview";
+ StorageAccount = "2021-09-01";
+ HyperVSites = "2020-01-01";
+ ProtectedItem = "2021-02-16-preview";
+ AzStackHCI = "2021-09-01-preview";
+}
+
+# Role definition GUIDs for storage account creation
+$RoleDefinitionIds = @{
+ ContributorId = "b24988ac-6180-42a0-ab88-20f7382dd24c";
+ StorageBlobDataContributorId = "ba92f5b4-2d11-453d-a403-e96b0029c9fe";
+}
+
+$RunAsAccountCredentialTypes = @{
+ HyperVFabric = "HyperVFabric";
+ VMwareFabric = "VMwareFabric";
+ DomainCredential = "DomainCredential";
+}
+
+$SiteTypes = @{
+ HyperVSites = "HyperVSites";
+ VMwareSites = "VMwareSites";
+}
+
+$RAMConfig = @{
+ GbToMb = 1024;
+ MinTargetMemoryInMB = 1024; # 1 GB
+ MaxTargetMemoryGen1InMB = 1048576; # 1 TB
+ MaxTargetMemoryGen2InMB = 12582912; # 12 TB
+ DefaultMinDynamicMemoryInMB = 1024; # 1 GB
+ DefaultMaxDynamicMemoryInMB = 1048576; # 1 TB
+ DefaultTargetMemoryBufferPercentage = 20; # 20 %
+ MinTargetMemoryBufferPercentage = 5; # 5 %
+ MaxTargetMemoryBufferPercentage = 2000; # 2000 %
+}
+
+enum ProvisioningState
+{
+ Canceled
+ Creating
+ Deleting
+ Deleted
+ Failed
+ Succeeded
+ Updating
+}
+
+enum StorageAccountProvisioningState
+{
+ Creating
+ ResolvingDNS
+ Succeeded
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1 b/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1
new file mode 100644
index 000000000000..ac37011924e3
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1
@@ -0,0 +1,179 @@
+function CheckResourceGraphModuleDependency {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param()
+
+ process {
+ $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.ResourceGraph" }
+ if ($null -eq $module) {
+ $message = "Az.ResourceGraph Module must be installed to run this command. Please run 'Install-Module -Name Az.ResourceGraph' to install and continue."
+ throw $message
+ }
+ }
+}
+
+function CheckResourcesModuleDependency {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param()
+
+ process {
+ $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.Resources" }
+ if ($null -eq $module) {
+ $message = "Az.Resources Module must be installed to run this command. Please run 'Install-Module -Name Az.Resources' to install and continue."
+ throw $message
+ }
+ }
+}
+
+function CheckStorageModuleDependency {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param()
+
+ process {
+ $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.Storage" }
+ if ($null -eq $module) {
+ $message = "Az.Storage Module must be installed to run this command. Please run 'Install-Module -Name Az.Storage' to install and continue."
+ throw $message
+ }
+ }
+}
+
+function GetHCIClusterARGQuery {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param(
+ [Parameter(Mandatory)]
+ [System.String]
+ # Specifies HCI Cluster Id.
+ ${HCIClusterID}
+ )
+
+ process {
+ $query = @"
+resources | where type == 'microsoft.extendedlocation/customlocations'
+| mv-expand ClusterId = properties['clusterExtensionIds']
+| extend ClusterId = toupper(tostring(ClusterId))
+| extend CustomLocation = toupper(tostring(id))
+| extend resourceBridgeID = toupper(tostring(properties['hostResourceId']))
+| extend customLocationRegion = location
+| join (
+ kubernetesconfigurationresources
+ | where type == 'microsoft.kubernetesconfiguration/extensions'
+ | where properties['ConfigurationSettings']['HCIClusterID'] =~ '$HCIClusterID'
+ | project ClusterId = id
+ | extend ClusterId = toupper(tostring(ClusterId))
+) on ClusterId
+| join (
+ resources
+ | where type == 'microsoft.resourceconnector/appliances'
+ | where properties['provisioningState'] == 'Succeeded'
+ | extend statusOfTheBridge = properties['status']
+ | extend resourceBridgeID = toupper(tostring(id))
+) on resourceBridgeID
+"@
+ return $query
+ }
+}
+
+function IsReservedOrTrademarked {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param(
+ [Parameter(Mandatory)]
+ [System.String]
+ # Specifies VM name.
+ ${Value}
+ )
+
+ $uppercased = $Value.ToUpper();
+
+ # cannot be exactly one of these, but could be slighlty differnet (e.g. hololens2)
+ $reservedWords = @(
+ "ACCESS",
+ "APP_CODE",
+ "APP_THEMES",
+ "APP_DATA",
+ "APP_GLOBALRESOURCES",
+ "APP_LOCALRESOURCES",
+ "APP_WEBREFERENCES",
+ "APP_BROWSERS",
+ "AZURE",
+ "BING",
+ "BIZSPARK",
+ "BIZTALK",
+ "CORTANA",
+ "DIRECTX",
+ "DOTNET",
+ "DYNAMICS",
+ "EXCEL",
+ "EXCHANGE",
+ "FOREFRONT",
+ "GROOVE",
+ "HOLOLENS",
+ "HYPERV",
+ "KINECT",
+ "LYNC",
+ "MSDN",
+ "O365",
+ "OFFICE",
+ "OFFICE365",
+ "ONEDRIVE",
+ "ONENOTE",
+ "OUTLOOK",
+ "POWERPOINT",
+ "SHAREPOINT",
+ "SKYPE",
+ "VISIO",
+ "VISUALSTUDIO"
+ )
+
+ # The following words can't be used as either a whole word or a substring in the name:
+ $microsoft = "MICROSOFT";
+ $windows = "WINDOWS";
+
+ # The following words can't be used at the start of a resource name, but can be used later in the name:
+ $startLogin = "LOGIN";
+ $startXbox = "XBOX";
+
+ if ($uppercased.startsWith($startLogin) -or $uppercased.startsWith($startXbox)) {
+ return $true;
+ }
+
+ if ($uppercased.contains($microsoft) -or $uppercased.contains($windows)) {
+ return $true;
+ }
+
+ foreach ($reservedName in $reservedWords) {
+ if ($uppercased -eq $reservedName) {
+ return $true;
+ }
+ }
+
+ return $false;
+}
+
+function GenerateHashForArtifact {
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()]
+ param(
+ [Parameter(Mandatory)]
+ [System.String]
+ # Specifies resource group name.
+ ${Artifact}
+ )
+
+ $hashCode = 0
+ $artifactLength = $Artifact.Length
+ $tempItemLength = 0
+ if ($artifactLength -gt 0) {
+ while ($tempItemLength -lt $artifactLength) {
+ $hashCode = ((($hashCode -shl 5) - $hashCode) + $Artifact[$tempItemLength++] -bor 0)
+
+ # Treat as Double, then convert to Bytes, then convert back to Int32 to match JavaScript behavior
+ $hashCode = [System.BitConverter]::ToInt32([System.BitConverter]::GetBytes($hashCode), 0)
+ }
+ }
+
+ if ($hashCode -lt 0) {
+ return -1 * $hashCode
+ }
+ else {
+ return $hashCode
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 b/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1
new file mode 100644
index 000000000000..fb6e1e790348
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1
@@ -0,0 +1,1108 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Initializes the infrastructure for the migrate project.
+.Description
+The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure
+#>
+
+function Initialize-AzMigrateHCIReplicationInfrastructure {
+ [OutputType([System.Boolean], ParameterSetName = 'AzStackHCI')]
+ [CmdletBinding(DefaultParameterSetName = 'AzStackHCI', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
+ param(
+ [Parameter(Mandatory)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+ ${ResourceGroupName},
+
+ [Parameter(Mandatory)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the name of the Azure Migrate project to be used for server migration.
+ ${ProjectName},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Storage Account ARM Id to be used for private endpoint scenario.
+ ${CacheStorageAccountId},
+
+ [Parameter()]
+ [System.String]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the source appliance name for the AzStackHCI scenario.
+ ${SourceApplianceName},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the target appliance name for the AzStackHCI scenario.
+ ${TargetApplianceName},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1
+ Import-Module $PSScriptRoot\Helper\CommonHelper.ps1
+
+ CheckResourcesModuleDependency
+ CheckStorageModuleDependency
+ Import-Module Az.Resources
+ Import-Module Az.Storage
+
+ $context = Get-AzContext
+ # Get SubscriptionId
+ if ([string]::IsNullOrEmpty($SubscriptionId)) {
+ Write-Host "No -SubscriptionId provided. Using the one from Get-AzContext."
+
+ $SubscriptionId = $context.Subscription.Id
+ if ([string]::IsNullOrEmpty($SubscriptionId)) {
+ throw "Please login to Azure to select a subscription."
+ }
+ }
+ Write-Host "*Selected Subscription Id: '$($SubscriptionId)'."
+
+ # Get resource group
+ $resourceGroup = Get-AzResourceGroup -Name $ResourceGroupName -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($null -eq $resourceGroup) {
+ throw "Resource group '$($ResourceGroupName)' does not exist in the subscription. Please create the resource group and try again."
+ }
+ Write-Host "*Selected Resource Group: '$($ResourceGroupName)'."
+
+ # Verify user validity
+ $userObject = Get-AzADUser -UserPrincipalName $context.Subscription.ExtendedProperties.Account
+
+ if (-not $userObject) {
+ $userObject = Get-AzADUser -Mail $context.Subscription.ExtendedProperties.Account
+ }
+
+ if (-not $userObject) {
+ $mailNickname = "{0}#EXT#" -f $($context.Account.Id -replace '@', '_')
+
+ $userObject = Get-AzADUser |
+ Where-Object { $_.MailNickname -eq $mailNickname }
+ }
+
+ if (-not $userObject) {
+ $userObject = Get-AzADServicePrincipal -ApplicationID $context.Account.Id
+ }
+
+ if (-not $userObject) {
+ throw 'User Object Id Not Found!'
+ }
+
+ # Get Migrate Project
+ $migrateProject = Az.Migrate\Get-AzMigrateProject `
+ -Name $ProjectName `
+ -ResourceGroupName $ResourceGroupName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $migrateProject) {
+ throw "Migrate project '$($ProjectName)' not found."
+ }
+
+ # Access Discovery Service
+ $discoverySolutionName = "Servers-Discovery-ServerDiscovery"
+ $discoverySolution = Az.Migrate\Get-AzMigrateSolution `
+ -SubscriptionId $SubscriptionId `
+ -ResourceGroupName $ResourceGroupName `
+ -MigrateProjectName $ProjectName `
+ -Name $discoverySolutionName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($discoverySolution.Name -ne $discoverySolutionName) {
+ throw "Server Discovery Solution not found."
+ }
+
+ # Get Appliances Mapping
+ $appMap = @{}
+ if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) {
+ $appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
+ # Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map.
+ foreach ($item in $appMapV2) {
+ $appMap[$item.ApplianceName.ToLower()] = $item.SiteId
+ }
+ }
+
+ if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) {
+ $appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json
+ foreach ($item in $appMapV3) {
+ $t = $item.psobject.properties
+ $appMap[$t.Name.ToLower()] = $t.Value.SiteId
+ }
+ }
+
+ if ($null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] -And
+ $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] ) {
+ throw "Server Discovery Solution missing Appliance Details. Invalid Solution."
+ }
+
+ $hyperVSiteTypeRegex = "(?<=/Microsoft.OffAzure/HyperVSites/).*$"
+ $vmwareSiteTypeRegex = "(?<=/Microsoft.OffAzure/VMwareSites/).*$"
+
+ # Validate SourceApplianceName & TargetApplianceName
+ $sourceSiteId = $appMap[$SourceApplianceName.ToLower()]
+ $targetSiteId = $appMap[$TargetApplianceName.ToLower()]
+ if ($sourceSiteId -match $hyperVSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex) {
+ $instanceType = $AzStackHCIInstanceTypes.HyperVToAzStackHCI
+ }
+ elseif ($sourceSiteId -match $vmwareSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex) {
+ $instanceType = $AzStackHCIInstanceTypes.VMwareToAzStackHCI
+ }
+ else {
+ throw "Error encountered in matching the given source appliance name '$SourceApplianceName' and target appliance name '$TargetApplianceName'. Please verify the VM site type to be either for HyperV or VMware for both source and target appliances, and the appliance names are correct."
+ }
+
+ # Get Data Replication Service, or the AMH solution
+ $amhSolution = Az.Migrate\Get-AzMigrateSolution `
+ -ResourceGroupName $ResourceGroupName `
+ -MigrateProjectName $ProjectName `
+ -Name "Servers-Migration-ServerMigration_DataReplication" `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $amhSolution) {
+ throw "No Data Replication Service Solution found. Please verify your appliance setup."
+ }
+
+ # Get Source and Target Fabrics
+ $allFabrics = Az.Migrate\Get-AzMigrateHCIReplicationFabric -ResourceGroupName $ResourceGroupName
+ foreach ($fabric in $allFabrics) {
+ if ($fabric.Property.CustomProperty.MigrationSolutionId -ne $amhSolution.Id) {
+ continue
+ }
+
+ if (($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) -and
+ ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.HyperVInstance)) {
+ $sourceFabric = $fabric
+ }
+ elseif (($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) -and
+ ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.VMwareInstance)) {
+ $sourceFabric = $fabric
+ }
+ elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.AzStackHCIInstance) {
+ $targetFabric = $fabric
+ }
+
+ if (($null -ne $sourceFabric) -and ($null -ne $targetFabric)) {
+ break
+ }
+ }
+
+ if ($null -eq $sourceFabric) {
+ throw "Source Fabric not found. Please verify your appliance setup."
+ }
+ Write-Host "*Selected Source Fabric: '$($sourceFabric.Name)'."
+
+ if ($null -eq $targetFabric) {
+ throw "Target Fabric not found. Please verify your appliance setup."
+ }
+ Write-Host "*Selected Target Fabric: '$($targetFabric.Name)'."
+
+ # Get Source and Target Dras from Fabrics
+ $sourceDras = Az.Migrate.Internal\Get-AzMigrateDra `
+ -FabricName $sourceFabric.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $sourceDras) {
+ throw "Source Dra found. Please verify your appliance setup."
+ }
+ $sourceDra = $sourceDras[0]
+ Write-Host "*Selected Source Dra: '$($sourceDra.Name)'."
+
+ $targetDras = Az.Migrate.Internal\Get-AzMigrateDra `
+ -FabricName $targetFabric.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $targetDras) {
+ throw "Source Dra found. Please verify your appliance setup."
+ }
+ $targetDra = $targetDras[0]
+ Write-Host "*Selected Target Dra: '$($targetDra.Name)'."
+
+ # Get Replication Vault
+ $replicationVaultName = $amhSolution.DetailExtendedDetail["vaultId"].Split("/")[8]
+ $replicationVault = Az.Migrate.Internal\Get-AzMigrateVault `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $replicationVaultName
+ if ($null -eq $replicationVault) {
+ throw "No Replication Vault found in Resource Group '$($ResourceGroupName)'."
+ }
+
+ # Put Policy
+ $policyName = $replicationVault.Name + $instanceType + "policy"
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $policyName `
+ -VaultName $replicationVault.Name `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Default policy is found
+ if ($null -ne $policy) {
+ # Give time for create/update to reach a terminal state. Timeout after 10min
+ if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating) {
+ Write-Host "Policy '$($policyName)' found in Provisioning State '$($policy.Property.ProvisioningState)'."
+
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy -InputObject $policy
+
+ if (-not (
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating)) {
+ break
+ }
+ }
+
+ # Make sure Policy is no longer in Creating or Updating state
+ if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating) {
+ throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Check and remove if policy is in a bad terminal state
+ if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed) {
+ Write-Host "Policy '$($policyName)' found but in an unusable terminal Provisioning State '$($policy.Property.ProvisioningState)'.`nRemoving policy..."
+
+ # Remove policy
+ try {
+ Az.Migrate.Internal\Remove-AzMigratePolicy -InputObject $policy | Out-Null
+ }
+ catch {
+ if ($_.Exception.Message -notmatch "Status: OK") {
+ throw $_.Exception.Message
+ }
+ }
+
+ Start-Sleep -Seconds 30
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -InputObject $policy `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Make sure Policy is no longer in Canceled or Failed state
+ if ($null -ne $policy -and
+ ($policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed)) {
+ throw "Failed to change the Provisioning State of policy '$($policyName)'by removing. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Give time to remove policy. Timeout after 10min
+ if ($null -eq $policy -and $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ Write-Host "Policy '$($policyName)' found in Provisioning State '$($policy.Property.ProvisioningState)'."
+
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -InputObject $policy `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ break
+ }
+ elseif ($policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ continue
+ }
+
+ throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)' during removal process. Please re-run this command or contact support if help needed."
+ }
+
+ # Make sure Policy is no longer in Deleting state
+ if ($null -ne $policy -and $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Indicate policy was removed
+ if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ Write-Host "Policy '$($policyName)' was removed."
+ }
+ }
+
+ # Refresh local policy object if exists
+ if ($null -ne $policy) {
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy -InputObject $policy
+ }
+
+ # Create policy if not found or previously deleted
+ if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ Write-Host "Creating Policy..."
+
+ $params = @{
+ InstanceType = $instanceType;
+ RecoveryPointHistoryInMinute = $ReplicationDetails.PolicyDetails.DefaultRecoveryPointHistoryInMinutes;
+ CrashConsistentFrequencyInMinute = $ReplicationDetails.PolicyDetails.DefaultCrashConsistentFrequencyInMinutes;
+ AppConsistentFrequencyInMinute = $ReplicationDetails.PolicyDetails.DefaultAppConsistentFrequencyInMinutes;
+ }
+
+ # Setup Policy deployment parameters
+ $policyProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties]::new()
+ if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) {
+ $policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcipolicyModelCustomProperties]::new()
+ }
+ elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) {
+ $policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcipolicyModelCustomProperties]::new()
+ }
+ else {
+ throw "Instance type '$($instanceType)' is not supported. Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported."
+ }
+ $policyCustomProperties.InstanceType = $params.InstanceType
+ $policyCustomProperties.RecoveryPointHistoryInMinute = $params.RecoveryPointHistoryInMinute
+ $policyCustomProperties.CrashConsistentFrequencyInMinute = $params.CrashConsistentFrequencyInMinute
+ $policyCustomProperties.AppConsistentFrequencyInMinute = $params.AppConsistentFrequencyInMinute
+ $policyProperties.CustomProperty = $policyCustomProperties
+
+ try {
+ Az.Migrate.Internal\New-AzMigratePolicy `
+ -Name $policyName `
+ -ResourceGroupName $ResourceGroupName `
+ -VaultName $replicationVaultName `
+ -Property $policyProperties `
+ -SubscriptionId $SubscriptionId `
+ -NoWait | Out-Null
+ }
+ catch {
+ if ($_.Exception.Message -notmatch "Status: OK") {
+ throw $_.Exception.Message
+ }
+ }
+
+ # Check Policy creation status every 30s. Timeout after 10min
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $policyName `
+ -VaultName $replicationVault.Name `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $policy) {
+ throw "Unexpected error occurred during policy creation. Please re-run this command or contact support if help needed."
+ }
+
+ # Stop if policy reaches a terminal state
+ if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed) {
+ break
+ }
+ }
+
+ # Make sure Policy is in a terminal state
+ if (-not (
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed)) {
+ throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)' during creation process. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ if ($policy.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) {
+ throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+
+ $policy = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $policyName `
+ -VaultName $replicationVault.Name `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $policy) {
+ throw "Unexpected error occurred during policy creation. Please re-run this command or contact support if help needed."
+ }
+ elseif ($policy.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) {
+ throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ else {
+ Write-Host "*Selected Policy: '$($policyName)'."
+ }
+
+ # Put Cache Storage Account
+ $amhSolution = Az.Migrate\Get-AzMigrateSolution `
+ -ResourceGroupName $ResourceGroupName `
+ -MigrateProjectName $ProjectName `
+ -Name "Servers-Migration-ServerMigration_DataReplication" `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $amhSolution) {
+ throw "No Data Replication Service Solution found. Please verify your appliance setup."
+ }
+
+ $amhStoredStorageAccountId = $amhSolution.DetailExtendedDetail["replicationStorageAccountId"]
+
+ # Record of rsa found in AMH solution
+ if (![string]::IsNullOrEmpty($amhStoredStorageAccountId)) {
+ $amhStoredStorageAccountName = $amhStoredStorageAccountId.Split("/")[8]
+ $amhStoredStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $amhStoredStorageAccountName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Wait for amhStoredStorageAccount to reach a terminal state
+ if ($null -ne $amhStoredStorageAccount -and
+ $null -ne $amhStoredStorageAccount.ProvisioningState -and
+ $amhStoredStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) {
+ # Check rsa state every 30s if not Succeeded already. Timeout after 10min
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $amhStoredStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $amhStoredStorageAccountName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ # Stop if amhStoredStorageAccount is not found or in a terminal state
+ if ($null -eq $amhStoredStorageAccount -or
+ $null -eq $amhStoredStorageAccount.ProvisioningState -or
+ $amhStoredStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) {
+ break
+ }
+ }
+ }
+
+ # amhStoredStorageAccount exists and in Succeeded state
+ if ($null -ne $amhStoredStorageAccount -and
+ $amhStoredStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) {
+ # Use amhStoredStorageAccount and ignore user provided Cache Storage Account Id
+ if (![string]::IsNullOrEmpty($CacheStorageAccountId) -and $amhStoredStorageAccount.Id -ne $CacheStorageAccountId) {
+ Write-Host "A Cache Storage Account '$($amhStoredStorageAccountName)' has been linked already. The given -CacheStorageAccountId '$($CacheStorageAccountId)' will be ignored."
+ }
+
+ $cacheStorageAccount = $amhStoredStorageAccount
+ }
+ elseif ($null -eq $amhStoredStorageAccount -or $null -eq $amhStoredStorageAccount.ProvisioningState) {
+ # amhStoredStorageAccount is found but in a bad state, so log to ask user to remove
+ if ($null -ne $amhStoredStorageAccount -and $null -eq $amhStoredStorageAccount.ProvisioningState) {
+ Write-Host "A previously linked Cache Storage Account with Id '$($amhStoredStorageAccountId)' is found but in a unusable state. Please remove it manually and re-run this command."
+ }
+
+ # amhStoredStorageAccount is not found or in a bad state but AMH has a record of it, so remove the record
+ if ($amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) {
+ $amhSolution.DetailExtendedDetail.Remove("replicationStorageAccountId") | Out-Null
+ $amhSolution.DetailExtendedDetail.Add("replicationStorageAccountId", $null) | Out-Null
+ Az.Migrate.Internal\Set-AzMigrateSolution `
+ -MigrateProjectName $ProjectName `
+ -Name $amhSolution.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -DetailExtendedDetail $amhSolution.DetailExtendedDetail.AdditionalProperties | Out-Null
+ }
+ }
+ else {
+ throw "A linked Cache Storage Account with Id '$($amhStoredStorageAccountId)' times out with Provisioning State: '$($amhStoredStorageAccount.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+
+ $amhSolution = Az.Migrate\Get-AzMigrateSolution `
+ -ResourceGroupName $ResourceGroupName `
+ -MigrateProjectName $ProjectName `
+ -Name "Servers-Migration-ServerMigration_DataReplication" `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ # Check if AMH record is removed
+ if (($null -eq $amhStoredStorageAccount -or $null -eq $amhStoredStorageAccount.ProvisioningState) -and
+ ![string]::IsNullOrEmpty($amhSolution.DetailExtendedDetail["replicationStorageAccountId"])) {
+ throw "Unexpected error occurred in unlinking Cache Storage Account with Id '$($amhSolution.DetailExtendedDetail["replicationStorageAccountId"])'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # No linked Cache Storage Account found in AMH solution but user provides a Cache Storage Account Id
+ if ($null -eq $cacheStorageAccount -and ![string]::IsNullOrEmpty($CacheStorageAccountId)) {
+ $userProvidedStorageAccountIdSegs = $CacheStorageAccountId.Split("/")
+ if ($userProvidedStorageAccountIdSegs.Count -ne 9) {
+ throw "Invalid Cache Storage Account Id '$($CacheStorageAccountId)' provided. Please provide a valid one."
+ }
+
+ $userProvidedStorageAccountName = ($userProvidedStorageAccountIdSegs[8]).ToLower()
+
+ # Check if user provided Cache Storage Account exists
+ $userProvidedStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $userProvidedStorageAccountName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Wait for userProvidedStorageAccount to reach a terminal state
+ if ($null -ne $userProvidedStorageAccount -and
+ $null -ne $userProvidedStorageAccount.ProvisioningState -and
+ $userProvidedStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) {
+ # Check rsa state every 30s if not Succeeded already. Timeout after 10min
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $userProvidedStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $userProvidedStorageAccountName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ # Stop if userProvidedStorageAccount is not found or in a terminal state
+ if ($null -eq $userProvidedStorageAccount -or
+ $null -eq $userProvidedStorageAccount.ProvisioningState -or
+ $userProvidedStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) {
+ break
+ }
+ }
+ }
+
+ if ($null -ne $userProvidedStorageAccount -and
+ $userProvidedStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) {
+ $cacheStorageAccount = $userProvidedStorageAccount
+ }
+ elseif ($null -eq $userProvidedStorageAccount) {
+ throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is not found. Please re-run this command without -CacheStorageAccountId to create one automatically or re-create the Cache Storage Account yourself and try again."
+ }
+ elseif ($null -eq $userProvidedStorageAccount.ProvisioningState) {
+ throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is found but in an unusable state. Please re-run this command without -CacheStorageAccountId to create one automatically or re-create the Cache Storage Account yourself and try again."
+ }
+ else {
+ throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is found but times out with Provisioning State: '$($userProvidedStorageAccount.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # No Cache Storage Account found or provided, so create one
+ if ($null -eq $cacheStorageAccount) {
+ $suffix = (GenerateHashForArtifact -Artifact "$($sourceSiteId)/$($SourceApplianceName)").ToString()
+ if ($suffixHash.Length -gt 14) {
+ $suffix = $suffixHash.Substring(0, 14)
+ }
+ $cacheStorageAccountName = "migratersa" + $suffix
+ $cacheStorageAccountId = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.Storage/storageAccounts/$($cacheStorageAccountName)"
+
+ # Check if default Cache Storage Account already exists, which it shoudln't
+ $cacheStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $cacheStorageAccountName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -ne $cacheStorageAccount) {
+ throw "Unexpected error encountered: Cache Storage Account '$($cacheStorageAccountName)' already exists. Please re-run this command to create a different one or contact support if help needed."
+ }
+
+ Write-Host "Creating Cache Storage Account with default name '$($cacheStorageAccountName)'..."
+
+ $params = @{
+ name = $cacheStorageAccountName;
+ location = $migrateProject.Location;
+ migrateProjectName = $migrateProject.Name;
+ skuName = "Standard_LRS";
+ tags = @{ "Migrate Project" = $migrateProject.Name };
+ kind = "StorageV2";
+ encryption = @{ services = @{blob = @{ enabled = $true }; file = @{ enabled = $true } } };
+ }
+
+ # Create Cache Storage Account
+ $cacheStorageAccount = New-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $params.name `
+ -SkuName $params.skuName `
+ -Location $params.location `
+ -Kind $params.kind `
+ -Tags $params.tags `
+ -AllowBlobPublicAccess $true
+
+ if ($null -ne $cacheStorageAccount -and
+ $null -ne $cacheStorageAccount.ProvisioningState -and
+ $cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) {
+ # Check rsa state every 30s if not Succeeded already. Timeout after 10min
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $cacheStorageAccount = Get-AzStorageAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $params.name `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ # Stop if cacheStorageAccount is not found or in a terminal state
+ if ($null -eq $cacheStorageAccount -or
+ $null -eq $cacheStorageAccount.ProvisioningState -or
+ $cacheStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) {
+ break
+ }
+ }
+ }
+
+ if ($null -eq $cacheStorageAccount -or $null -eq $cacheStorageAccount.ProvisioningState) {
+ throw "Unexpected error occurs during Cache Storgae Account creation process. Please re-run this command or provide -CacheStorageAccountId of the one created own your own."
+ }
+ elseif ($cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) {
+ throw "Cache Storage Account with Id '$($cacheStorageAccount.Id)' times out with Provisioning State: '$($cacheStorageAccount.ProvisioningState)' during creation process. Please remove it manually and re-run this command or contact support if help needed."
+ }
+ }
+
+ # Sanity check
+ if ($null -eq $cacheStorageAccount -or
+ $null -eq $cacheStorageAccount.ProvisioningState -or
+ $cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) {
+ throw "Unexpected error occurs during Cache Storgae Account selection process. Please re-run this command or contact support if help needed."
+ }
+
+ $params = @{
+ contributorRoleDefId = [System.Guid]::parse($RoleDefinitionIds.ContributorId);
+ storageBlobDataContributorRoleDefId = [System.Guid]::parse($RoleDefinitionIds.StorageBlobDataContributorId);
+ sourceAppAadId = $sourceDra.ResourceAccessIdentityObjectId;
+ targetAppAadId = $targetDra.ResourceAccessIdentityObjectId;
+ }
+
+ # Grant Source Dra AAD App access to Cache Storage Account as "Contributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $hasAadAppAccess) {
+ New-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id | Out-Null
+ }
+
+ # Grant Source Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $hasAadAppAccess) {
+ New-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id | Out-Null
+ }
+
+ # Grant Target Dra AAD App access to Cache Storage Account as "Contributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $hasAadAppAccess) {
+ New-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id | Out-Null
+ }
+
+ # Grant Target Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $hasAadAppAccess) {
+ New-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id | Out-Null
+ }
+
+ # Give time for role assignments to be created. Times out after 2min
+ $rsaPermissionGranted = $false
+ for ($i = 0; $i -lt 4; $i++) {
+ # Check Source Dra AAD App access to Cache Storage Account as "Contributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ $rsaPermissionGranted = $null -ne $hasAadAppAccess
+
+ # Check Source Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.sourceAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess)
+
+ # Check Target Dra AAD App access to Cache Storage Account as "Contributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.contributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess)
+
+ # Check Target Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor"
+ $hasAadAppAccess = Get-AzRoleAssignment `
+ -ObjectId $params.targetAppAadId `
+ -RoleDefinitionId $params.storageBlobDataContributorRoleDefId `
+ -Scope $cacheStorageAccount.Id `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess)
+
+ if ($rsaPermissionGranted) {
+ break
+ }
+
+ Start-Sleep -Seconds 30
+ }
+
+ if (!$rsaPermissionGranted) {
+ throw "Failed to grant Cache Storage Account permissions. Please re-run this command or contact support if help needed."
+ }
+
+ $amhSolution = Az.Migrate\Get-AzMigrateSolution `
+ -ResourceGroupName $ResourceGroupName `
+ -MigrateProjectName $ProjectName `
+ -Name "Servers-Migration-ServerMigration_DataReplication" `
+ -SubscriptionId $SubscriptionId
+ if ($amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) {
+ $amhStoredStorageAccountId = $amhSolution.DetailExtendedDetail["replicationStorageAccountId"]
+ if ([string]::IsNullOrEmpty($amhStoredStorageAccountId)) {
+ # Remove "replicationStorageAccountId" key
+ $amhSolution.DetailExtendedDetail.Remove("replicationStorageAccountId") | Out-Null
+ }
+ elseif ($amhStoredStorageAccountId -ne $cacheStorageAccount.Id) {
+ # Record of rsa mismatch
+ throw "Unexpected error occurred in linking Cache Storage Account with Id '$($cacheStorageAccount.Id)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Update AMH record with chosen Cache Storage Account
+ if (!$amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) {
+ $amhSolution.DetailExtendedDetail.Add("replicationStorageAccountId", $cacheStorageAccount.Id)
+ Az.Migrate.Internal\Set-AzMigrateSolution `
+ -MigrateProjectName $ProjectName `
+ -Name $amhSolution.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -DetailExtendedDetail $amhSolution.DetailExtendedDetail.AdditionalProperties | Out-Null
+ }
+
+ Write-Host "*Selected Cache Storage Account: '$($cacheStorageAccount.StorageAccountName)' in Resource Group '$($ResourceGroupName)' at Location '$($cacheStorageAccount.Location)' for Migrate Project '$($migrateProject.Name)'."
+
+ # Put replication extension
+ $replicationExtensionName = ($sourceFabric.Id -split '/')[-1] + "-" + ($targetFabric.Id -split '/')[-1] + "-MigReplicationExtn"
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $replicationExtensionName `
+ -VaultName $replicationVaultName `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Remove replication extension if does not match the selected Cache Storage Account
+ if ($null -ne $replicationExtension -and $replicationExtension.Property.CustomProperty.StorageAccountId -ne $cacheStorageAccount.Id) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' found but linked to a different Cache Storage Account '$($replicationExtension.Property.CustomProperty.StorageAccountId)'."
+
+ try {
+ Az.Migrate.Internal\Remove-AzMigrateReplicationExtension -InputObject $replicationExtension | Out-Null
+ }
+ catch {
+ if ($_.Exception.Message -notmatch "Status: OK") {
+ throw $_.Exception.Message
+ }
+ }
+
+ Write-Host "Removing Replication Extension and waiting for 2 minutes..."
+ Start-Sleep -Seconds 120
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -InputObject $replicationExtension `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if ($null -eq $replicationExtension) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' was removed."
+ }
+ }
+
+ # Replication extension exists
+ if ($null -ne $replicationExtension) {
+ # Give time for create/update to reach a terminal state. Timeout after 10min
+ if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' found in Provisioning State '$($replicationExtension.Property.ProvisioningState)'."
+
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -InputObject $replicationExtension `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if (-not (
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating)) {
+ break
+ }
+ }
+
+ # Make sure replication extension is no longer in Creating or Updating state
+ if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating) {
+ throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Check and remove if replication extension is in a bad terminal state
+ if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' found but in an unusable terminal Provisioning State '$($replicationExtension.Property.ProvisioningState)'.`nRemoving Replication Extension..."
+
+ # Remove replication extension
+ try {
+ Az.Migrate.Internal\Remove-AzMigrateReplicationExtension -InputObject $replicationExtension | Out-Null
+ }
+ catch {
+ if ($_.Exception.Message -notmatch "Status: OK") {
+ throw $_.Exception.Message
+ }
+ }
+
+ Start-Sleep -Seconds 30
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -InputObject $replicationExtension `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ # Make sure replication extension is no longer in Canceled or Failed state
+ if ($null -ne $replicationExtension -and
+ ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed)) {
+ throw "Failed to change the Provisioning State of Replication Extension '$($replicationExtensionName)'by removing. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Give time to remove replication extension. Timeout after 10min
+ if ($null -ne $replicationExtension -and
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' found in Provisioning State '$($replicationExtension.Property.ProvisioningState)'."
+
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -InputObject $replicationExtension `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ break
+ }
+ elseif ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ continue
+ }
+
+ throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)' during removal process. Please re-run this command or contact support if help needed."
+ }
+
+ # Make sure replication extension is no longer in Deleting state
+ if ($null -ne $replicationExtension -and $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) {
+ throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ # Indicate replication extension was removed
+ if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ Write-Host "Replication Extension '$($replicationExtensionName)' was removed."
+ }
+ }
+
+ # Refresh local replication extension object if exists
+ if ($null -ne $replicationExtension) {
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension -InputObject $replicationExtension
+ }
+
+ # Create replication extension if not found or previously deleted
+ if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) {
+ Write-Host "Waiting 2 minutes for permissions to sync before creating Replication Extension..."
+ Start-Sleep -Seconds 120
+
+ Write-Host "Creating Replication Extension..."
+ $params = @{
+ InstanceType = $instanceType;
+ SourceFabricArmId = $sourceFabric.Id;
+ TargetFabricArmId = $targetFabric.Id;
+ StorageAccountId = $cacheStorageAccount.Id;
+ StorageAccountSasSecretName = $null;
+ }
+
+ # Setup Replication Extension deployment parameters
+ $replicationExtensionProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties]::new()
+
+ if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) {
+ $replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcireplicationExtensionModelCustomProperties]::new()
+ $replicationExtensionCustomProperties.HyperVFabricArmId = $params.SourceFabricArmId
+
+ }
+ elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) {
+ $replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcireplicationExtensionModelCustomProperties]::new()
+ $replicationExtensionCustomProperties.VMwareFabricArmId = $params.SourceFabricArmId
+ }
+ else {
+ throw "Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported."
+ }
+ $replicationExtensionCustomProperties.InstanceType = $params.InstanceType
+ $replicationExtensionCustomProperties.AzStackHCIFabricArmId = $params.TargetFabricArmId
+ $replicationExtensionCustomProperties.StorageAccountId = $params.StorageAccountId
+ $replicationExtensionCustomProperties.StorageAccountSasSecretName = $params.StorageAccountSasSecretName
+ $replicationExtensionProperties.CustomProperty = $replicationExtensionCustomProperties
+
+ try {
+ Az.Migrate.Internal\New-AzMigrateReplicationExtension `
+ -Name $replicationExtensionName `
+ -ResourceGroupName $ResourceGroupName `
+ -VaultName $replicationVaultName `
+ -Property $replicationExtensionProperties `
+ -SubscriptionId $SubscriptionId `
+ -NoWait | Out-Null
+ }
+ catch {
+ if ($_.Exception.Message -notmatch "Status: OK") {
+ throw $_.Exception.Message
+ }
+ }
+
+ # Check replication extension creation status every 30s. Timeout after 10min
+ for ($i = 0; $i -lt 20; $i++) {
+ Start-Sleep -Seconds 30
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $replicationExtensionName `
+ -VaultName $replicationVaultName `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $replicationExtension) {
+ throw "Unexpected error occurred during Replication Extension creation. Please re-run this command or contact support if help needed."
+ }
+
+ # Stop if replication extension reaches a terminal state
+ if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed) {
+ break
+ }
+ }
+
+ # Make sure replicationExtension is in a terminal state
+ if (-not (
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or
+ $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed)) {
+ throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)' during creation process. Please re-run this command or contact support if help needed."
+ }
+ }
+
+ if ($replicationExtension.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) {
+ throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $replicationExtensionName `
+ -VaultName $replicationVaultName `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $replicationExtension) {
+ throw "Unexpected error occurred during Replication Extension creation. Please re-run this command or contact support if help needed."
+ }
+ elseif ($replicationExtension.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) {
+ throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed."
+ }
+ else {
+ Write-Host "*Selected Replication Extension: '$($replicationExtensionName)'."
+ }
+
+ if ($PassThru) {
+ return $true
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1
new file mode 100644
index 000000000000..5e73f5696f24
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1
@@ -0,0 +1,79 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Creates a new disk mapping
+.Description
+The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject
+#>
+function New-AzMigrateHCIDiskMappingObject {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput])]
+ [CmdletBinding(PositionalBinding = $false)]
+ param(
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the disk ID of the disk attached to the discovered server to be migrated.
+ ${DiskID},
+
+ [Parameter(Mandatory)]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies whether the disk contains the Operating System for the source server to be migrated.
+ ${IsOSDisk},
+
+ [Parameter(Mandatory)]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies whether the disk is dynamic.
+ ${IsDynamic},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Int64]
+ # Specifies the disk size in GB.
+ ${Size},
+
+ [Parameter(Mandatory)]
+ [ValidateSet("VHD", "VHDX")]
+ [ArgumentCompleter( { "VHD", "VHDX" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the disk format.
+ ${Format}
+ )
+
+ process {
+ $isDynamicDisk = [System.Convert]::ToBoolean($IsDynamic)
+ $osDisk = [System.Convert]::ToBoolean($IsOSDisk)
+
+ $DiskObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput]::new(
+ $DiskID,
+ $isDynamicDisk,
+ $Size,
+ $Format,
+ $osDisk
+ )
+
+ return $DiskObject
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1
new file mode 100644
index 000000000000..5640d529b518
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1
@@ -0,0 +1,71 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Creates an object to update NIC properties of a replicating server.
+.Description
+The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject
+#>
+function New-AzMigrateHCINicMappingObject {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput])]
+ [CmdletBinding(PositionalBinding = $false)]
+ param(
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the ID of the NIC to be updated.
+ ${NicID},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the logical network ARM ID that the VMs will use.
+ ${TargetVirtualSwitchId},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the test logical network ARM ID that the VMs will use.
+ ${TargetTestVirtualSwitchId},
+
+ [Parameter()]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies whether the this Nic should be created at target.
+ ${CreateAtTarget} = "true"
+ )
+
+ process {
+ if (!$PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId')) {
+ $TargetTestVirtualSwitchId = $TargetVirtualSwitchId
+ }
+
+ $selectionTypeForFailover = if ($CreateAtTarget -eq "true") { "SelectedByUser" } else { "NotSelected" }
+
+ $NicObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput]::new(
+ $NicID,
+ $TargetVirtualSwitchId,
+ $TargetTestVirtualSwitchId,
+ $selectionTypeForFailover
+ )
+
+ return $NicObject
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1
new file mode 100644
index 000000000000..01a3870a06ff
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1
@@ -0,0 +1,589 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Starts replication for the specified server.
+.Description
+The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication
+#>
+function New-AzMigrateHCIServerReplication {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ByIdDefaultUser', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
+ param(
+ [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)]
+ [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the machine ARM ID of the discovered server to be migrated.
+ ${MachineId},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the storage path ARM ID where the VMs will be stored.
+ ${TargetStoragePathId},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Int32]
+ # Specifies the number of CPU cores.
+ ${TargetVMCPUCore},
+
+ [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the logical network ARM ID that the VMs will use.
+ ${TargetVirtualSwitchId},
+
+ [Parameter(ParameterSetName = 'ByIdDefaultUser')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the test logical network ARM ID that the VMs will use.
+ ${TargetTestVirtualSwitchId},
+
+ [Parameter()]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies if RAM is dynamic or not.
+ ${IsDynamicMemoryEnabled},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Int64]
+ # Specifies the target RAM size in MB.
+ ${TargetVMRam},
+
+ [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[]]
+ # 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.Api20210216Preview.AzStackHCINicInput[]]
+ # Specifies the NICs on the source server to be included for replication.
+ ${NicToInclude},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the target Resource Group Id where the migrated VM resources will reside.
+ ${TargetResourceGroupId},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the name of the VM to be created.
+ ${TargetVMName},
+
+ [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the Operating System disk for the source server to be migrated.
+ ${OSDiskID},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1
+ Import-Module $PSScriptRoot\Helper\CommonHelper.ps1
+
+ CheckResourceGraphModuleDependency
+ CheckResourcesModuleDependency
+
+ $HasTargetVMCPUCore = $PSBoundParameters.ContainsKey('TargetVMCPUCore')
+ $HasIsDynamicMemoryEnabled = $PSBoundParameters.ContainsKey('IsDynamicMemoryEnabled')
+ if ($HasIsDynamicMemoryEnabled) {
+ $isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled)
+ }
+ $HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam')
+ $HasTargetTestVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId')
+ $parameterSet = $PSCmdlet.ParameterSetName
+
+ $null = $PSBoundParameters.Remove('TargetVMCPUCore')
+ $null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled')
+ $null = $PSBoundParameters.Remove('TargetVMRam')
+ $null = $PSBoundParameters.Remove('DiskToInclude')
+ $null = $PSBoundParameters.Remove('NicToInclude')
+ $null = $PSBoundParameters.Remove('TargetResourceGroupId')
+ $null = $PSBoundParameters.Remove('TargetVMName')
+ $null = $PSBoundParameters.Remove('TargetVirtualSwitchId')
+ $null = $PSBoundParameters.Remove('TargetTestVirtualSwitchId')
+ $null = $PSBoundParameters.Remove('TargetStoragePathId')
+ $null = $PSBoundParameters.Remove('OSDiskID')
+ $null = $PSBoundParameters.Remove('MachineId')
+ $null = $PSBoundParameters.Remove('WhatIf')
+ $null = $PSBoundParameters.Remove('Confirm')
+
+ $MachineIdArray = $MachineId.Split("/")
+ $SiteType = $MachineIdArray[7]
+ $SiteName = $MachineIdArray[8]
+ $ResourceGroupName = $MachineIdArray[4]
+ $MachineName = $MachineIdArray[10]
+
+ if (($SiteType -ne $SiteTypes.HyperVSites) -and ($SiteType -ne $SiteTypes.VMwareSites)) {
+ throw "Site type is not supported. Site type '$SiteType'. Check MachineId provided."
+ }
+
+ # Get the source site and the discovered machine
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("SiteName", $SiteName)
+ $null = $PSBoundParameters.Add("MachineName", $MachineName)
+
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $instanceType = $AzStackHCIInstanceTypes.HyperVToAzStackHCI
+ $machine = Az.Migrate.Internal\Get-AzMigrateHyperVMachine @PSBoundParameters
+
+ $null = $PSBoundParameters.Remove('MachineName')
+ $siteObject = Az.Migrate.Internal\Get-AzMigrateHyperVSite @PSBoundParameters
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $instanceType = $AzStackHCIInstanceTypes.VMwareToAzStackHCI
+ $machine = Az.Migrate.Internal\Get-AzMigrateMachine @PSBoundParameters
+
+ $null = $PSBoundParameters.Remove('MachineName')
+ $siteObject = Az.Migrate\Get-AzMigrateSite @PSBoundParameters
+ }
+
+ $null = $PSBoundParameters.Remove('ResourceGroupName')
+ $null = $PSBoundParameters.Remove('SiteName')
+
+ if ($null -eq $machine) {
+ throw "No machine '$MachineName' found in resource group '$ResourceGroupName' and site '$SiteName'."
+ }
+
+ if ($siteObject -and ($siteObject.Count -ge 1)) {
+ $ProjectName = $siteObject.DiscoverySolutionId.Split("/")[8]
+ }
+ else {
+ throw "No site '$SiteName' found in resource group '$ResourceGroupName'"
+ }
+
+ # Get the migrate solution.
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication")
+ $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName)
+
+ $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters
+ $vaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8]
+
+ $null = $PSBoundParameters.Remove('ResourceGroupName')
+ $null = $PSBoundParameters.Remove("Name")
+ $null = $PSBoundParameters.Remove("MigrateProjectName")
+
+ if (($null -eq $solution) -or [string]::IsNullOrEmpty($vaultName)) {
+ throw 'Azure Migrate Project not configured. Setup Azure Migrate Project and run the Initialize-AzMigrateHCIReplicationInfrastructure script before proceeding.'
+ }
+
+ # Get fabrics and appliances in the project
+ $allFabrics = Az.Migrate\Get-AzMigrateHCIReplicationFabric -ResourceGroupName $ResourceGroupName
+ foreach ($fabric in $allFabrics) {
+ if ($fabric.Property.CustomProperty.MigrationSolutionId -ne $solution.Id) {
+ continue
+ }
+
+ if ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.HyperVInstance) {
+ $sourceFabric = $fabric
+ }
+ elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.VmwareInstance) {
+ $sourceFabric = $fabric
+ }
+ elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.AzStackHCIInstance) {
+ $targetFabric = $fabric
+ }
+ }
+
+ if ($null -eq $sourceFabric) {
+ throw "No connected source appliances are found. Kindly deploy an appliance by completing the Discover step of the migration jounery on the source cluster."
+ }
+
+ if ($null -eq $targetFabric) {
+ throw "A target appliance is not available for the target cluster. Deploy and configure a new appliance for the cluster, or select a different cluster.."
+ }
+
+ # Get Source and Target Dras
+ $sourceDras = Az.Migrate.Internal\Get-AzMigrateDra `
+ -FabricName $sourceFabric.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $sourceDras) {
+ throw "No connected source appliances are found. Kindly deploy an appliance by completing the Discover step of the migration jounery on the source cluster."
+ }
+ $sourceDra = $sourceDras[0]
+
+ $targetDras = Az.Migrate.Internal\Get-AzMigrateDra `
+ -FabricName $targetFabric.Name `
+ -ResourceGroupName $ResourceGroupName `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+ if ($null -eq $targetDras) {
+ throw "A target appliance is not available for the target cluster. Deploy and configure a new appliance for the cluster, or select a different cluster.."
+ }
+ $targetDra = $targetDras[0]
+
+ # Validate Policy
+ $policyName = $vaultName + $instanceType + "policy"
+ $policyObj = Az.Migrate.Internal\Get-AzMigratePolicy `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $policyName `
+ -VaultName $vaultName `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if ($null -eq $policyObj) {
+ throw "The replication infrastructure is not initialized. Run the Initialize-AzMigrateHCIReplicationInfrastructure script again."
+ }
+
+ # Validate Replication Extension
+ $replicationExtensionName = ($sourceFabric.Id -split '/')[-1] + "-" + ($targetFabric.Id -split '/')[-1] + "-MigReplicationExtn"
+ $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
+ -ResourceGroupName $ResourceGroupName `
+ -Name $replicationExtensionName `
+ -VaultName $vaultName `
+ -SubscriptionId $SubscriptionId `
+ -ErrorVariable notPresent `
+ -ErrorAction SilentlyContinue
+
+ if ($null -eq $replicationExtension) {
+ throw "The replication infrastructure is not initialized. Run the Initialize-AzMigrateHCIReplicationInfrastructure script again."
+ }
+
+ $targetClusterId = $targetFabric.Property.CustomProperty.Cluster.ResourceName
+ $targetClusterIdArray = $targetClusterId.Split("/")
+ $targetSubscription = $targetClusterIdArray[2]
+
+ # Get Target cluster
+ $hciClusterArgQuery = GetHCIClusterARGQuery -HCIClusterID $targetClusterId
+ $targetCluster = Az.ResourceGraph\Search-AzGraph -Query $hciClusterArgQuery -Subscription $targetSubscription
+ if ($null -eq $targetCluster) {
+ throw "Validate target cluster with id '$targetClusterId' exists. Check ARC resource bridge is running on this cluster."
+ }
+
+ # Get source appliance RunAsAccount
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $runAsAccounts = Az.Migrate.Internal\Get-AzMigrateHyperVRunAsAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $SiteName `
+ -SubscriptionId $SubscriptionId
+ $runAsAccount = $runAsAccounts | Where-Object { $_.CredentialType -eq $RunAsAccountCredentialTypes.HyperVFabric }
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $runAsAccounts = Az.Migrate\Get-AzMigrateRunAsAccount `
+ -ResourceGroupName $ResourceGroupName `
+ -SiteName $SiteName `
+ -SubscriptionId $SubscriptionId
+ $runAsAccount = $runAsAccounts | Where-Object { $_.CredentialType -eq $RunAsAccountCredentialTypes.VMwareFabric }
+ }
+
+ if ($null -eq $runAsAccount) {
+ throw "No run as account found for site '$SiteName'."
+ }
+
+ # Validate TargetVMName
+ if ($TargetVMName.length -gt 64 -or $TargetVMName.length -eq 0) {
+ throw "The target virtual machine name must be between 1 and 64 characters long."
+ }
+ Import-Module Az.Resources
+ $vmId = $customProperties.TargetResourceGroupId + "/providers/Microsoft.Compute/virtualMachines/" + $TargetVMName
+ $VMNamePresentInRg = Get-AzResource -ResourceId $vmId -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($VMNamePresentInRg) {
+ throw "The target virtual machine name must be unique in the target resource group."
+ }
+
+ if ($TargetVMName -notmatch "^[^_\W][a-zA-Z0-9\-]{0,63}(?+=;,?*@&, whitespace, or begin with '_' or end with '.' or '-'."
+ }
+
+ if (IsReservedOrTrademarked($TargetVMName)) {
+ throw "The target virtual machine name '$TargetVMName' or part of the name is a trademarked or reserved word."
+ }
+
+ $protectedItemProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties]::new()
+ $protectedItemProperties.PolicyName = $policyName
+ $protectedItemProperties.ReplicationExtensionName = $replicationExtensionName
+
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIProtectedItemModelCustomProperties]::new()
+ $isSourceDynamicMemoryEnabled = $machine.IsDynamicMemoryEnabled
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIProtectedItemModelCustomProperties]::new()
+ $isSourceDynamicMemoryEnabled = $false
+ }
+
+ $customProperties.InstanceType = $instanceType
+ $customProperties.CustomLocationRegion = $targetCluster.CustomLocationRegion
+ $customProperties.FabricDiscoveryMachineId = $machine.Id
+ $customProperties.RunAsAccountId = $runAsAccount.Id
+ $customProperties.SourceDraName = $sourceDra.Name
+ $customProperties.StorageContainerId = $TargetStoragePathId
+ $customProperties.TargetArcClusterCustomLocationId = $targetCluster.CustomLocation
+ $customProperties.TargetDraName = $targetDra.Name
+ $customProperties.TargetHciClusterId = $targetClusterId
+ $customProperties.TargetResourceGroupId = $TargetResourceGroupId
+ $customProperties.TargetVMName = $TargetVMName
+ $customProperties.HyperVGeneration = if ($SiteType -eq $SiteTypes.HyperVSites) { $machine.Generation } else { "1" }
+ $customProperties.TargetCpuCore = if ($HasTargetVMCPUCore) { $TargetVMCPUCore } else { $machine.NumberOfProcessorCore }
+ $customProperties.IsDynamicRam = if ($HasIsDynamicMemoryEnabled) { $isDynamicRamEnabled } else { $isSourceDynamicMemoryEnabled }
+
+ # Validate TargetVMRam
+ if ($HasTargetVMRam) {
+ # TargetVMRam needs to be greater than 0
+ if ($TargetVMRam -le 0) {
+ throw "Specify target RAM greater than 0"
+ }
+
+ $customProperties.TargetMemoryInMegaByte = $TargetVMRam
+ }
+ else
+ {
+ $customProperties.TargetMemoryInMegaByte = [System.Math]::Max($machine.AllocatedMemoryInMB, $RAMConfig.MinTargetMemoryInMB)
+ }
+
+ # Construct default dynamic memory config
+ $memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig]::new()
+ $memoryConfig.MinimumMemoryInMegaByte = [System.Math]::Min($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMinDynamicMemoryInMB)
+ $memoryConfig.MaximumMemoryInMegaByte = [System.Math]::Max($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMaxDynamicMemoryInMB)
+ $memoryConfig.TargetMemoryBufferPercentage = $RAMConfig.DefaultTargetMemoryBufferPercentage
+
+ $customProperties.DynamicMemoryConfig = $memoryConfig
+
+ # Disks and Nics
+ [PSCustomObject[]]$disks = @()
+ [PSCustomObject[]]$nics = @()
+ if ($parameterSet -match 'DefaultUser') {
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $osDisk = $machine.Disk | Where-Object { $_.InstanceId -eq $OSDiskID }
+ if ($null -eq $osDisk) {
+ throw "No Disk found with InstanceId '$OSDiskID' from discovered machine disks."
+ }
+
+ $diskName = Split-Path $osDisk.Path -leaf
+ if (IsReservedOrTrademarked($diskName)) {
+ throw "The disk name '$diskName' or part of the name is a trademarked or reserved word."
+ }
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $osDisk = $machine.Disk | Where-Object { $_.Uuid -eq $OSDiskID }
+ if ($null -eq $osDisk) {
+ throw "No Disk found with Uuid '$OSDiskID' from discovered machine disks."
+ }
+
+ $diskName = Split-Path $osDisk.Path -leaf
+ if (IsReservedOrTrademarked($diskName)) {
+ throw "The disk name '$diskName' or part of the name is a trademarked or reserved word."
+ }
+ }
+
+ foreach ($sourceDisk in $machine.Disk) {
+ $diskId = if ($SiteType -eq $SiteTypes.HyperVSites) { $sourceDisk.InstanceId } else { $sourceDisk.Uuid }
+ $diskSize = if ($SiteType -eq $SiteTypes.HyperVSites) { $sourceDisk.MaxSizeInByte } else { $sourceDisk.MaxSizeInBytes }
+
+ $DiskObject = [PSCustomObject]@{
+ DiskId = $diskId
+ DiskSizeGb = [long] [Math]::Ceiling($diskSize / 1GB)
+ DiskFileFormat = "VHDX"
+ IsDynamic = $true
+ IsOSDisk = $diskId -eq $OSDiskID
+ }
+
+ $disks += $DiskObject
+ }
+
+ foreach ($sourceNic in $machine.NetworkAdapter) {
+ $NicObject = [PSCustomObject]@{
+ NicId = $sourceNic.NicId
+ TargetNetworkId = $TargetVirtualSwitchId
+ TestNetworkId = if ($HasTargetTestVirtualSwitchId) { $TargetTestVirtualSwitchId } else { $TargetVirtualSwitchId }
+ SelectionTypeForFailover = "SelectedByUser"
+ }
+ $nics += $NicObject
+ }
+ }
+ else {
+ if ($null -eq $DiskToInclude -or $DiskToInclude.length -eq 0) {
+ throw "Invalid DiskToInclude. At least one disk is required."
+ }
+
+ if ($null -eq $NicToInclude -or $NicToInclude.length -eq 0) {
+ throw "Invalid NicToInclude. At least one NIC is required."
+ }
+
+ # Validate OSDisk is set.
+ $osDisk = $DiskToInclude | Where-Object { $_.IsOSDisk }
+ if (($null -eq $osDisk) -or ($osDisk.length -ne 1)) {
+ throw "Invalid DiskToInclude. One and only one disk must be set as OS Disk."
+ }
+
+ # Validate at least one NIC is selected by user.
+ $selectedNics = $NicToInclude | Where-Object { $_.SelectionTypeForFailover -eq "SelectedByUser"}
+ if ($null -eq $selectedNics -or $selectedNics.length -eq 0) {
+ throw "Invalid NicToInclude. At least one NIC is required to be marked as to be created at target."
+ }
+
+ # Validate DiskToInclude
+ [PSCustomObject[]]$uniqueDisks = @()
+ foreach ($disk in $DiskToInclude) {
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $discoveredDisk = $machine.Disk | Where-Object { $_.InstanceId -eq $disk.DiskId }
+ if ($null -eq $discoveredDisk) {
+ throw "No Disk found with InstanceId '$($disk.DiskId)' from discovered machine disks."
+ }
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $discoveredDisk = $machine.Disk | Where-Object { $_.Uuid -eq $disk.DiskId }
+ if ($null -eq $discoveredDisk) {
+ throw "No Disk found with Uuid '$($disk.DiskId)' from discovered machine disks."
+ }
+ }
+
+ $diskName = Split-Path -Path $discoveredDisk.Path -Leaf
+ if (IsReservedOrTrademarked($diskName)) {
+ throw "The disk name '$diskName' or part of the name is a trademarked or reserved word."
+ }
+
+ if ($uniqueDisks.Contains($disk.DiskId)) {
+ throw "The disk id '$($disk.DiskId)' is already taken."
+ }
+ $uniqueDisks += $disk.DiskId
+
+ $htDisk = @{}
+ $disk.PSObject.Properties | ForEach-Object { $htDisk[$_.Name] = $_.Value }
+ $disks += [PSCustomObject]$htDisk
+ }
+
+ # Validate NicToInclude
+ [PSCustomObject[]]$uniqueNics = @()
+ foreach ($nic in $NicToInclude) {
+ $discoveredNic = $machine.NetworkAdapter | Where-Object { $_.NicId -eq $nic.NicId }
+ if ($null -eq $discoveredNic) {
+ throw "The Nic id '$($nic.NicId)' is not found."
+ }
+
+ if ($uniqueNics.Contains($nic.NicId)) {
+ throw "The Nic id '$($nic.NicId)' is already taken."
+ }
+ $uniqueNics += $nic.NicId
+
+ $htNic = @{}
+ $nic.PSObject.Properties | ForEach-Object { $htNic[$_.Name] = $_.Value }
+ $nics += [PSCustomObject]$htNic
+ }
+
+ # Include Nics not added by user as 'NotSelected'
+ $userGivenNicIds = $nics | Select-Object -ExpandProperty NicId
+ $remainingNics = $machine.NetworkAdapter | Where-Object { $_.NicId -notin $userGivenNicIds }
+ foreach ($remainingNic in $remainingNics) {
+ $NicObject = [PSCustomObject]@{
+ NicId = $remainingNic.NicId
+ TargetNetworkId = $nics[0].TargetNetworkId
+ TestNetworkId = $nics[0].TestNetworkId
+ SelectionTypeForFailover = "NotSelected"
+ }
+ $nics += $NicObject
+ }
+ }
+
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIDiskInput[]]$disks
+ $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCINicInput[]]$nics
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIDiskInput[]]$disks
+ $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCINicInput[]]$nics
+ }
+
+ $protectedItemProperties.CustomProperty = $customProperties
+
+ if ($PSCmdlet.ShouldProcess($MachineId, "Replicate VM.")) {
+ $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
+ $null = $PSBoundParameters.Add('VaultName', $vaultName)
+ $null = $PSBoundParameters.Add('Name', $MachineName)
+ $null = $PSBoundParameters.Add('Property', $protectedItemProperties)
+ $null = $PSBoundParameters.Add('NoWait', $true)
+
+ $operation = Az.Migrate.Internal\New-AzMigrateProtectedItem @PSBoundParameters
+ $jobName = $operation.Target.Split("/")[-1].Split("?")[0]
+
+ $null = $PSBoundParameters.Remove('Name')
+ $null = $PSBoundParameters.Remove('Property')
+ $null = $PSBoundParameters.Remove('NoWait')
+
+ $null = $PSBoundParameters.Add('JobName', $jobName)
+ return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/README.md b/src/Migrate/Migrate.Autorest/custom/README.md
index 3fd127c483e0..a268d35afb1d 100644
--- a/src/Migrate/Migrate.Autorest/custom/README.md
+++ b/src/Migrate/Migrate.Autorest/custom/README.md
@@ -12,7 +12,7 @@ For `Az.Migrate` to use custom cmdlets, it does this two different ways. We **hi
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.Migrate.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.
-For script cmdlets, these are loaded via the `Az.Migrate.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
+For script cmdlets, these are loaded via the `Az.Migrate.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
## Purpose
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
@@ -32,10 +32,10 @@ These provide functionality to our HTTP pipeline and other useful features. In s
### Attributes
For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.DescriptionAttribute`
- - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
+ - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Migrate`.
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExportAttribute`
- - Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.Migrate`. For more information, see [readme.md](../internal/readme.md) in the `../internal` folder.
+ - Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.Migrate`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1
new file mode 100644
index 000000000000..dee3a73c9f0f
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1
@@ -0,0 +1,153 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Stops replication for the migrated server.
+.Description
+The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication
+#>
+function Remove-AzMigrateHCIServerReplication {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ByID', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')]
+ param(
+ [Parameter(ParameterSetName = 'ByID', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the replcating server for which the replication needs to be disabled. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+ ${TargetObjectID},
+
+ [Parameter(ParameterSetName = 'ByInputObject', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity]
+ # Specifies the replcating server for which the replication needs to be disabled. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+ ${InputObject},
+
+ [Parameter()]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')]
+ [System.String]
+ # Specifies whether the replication needs to be force removed. Default to "false".
+ ${ForceRemove} = "false",
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ $shouldForceRemove = [System.Convert]::ToBoolean($ForceRemove)
+ $null = $PSBoundParameters.Remove('ForceRemove')
+ $null = $PSBoundParameters.Remove('TargetObjectID')
+ $null = $PSBoundParameters.Remove('InputObject')
+ $null = $PSBoundParameters.Remove('WhatIf')
+ $null = $PSBoundParameters.Remove('Confirm')
+ $parameterSet = $PSCmdlet.ParameterSetName
+
+ if ($parameterSet -eq 'ByInputObject') {
+ $TargetObjectID = $InputObject.Id
+ }
+ $protectedItemIdArray = $TargetObjectID.Split("/")
+ $resourceGroupName = $protectedItemIdArray[4]
+ $vaultName = $protectedItemIdArray[8]
+ $protectedItemName = $protectedItemIdArray[10]
+
+ $null = $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName)
+ $null = $PSBoundParameters.Add("VaultName", $vaultName)
+ $null = $PSBoundParameters.Add("Name", $protectedItemName)
+
+ $protectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($null -eq $ProtectedItem)
+ {
+ throw "Replication item is not found with Id '$TargetObjectID'."
+ }
+
+ $null = $PSBoundParameters.Remove('Name')
+
+ if ("DisableProtection" -notin $ProtectedItem.Property.AllowedJob)
+ {
+ throw "Replication item with Id '$TargetObjectID' cannot be removed at this moment. Current protection state is '$($protectedItem.Property.ProtectionStateDescription)'."
+ }
+
+ $null = $PSBoundParameters.Add('ProtectedItemName', $protectedItemName)
+ $null = $PSBoundParameters.Add('NoWait', $true)
+ $null = $PSBoundParameters.Add('ForceDelete', $shouldForceRemove)
+
+ if ($PSCmdlet.ShouldProcess($TargetObjectID, "Stop/Complete VM replication.")) {
+ $operation = Az.Migrate.Internal\Remove-AzMigrateProtectedItem @PSBoundParameters
+ $jobName = $operation.Target.Split("/")[-1].Split("?")[0]
+
+ $null = $PSBoundParameters.Remove('ProtectedItemName')
+ $null = $PSBoundParameters.Remove('NoWait')
+ $null = $PSBoundParameters.Remove('ForceDelete')
+
+ $null = $PSBoundParameters.Add('JobName', $jobName)
+ return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1
index 2800eebd7bb5..5825121ca4da 100644
--- a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1
+++ b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1
@@ -28,13 +28,13 @@ function Remove-AzMigrateServerReplication {
[Parameter(ParameterSetName = 'ByIDVMwareCbt', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
- # Specifies the replcating server for which the replicatio needs to be disabled. The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet.
+ # Specifies the replcating server for which the replication needs to be disabled. The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet.
${TargetObjectID},
[Parameter(ParameterSetName = 'ByInputObjectVMwareCbt', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem]
- # Specifies the machine object of the replicating server.
+ # Specifies the replcating server for which the replication needs to be disabled. The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet.
${InputObject},
[Parameter()]
diff --git a/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1
new file mode 100644
index 000000000000..ced599ff90d4
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1
@@ -0,0 +1,328 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Updates the target properties for the replicating server.
+.Description
+The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication
+#>
+function Set-AzMigrateHCIServerReplication {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ById', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')]
+ param(
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the replicating server for which the properties need to be updated. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+ ${TargetObjectID},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the target VM name.
+ ${TargetVMName},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Int32]
+ # Specifies the number of CPU cores.
+ ${TargetVMCPUCore},
+
+ [Parameter()]
+ [ValidateSet("true" , "false")]
+ [ArgumentCompleter( { "true" , "false" })]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies if RAM is dynamic or not.
+ ${IsDynamicMemoryEnabled},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig]
+ # Specifies the dynamic memory configration of RAM.
+ ${DynamicMemoryConfig},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Int64]
+ # Specifies the target RAM size in MB.
+ ${TargetVMRam},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]]
+ # Specifies the nics on the source server to be included for replication.
+ ${NicToInclude},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # The subscription Id.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1
+ Import-Module $PSScriptRoot\Helper\CommonHelper.ps1
+
+ CheckResourcesModuleDependency
+
+ $HasTargetVMName = $PSBoundParameters.ContainsKey('TargetVMName')
+ $HasTargetVMCPUCore = $PSBoundParameters.ContainsKey('TargetVMCPUCore')
+ $HasIsDynamicMemoryEnabled = $PSBoundParameters.ContainsKey('IsDynamicMemoryEnabled')
+ if ($HasIsDynamicMemoryEnabled) {
+ $isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled)
+ }
+ $HasDynamicMemoryConfig = $PSBoundParameters.ContainsKey('DynamicMemoryConfig')
+ $HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam')
+ $HasNicToInclude = $PSBoundParameters.ContainsKey('NicToInclude')
+
+ $null = $PSBoundParameters.Remove('TargetVMName')
+ $null = $PSBoundParameters.Remove('TargetVMCPUCore')
+ $null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled')
+ $null = $PSBoundParameters.Remove('DynamicMemoryConfig')
+ $null = $PSBoundParameters.Remove('TargetVMRam')
+ $null = $PSBoundParameters.Remove('NicToInclude')
+ $null = $PSBoundParameters.Remove('TargetObjectID')
+ $null = $PSBoundParameters.Remove('WhatIf')
+ $null = $PSBoundParameters.Remove('Confirm')
+
+ $ProtectedItemIdArray = $TargetObjectID.Split("/")
+ $ResourceGroupName = $ProtectedItemIdArray[4]
+ $VaultName = $ProtectedItemIdArray[8]
+ $MachineName = $ProtectedItemIdArray[10]
+
+ $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName)
+ $null = $PSBoundParameters.Add("VaultName", $VaultName)
+ $null = $PSBoundParameters.Add("Name", $MachineName)
+
+ $ProtectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($null -eq $ProtectedItem) {
+ throw "Replication item is not found with Id '$TargetObjectID'."
+ }
+
+ $null = $PSBoundParameters.Remove("ResourceGroupName")
+ $null = $PSBoundParameters.Remove("VaultName")
+ $null = $PSBoundParameters.Remove("Name")
+
+ $protectedItemProperties = $ProtectedItem.Property
+ $customProperties = $protectedItemProperties.CustomProperty
+ $MachineIdArray = $customProperties.FabricDiscoveryMachineId.Split("/")
+ $SiteType = $MachineIdArray[7]
+
+ if (!$protectedItemProperties.AllowedJob.Contains('PlannedFailover')) {
+ throw "Set server replication is not allowed for this item '$TargetObjectID'."
+ }
+
+ if ($HasTargetVMName) {
+ if ($TargetVMName.length -gt 64 -or $TargetVMName.length -eq 0) {
+ throw "The target virtual machine name must be between 1 and 64 characters long."
+ }
+
+ Import-Module Az.Resources
+ $vmId = $customProperties.TargetResourceGroupId + "/providers/Microsoft.Compute/virtualMachines/" + $TargetVMName
+ $VMNamePresentInRg = Get-AzResource -ResourceId $vmId -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($VMNamePresentInRg) {
+ throw "The target virtual machine name must be unique in the target resource group."
+ }
+
+ if ($TargetVMName -notmatch "^[^_\W][a-zA-Z0-9\-]{0,63}(?+=;,?*@&, whitespace, or begin with '_' or end with '.' or '-'."
+ }
+
+ if (IsReservedOrTrademarked($TargetVMName)) {
+ throw "The target virtual machine name '$TargetVMName' or part of the name is a trademarked or reserved word."
+ }
+
+ $customProperties.TargetVMName = $TargetVMName
+ }
+
+ if ($HasTargetVMCPUCore) {
+ if ($TargetVMCPUCore -le 0) {
+ throw "Specify target CPU core greater than 0"
+ }
+
+ $customProperties.TargetCpuCore = $TargetVMCPUCore
+ }
+
+ # Validate TargetVMRam
+ if ($HasTargetVMRam) {
+ if ($TargetVMRam -le 0) {
+ throw "Specify target RAM greater than 0"
+ }
+
+ $customProperties.TargetMemoryInMegaByte = $TargetVMRam
+ }
+
+ if ($HasIsDynamicMemoryEnabled) {
+ $customProperties.IsDynamicRam = $isDynamicRamEnabled
+ }
+
+ # Dynamic memory enabled & DynamicMemoryConfig supplied
+ if ($customProperties.IsDynamicRam -and $HasDynamicMemoryConfig) {
+ if ($customProperties.TargetMemoryInMegaByte -lt $DynamicMemoryConfig.MinimumMemoryInMegaByte) {
+ throw "DynamicMemoryConfig - Specify minimum memory less than $($customProperties.TargetMemoryInMegaByte)"
+ }
+
+ if ($customProperties.TargetMemoryInMegaByte -gt $DynamicMemoryConfig.MaximumMemoryInMegaByte) {
+ throw "DynamicMemoryConfig - Specify maximum memory greater than $($customProperties.TargetMemoryInMegaByte)"
+ }
+
+ if ($DynamicMemoryConfig.TargetMemoryBufferPercentage -NotIn $RAMConfig.MinTargetMemoryBufferPercentage..$RAMConfig.MaxTargetMemoryBufferPercentage)
+ {
+ throw "DynamicMemoryConfig - Specify target memory buffer percentage between $($RAMConfig.MinTargetMemoryBufferPercentage) % and $($RAMConfig.MaxTargetMemoryBufferPercentage) %."
+ }
+
+ $customProperties.DynamicMemoryConfig = $DynamicMemoryConfig
+ }
+
+ # Dynamic memory is newly enabled and needs a default
+ if ($customProperties.IsDynamicRam -and $null -eq $customProperties.DynamicMemoryConfig) {
+ $memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig]::new()
+ $memoryConfig.MinimumMemoryInMegaByte = [System.Math]::Min($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMinDynamicMemoryInMB)
+ $memoryConfig.MaximumMemoryInMegaByte = [System.Math]::Max($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMaxDynamicMemoryInMB)
+ $memoryConfig.TargetMemoryBufferPercentage = $RAMConfig.DefaultTargetMemoryBufferPercentage
+
+ $customProperties.DynamicMemoryConfig = $memoryConfig
+ }
+
+ # Nics
+ [PSCustomObject[]]$nics = @()
+ foreach ($nic in $customProperties.ProtectedNic) {
+ $NicObject = [PSCustomObject]@{
+ NicId = $nic.NicId
+ TargetNetworkId = $nic.TargetNetworkId
+ TestNetworkId = $nic.TestNetworkId
+ SelectionTypeForFailover = $nic.SelectionTypeForFailover
+ }
+
+ $nics += $NicObject
+ }
+
+ if ($HasNicToInclude -and $NicToInclude.length -gt 0) {
+ foreach ($nic in $NicToInclude)
+ {
+ $updatedNic = $nics | Where-Object { $_.NicId -eq $nic.NicId }
+ if ($null -eq $updatedNic){
+ throw "The Nic id '$($nic.NicId)' is not found."
+ }
+
+ $updatedNic.TargetNetworkId = $nic.TargetNetworkId
+ $updatedNic.TestNetworkId = $nic.TestNetworkId
+ $updatedNic.SelectionTypeForFailover = $nic.SelectionTypeForFailover
+ }
+ }
+
+ $selectedNics = $nics | Where-Object { $_.SelectionTypeForFailover -eq "SelectedByUser" }
+ if ($null -eq $selectedNics -or $selectedNics.length -eq 0)
+ {
+ throw "At least one NIC must be selected for creation at target."
+ }
+
+ # Disks
+ [PSCustomObject[]]$disks = @()
+ foreach ($disk in $customProperties.ProtectedDisk) {
+ $DiskObject = [PSCustomObject]@{
+ DiskId = $disk.SourceDiskId
+ DiskSizeGb = [long] [Math]::Ceiling($disk.CapacityInByte/1GB)
+ DiskFileFormat = $disk.DiskType
+ IsDynamic = $disk.IsDynamic
+ IsOSDisk = $disk.IsOSDisk
+ }
+
+ $disks += $DiskObject
+ }
+
+ if ($SiteType -eq $SiteTypes.HyperVSites) {
+ $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIDiskInput[]]$disks
+ $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCINicInput[]]$nics
+ }
+ elseif ($SiteType -eq $SiteTypes.VMwareSites) {
+ $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIDiskInput[]]$disks
+ $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCINicInput[]]$nics
+ }
+
+ $protectedItemProperties.CustomProperty = $customProperties
+
+ $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
+ $null = $PSBoundParameters.Add('VaultName', $vaultName)
+ $null = $PSBoundParameters.Add('Name', $MachineName)
+ $null = $PSBoundParameters.Add('Property', $protectedItemProperties)
+ $null = $PSBoundParameters.Add('NoWait', $true)
+
+ if ($PSCmdlet.ShouldProcess($TargetObjectID, "Updates VM replication.")) {
+ $operation = Az.Migrate.Internal\New-AzMigrateProtectedItem @PSBoundParameters
+ $jobName = $operation.Target.Split("/")[-1].Split("?")[0]
+
+ $null = $PSBoundParameters.Remove('Name')
+ $null = $PSBoundParameters.Remove('Property')
+ $null = $PSBoundParameters.Remove('NoWait')
+
+ $null = $PSBoundParameters.Add('JobName', $jobName)
+ return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1 b/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1
new file mode 100644
index 000000000000..758f7a9a1087
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1
@@ -0,0 +1,179 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Starts the migration for the replicating server.
+.Description
+Starts the migration for the replicating server.
+.Link
+https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration
+#>
+function Start-AzMigrateHCIServerMigration {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])]
+ [CmdletBinding(DefaultParameterSetName = 'ByID', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')]
+ param(
+ [Parameter(ParameterSetName = 'ByID', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.String]
+ # Specifies the replcating server for which migration needs to be initiated. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+ ${TargetObjectID},
+
+ [Parameter(ParameterSetName = 'ByInputObject', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity]
+ # Specifies the replicating server for which migration needs to be initiated. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+ ${InputObject},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [System.Management.Automation.SwitchParameter]
+ # Specifies whether the source server should be turned off post migration.
+ ${TurnOffSourceServer},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Azure Subscription ID.
+ ${SubscriptionId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ )
+
+ process {
+ $performShutDown = $TurnOffSourceServer.IsPresent
+ $null = $PSBoundParameters.Remove('ProjectName')
+ $null = $PSBoundParameters.Remove('MachineName')
+ $null = $PSBoundParameters.Remove('TurnOffSourceServer')
+ $null = $PSBoundParameters.Remove('TargetObjectID')
+ $null = $PSBoundParameters.Remove('ResourceGroupName')
+ $null = $PSBoundParameters.Remove('InputObject')
+ $null = $PSBoundParameters.Remove('WhatIf')
+ $null = $PSBoundParameters.Remove('Confirm')
+
+ $parameterSet = $PSCmdlet.ParameterSetName
+
+ if ($parameterSet -eq 'ByInputObject') {
+ $TargetObjectID = $InputObject.Id
+ }
+
+ $protectedItemIdArray = $TargetObjectID.Split("/")
+ $resourceGroupName = $protectedItemIdArray[4]
+ $vaultName = $protectedItemIdArray[8]
+ $protectedItemName = $protectedItemIdArray[10]
+
+ $null = $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName)
+ $null = $PSBoundParameters.Add("VaultName", $vaultName)
+ $null = $PSBoundParameters.Add("Name", $protectedItemName)
+
+ $protectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
+ if ($null -eq $protectedItem) {
+ throw "The replicating server doesn't exist. Please check the input and try again."
+ }
+ elseif (
+ (!$protectedItem.Property.AllowedJob.contains("PlannedFailover")) -and
+ (!$ProtectedItem.Property.AllowedJob.contains("Restart"))) {
+ # AllowJob must contains either 'PlannedFailover' or 'Restart' to allow migration
+ throw "The replicating server cannot be migrated right now. Current protection state is '$($protectedItem.Property.ProtectionStateDescription)'."
+ }
+
+ $null = $PSBoundParameters.Remove("ResourceGroupName")
+ $null = $PSBoundParameters.Remove("VaultName")
+ $null = $PSBoundParameters.Remove("Name")
+
+ # Get the instance type from the protected item
+ $instanceType = $protectedItem.Property.CustomProperty.InstanceType
+
+ # Setup PlannedFailover deployment parameters
+ $properties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelProperties]::new()
+
+ if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) {
+ $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciPlannedFailoverModelCustomProperties]::new()
+ }
+ elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) {
+ $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciPlannedFailoverModelCustomProperties]::new()
+ }
+ else {
+ throw "Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported."
+ }
+ $customProperties.InstanceType = $instanceType
+ $customProperties.ShutdownSourceVM = $performShutDown
+ $properties.CustomProperty = $customProperties
+
+ $null = $PSBoundParameters.Add('ResourceGroupName', $resourceGroupName)
+ $null = $PSBoundParameters.Add('VaultName', $vaultName)
+ $null = $PSBoundParameters.Add('ProtectedItemName', $protectedItemName)
+ $null = $PSBoundParameters.Add('NoWait', $true)
+ $null = $PSBoundParameters.Add('Property', $properties)
+
+ if ($PSCmdlet.ShouldProcess($TargetObjectID, "Migrate VM.")) {
+ $operation = Az.Migrate.Internal\Invoke-AzMigratePlannedProtectedItemFailover @PSBoundParameters
+ $jobName = $operation.Target.Split("/")[-1].Split("?")[0]
+
+ $null = $PSBoundParameters.Remove('ProtectedItemName')
+ $null = $PSBoundParameters.Remove('NoWait')
+ $null = $PSBoundParameters.Remove('Property')
+
+ $null = $PSBoundParameters.Add('JobName', $jobName)
+ return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md b/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md
index e0abaa829c5c..c3af3fde38d1 100644
--- a/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md
+++ b/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md
@@ -14,6 +14,15 @@ Microsoft Azure PowerShell: Migrate cmdlets
### [Get-AzMigrateDiscoveredServer](Get-AzMigrateDiscoveredServer.md)
Get All discovered servers in a migrate project.
+### [Get-AzMigrateHCIJob](Get-AzMigrateHCIJob.md)
+Retrieves the status of an Azure Migrate job.
+
+### [Get-AzMigrateHCIReplicationFabric](Get-AzMigrateHCIReplicationFabric.md)
+Gets the details of the fabric.
+
+### [Get-AzMigrateHCIServerReplication](Get-AzMigrateHCIServerReplication.md)
+Retrieves the details of the replicating server.
+
### [Get-AzMigrateJob](Get-AzMigrateJob.md)
Retrieves the status of an Azure Migrate job.
@@ -47,12 +56,24 @@ Method to get a site.
### [Get-AzMigrateSolution](Get-AzMigrateSolution.md)
Gets a solution in the migrate project.
+### [Initialize-AzMigrateHCIReplicationInfrastructure](Initialize-AzMigrateHCIReplicationInfrastructure.md)
+Initializes the infrastructure for the migrate project.
+
### [Initialize-AzMigrateReplicationInfrastructure](Initialize-AzMigrateReplicationInfrastructure.md)
Initialises the infrastructure for the migrate project.
### [New-AzMigrateDiskMapping](New-AzMigrateDiskMapping.md)
Creates a new disk mapping
+### [New-AzMigrateHCIDiskMappingObject](New-AzMigrateHCIDiskMappingObject.md)
+Creates a new disk mapping
+
+### [New-AzMigrateHCINicMappingObject](New-AzMigrateHCINicMappingObject.md)
+Creates an object to update NIC properties of a replicating server.
+
+### [New-AzMigrateHCIServerReplication](New-AzMigrateHCIServerReplication.md)
+Starts replication for the specified server.
+
### [New-AzMigrateNicMapping](New-AzMigrateNicMapping.md)
Creates an object to update NIC properties of a replicating server.
@@ -68,12 +89,15 @@ The operation to create a protection container mapping.
### [New-AzMigrateServerReplication](New-AzMigrateServerReplication.md)
Starts replication for the specified server.
-### [New-AzTestMigrateNicMapping](New-AzTestMigrateNicMapping.md)
+### [New-AzMigrateTestNicMapping](New-AzMigrateTestNicMapping.md)
Creates an object to update NIC properties of a test migrating server.
### [Register-AzMigrateProjectTool](Register-AzMigrateProjectTool.md)
Registers a tool with the migrate project.
+### [Remove-AzMigrateHCIServerReplication](Remove-AzMigrateHCIServerReplication.md)
+Stops replication for the migrated server.
+
### [Remove-AzMigrateProject](Remove-AzMigrateProject.md)
Delete the migrate project.
Deleting non-existent project is a no-operation.
@@ -90,9 +114,15 @@ Starts the replication that has been suspended.
### [Set-AzMigrateDiskMapping](Set-AzMigrateDiskMapping.md)
Updates disk mapping
+### [Set-AzMigrateHCIServerReplication](Set-AzMigrateHCIServerReplication.md)
+Updates the target properties for the replicating server.
+
### [Set-AzMigrateServerReplication](Set-AzMigrateServerReplication.md)
Updates the target properties for the replicating server.
+### [Start-AzMigrateHCIServerMigration](Start-AzMigrateHCIServerMigration.md)
+Starts the migration for the replicating server.
+
### [Start-AzMigrateServerMigration](Start-AzMigrateServerMigration.md)
Starts the migration for the replicating server.
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateDiscoveredServer.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateDiscoveredServer.md
index 514d6e43ba0b..b16dcdcebcc6 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateDiscoveredServer.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateDiscoveredServer.md
@@ -15,25 +15,27 @@ Get All discovered servers in a migrate project.
### List (Default)
```
Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-DisplayName ]
- [-SubscriptionId ] [-Confirm] [-WhatIf] []
+ [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] []
```
### Get
```
Get-AzMigrateDiscoveredServer -Name -ProjectName -ResourceGroupName
- [-SubscriptionId ] [-Confirm] [-WhatIf] []
+ [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] []
```
### GetInSite
```
Get-AzMigrateDiscoveredServer -ApplianceName -Name -ProjectName
- -ResourceGroupName [-SubscriptionId ] [-Confirm] [-WhatIf] []
+ -ResourceGroupName [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf]
+ []
```
### ListInSite
```
Get-AzMigrateDiscoveredServer -ApplianceName -ProjectName -ResourceGroupName
- [-DisplayName ] [-SubscriptionId ] [-Confirm] [-WhatIf] []
+ [-DisplayName ] [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf]
+ []
```
## DESCRIPTION
@@ -41,7 +43,7 @@ Get Azure migrate server commandlet fetches all servers in a migrate project.
## EXAMPLES
-### Example 1: List
+### Example 1: List VMware machines
```powershell
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
```
@@ -64,7 +66,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-ef
Get All servers in a migrate project.
-### Example 2: Get
+### Example 2: Get VMware machine
```powershell
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
```
@@ -79,7 +81,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31
Get a server in a migrate project by name.
Name is a unique paramenter for a server.
-### Example 3: List in an appliance
+### Example 3: List VMware machines in an appliance
```powershell
Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
```
@@ -102,7 +104,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-ef
List all servers for an appliance in a project.
-### Example 4: Get in an appliance
+### Example 4: Get VMware machine in an appliance
```powershell
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
```
@@ -117,7 +119,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31
Get a server for an appliance in a project.
Name is a unique paramenter for a server.
-### Example 5: List and filter by display name
+### Example 5: List and filter VMware machines by display name
```powershell
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type
```
@@ -137,7 +139,7 @@ ContosoAppSrv1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5
List servers in a migrate project and filter responses with display name.
-### Example 6: List in an appliance and filter by display name
+### Example 6: List VMware machines in an appliance and filter by display name
```powershell
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type
```
@@ -157,6 +159,23 @@ Contoso-DataTier3 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5
List servers for an appliance in a migrate project and filter responses with display name.
+### Example 7: List HyperV machines
+```powershell
+Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type
+```
+
+```output
+DisplayName Name Type
+----------- ---- ----
+testvm1 291b6c67-8793-4e21-887e-1e6c3bd00a60 Microsoft.OffAzure/HyperVSites/machines
+testvm2 0fbd6ccb-7133-4e72-b18e-5ec98c9c628f Microsoft.OffAzure/HyperVSites/machines
+testvm3 e6390dfa-6125-431c-871d-f407bdecb571 Microsoft.OffAzure/HyperVSites/machines
+testvm4 af83b64b-2314-48e2-8d0f-fd44ab5142ba Microsoft.OffAzure/HyperVSites/machines
+```
+
+Get All HyperV servers in a migrate project.
+Similarly, specify "HyperV" for -SourceMachineType in all the above examples can retrieve HyperV machine(s) in different ways.
+
## PARAMETERS
### -ApplianceName
@@ -176,7 +195,7 @@ Accept wildcard characters: False
```
### -DisplayName
-Specifies the VMware machine display name.
+Specifies the source machine display name.
```yaml
Type: System.String
@@ -191,7 +210,7 @@ Accept wildcard characters: False
```
### -Name
-Specifies the VMware machine name.
+Specifies the source machine name.
This is an internal Name.
For users, use display name.
@@ -237,6 +256,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -SourceMachineType
+Specifies the source machine type.
+Currently, only HyperV and VMware are supported.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### -SubscriptionId
Specifies the subscription id.
@@ -290,11 +325,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## OUTPUTS
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine
+
### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIJob.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIJob.md
new file mode 100644
index 000000000000..9e61b77f15ec
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIJob.md
@@ -0,0 +1,467 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob
+schema: 2.0.0
+---
+
+# Get-AzMigrateHCIJob
+
+## SYNOPSIS
+Retrieves the status of an Azure Migrate job.
+
+## SYNTAX
+
+### ListByName (Default)
+```
+Get-AzMigrateHCIJob -ProjectName -ResourceGroupName [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### GetById
+```
+Get-AzMigrateHCIJob -ID [-SubscriptionId ] [-DefaultProfile ] []
+```
+
+### GetByInputObject
+```
+Get-AzMigrateHCIJob -InputObject [-SubscriptionId ] [-DefaultProfile ]
+ []
+```
+
+### GetByName
+```
+Get-AzMigrateHCIJob -Name -ProjectName -ResourceGroupName
+ [-SubscriptionId ] [-DefaultProfile ] []
+```
+
+### ListById
+```
+Get-AzMigrateHCIJob -ProjectID -ResourceGroupID [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job.
+
+## EXAMPLES
+
+### Example 1: Get by job Id
+```powershell
+Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a
+Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001
+ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df
+ObjectInternalName : testmachine1
+ObjectName : testsite-0000-0000-00000001
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/14/2023 7:09:10 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Retrieves a job by its Id.
+
+### Example 2: Get by job name
+```powershell
+Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a
+Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001
+ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df
+ObjectInternalName : testmachine1
+ObjectName : testsite-0000-0000-00000001
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/14/2023 7:09:10 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Retrieves a job by its name.
+
+### Example 3: Get by job input object
+```powershell
+$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a"
+
+Get-AzMigrateHCIJob -InputObject $InputObject
+
+$InputObject | Get-AzMigrateHCIJob
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a
+Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001
+ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df
+ObjectInternalName : testmachine1
+ObjectName : testsite-0000-0000-00000001
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/14/2023 7:09:10 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Retrieves a job by the job itself as an input object.
+
+### Example 4: List by resource group Id and project Id.
+```powershell
+Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a
+Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001
+ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df
+ObjectInternalName : testmachine1
+ObjectName : testsite-0000-0000-00000001
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/14/2023 7:09:10 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType :
+DisplayName : Planned failover
+EndTime : 8/11/2023 10:09:18 PM
+Error :
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed
+Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover
+ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2
+ObjectInternalName : testmachine2
+ObjectName : testsite-0000-0000-00000000
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/11/2023 9:53:48 PM
+State : Succeeded
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task :
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Retrieves all the jobs from a project in some resource group by Ids.
+
+### Example 5: List by resource group name and project name.
+```powershell
+Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a
+Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001
+ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df
+ObjectInternalName : testmachine1
+ObjectName : testsite-0000-0000-00000001
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/14/2023 7:09:10 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType :
+DisplayName : Planned failover
+EndTime : 8/11/2023 10:09:18 PM
+Error :
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed
+Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication
+ /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover
+ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2
+ObjectInternalName : testmachine2
+ObjectName : testsite-0000-0000-00000000
+ObjectType : ProtectedItem
+ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16
+SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7
+StartTime : 8/11/2023 9:53:48 PM
+State : Succeeded
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task :
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Retrieves all the jobs from a project in some resource group by names.
+
+## PARAMETERS
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ID
+Specifies the job id for which the details needs to be retrieved.
+
+```yaml
+Type: System.String
+Parameter Sets: GetById
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -InputObject
+Specifies the job object of the replicating server.
+To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+Parameter Sets: GetByInputObject
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -Name
+Job identifier
+
+```yaml
+Type: System.String
+Parameter Sets: GetByName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectID
+Specifies the Azure Migrate Project in which servers are replicating.
+
+```yaml
+Type: System.String
+Parameter Sets: ListById
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectName
+The name of the migrate project.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByName, ListByName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupID
+Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+
+```yaml
+Type: System.String
+Parameter Sets: ListById
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupName
+The name of the resource group where the recovery services vault is present.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByName, ListByName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription ID.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIReplicationFabric.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIReplicationFabric.md
new file mode 100644
index 000000000000..174bb715d632
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIReplicationFabric.md
@@ -0,0 +1,273 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric
+schema: 2.0.0
+---
+
+# Get-AzMigrateHCIReplicationFabric
+
+## SYNOPSIS
+Gets the details of the fabric.
+
+## SYNTAX
+
+### List (Default)
+```
+Get-AzMigrateHCIReplicationFabric [-SubscriptionId ] [-ContinuationToken ]
+ [-DefaultProfile ] []
+```
+
+### Get
+```
+Get-AzMigrateHCIReplicationFabric -Name -ResourceGroupName [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### GetViaIdentity
+```
+Get-AzMigrateHCIReplicationFabric -InputObject [-DefaultProfile ]
+ []
+```
+
+### List1
+```
+Get-AzMigrateHCIReplicationFabric -ResourceGroupName [-SubscriptionId ]
+ [-ContinuationToken ] [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+Gets the details of the fabric.
+
+## EXAMPLES
+
+### Example 1: Get by fabric name
+```powershell
+Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric"
+```
+
+```output
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric
+Location : southeastasia
+Name : testsrcappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 6:39:04 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+```
+
+Retrieves a fabric by its name.
+
+### Example 2: Get by fabric input object
+```powershell
+$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric"
+
+Get-AzMigrateHCIReplicationFabric -InputObject $InputObject
+
+$InputObject | Get-AzMigrateHCIReplicationFabric
+```
+
+```output
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric
+Location : southeastasia
+Name : testsrcappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 6:39:04 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+```
+
+Retrieves a fabric by the fabric itself as an input object.
+
+### Example 3: List by resource group name
+```powershell
+Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg"
+```
+
+```output
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric
+Location : southeastasia
+Name : testsrcappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 6:39:04 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric
+Location : southeastasia
+Name : testtgtappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 9:16:46 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+```
+
+Retrieves all fabrics from a resource group by name.
+
+### Example 4: List all fabircs
+```powershell
+Get-AzMigrateHCIReplicationFabric
+```
+
+```output
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric
+Location : southeastasia
+Name : testsrcappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 6:39:04 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric
+Location : southeastasia
+Name : testtgtappreplicationfabric
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties
+SystemDataCreatedAt : 8/11/2023 9:16:46 PM
+SystemDataCreatedBy : testuser@example.com
+SystemDataCreatedByType : User
+SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM
+SystemDataLastModifiedBy : testuser@example.com
+SystemDataLastModifiedByType : User
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags
+Type : Microsoft.DataReplication/replicationFabrics
+
+...
+```
+
+Retrieves all fabrics from a subscription.
+
+## PARAMETERS
+
+### -ContinuationToken
+Continuation token from the previous call.
+
+```yaml
+Type: System.String
+Parameter Sets: List, List1
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -InputObject
+Identity Parameter
+To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+Parameter Sets: GetViaIdentity
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -Name
+The fabric name.
+
+```yaml
+Type: System.String
+Parameter Sets: Get
+Aliases: FabricName
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupName
+The name of the resource group.
+The name is case insensitive.
+
+```yaml
+Type: System.String
+Parameter Sets: Get, List1
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription Id in which migrate project was created.
+
+```yaml
+Type: System.String[]
+Parameter Sets: Get, List, List1
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIServerReplication.md
new file mode 100644
index 000000000000..4c49d90a6883
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateHCIServerReplication.md
@@ -0,0 +1,300 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication
+schema: 2.0.0
+---
+
+# Get-AzMigrateHCIServerReplication
+
+## SYNOPSIS
+Retrieves the details of the replicating server.
+
+## SYNTAX
+
+### ListByName (Default)
+```
+Get-AzMigrateHCIServerReplication -ProjectName -ResourceGroupName [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### GetByInputObject
+```
+Get-AzMigrateHCIServerReplication -InputObject [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### GetByItemID
+```
+Get-AzMigrateHCIServerReplication -TargetObjectID [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### GetByMachineName
+```
+Get-AzMigrateHCIServerReplication -MachineName -ProjectName -ResourceGroupName
+ [-SubscriptionId ] [-DefaultProfile ] []
+```
+
+### GetBySDSID
+```
+Get-AzMigrateHCIServerReplication -DiscoveredMachineId [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+### ListById
+```
+Get-AzMigrateHCIServerReplication -ProjectID -ResourceGroupID [-SubscriptionId ]
+ [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server.
+
+## EXAMPLES
+
+### Example 1: Get details by id
+```powershell
+Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5'
+```
+
+```output
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5
+Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags
+Type : Microsoft.DataReplication/replicationVaults/protectedItems
+```
+
+Get by id.
+
+### Example 2: Get detail by discovered machine id
+```powershell
+Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5"
+
+```
+
+```output
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5
+Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags
+Type : Microsoft.DataReplication/replicationVaults/protectedItems
+```
+
+Get by discovered machine id.
+
+### Example 3: List all in project by name
+```powershell
+Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName
+```
+
+```output
+
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5
+Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags
+Type : Microsoft.DataReplication/replicationVaults/protectedItems
+
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/d758f4fb-ae5e-4ac8-bb97-1e114555fe9f
+Name : d758f4fb-ae5e-4ac8-bb97-1e114555fe9f
+Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags
+Type : Microsoft.DataReplication/replicationVaults/protectedItems
+```
+
+List all.
+
+## PARAMETERS
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DiscoveredMachineId
+Specifies the machine ID of the discovered server.
+
+```yaml
+Type: System.String
+Parameter Sets: GetBySDSID
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -InputObject
+Specifies the machine object of the replicating server.
+To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+Parameter Sets: GetByInputObject
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -MachineName
+Specifies the display name of the replicating machine.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByMachineName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectID
+Specifies the Azure Migrate Project in which servers are replicating.
+
+```yaml
+Type: System.String
+Parameter Sets: ListById
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectName
+Specifies the Azure Migrate project in the current subscription.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByMachineName, ListByName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupID
+Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+
+```yaml
+Type: System.String
+Parameter Sets: ListById
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupName
+Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByMachineName, ListByName
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription ID.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetObjectID
+Specifies the replicating server ARM ID.
+
+```yaml
+Type: System.String
+Parameter Sets: GetByItemID
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateJob.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateJob.md
index 2fc62cb4d429..dae93061df99 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateJob.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateJob.md
@@ -300,57 +300,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`INPUTOBJECT `: Specifies the job object of the replicating server.
- - `[Location ]`: Resource Location
- - `[ActivityId ]`: The activity id.
- - `[AllowedAction ]`: The Allowed action the job.
- - `[CustomDetailAffectedObjectDetail ]`: The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details.
- - `[(Any) ]`: This indicates any property can be added to this object.
- - `[CustomDetailInstanceType ]`: Gets the type of job details (see JobDetailsTypes enum for possible values).
- - `[EndTime ]`: The end time.
- - `[Error ]`: The errors.
- - `[CreationTime ]`: The creation time of job error.
- - `[ErrorLevel ]`: Error level of error.
- - `[ProviderErrorDetailErrorCode ]`: The Error code.
- - `[ProviderErrorDetailErrorId ]`: The Provider error Id.
- - `[ProviderErrorDetailErrorMessage ]`: The Error message.
- - `[ProviderErrorDetailPossibleCaus ]`: The possible causes for the error.
- - `[ProviderErrorDetailRecommendedAction ]`: The recommended action to resolve the error.
- - `[ServiceErrorDetailActivityId ]`: Activity Id.
- - `[ServiceErrorDetailCode ]`: Error code.
- - `[ServiceErrorDetailMessage ]`: Error message.
- - `[ServiceErrorDetailPossibleCaus ]`: Possible causes of error.
- - `[ServiceErrorDetailRecommendedAction ]`: Recommended action to resolve error.
- - `[TaskId ]`: The Id of the task.
- - `[FriendlyName ]`: The DisplayName.
- - `[ScenarioName ]`: The ScenarioName.
- - `[StartTime ]`: The start time.
- - `[State ]`: The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other.
- - `[StateDescription ]`: The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped.
- - `[TargetInstanceType ]`: The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class.
- - `[TargetObjectId ]`: The affected Object Id.
- - `[TargetObjectName ]`: The name of the affected object.
- - `[Task ]`: The tasks.
- - `[AllowedAction ]`: The state/actions applicable on this task.
- - `[CustomDetailInstanceType ]`: The type of task details.
- - `[EndTime ]`: The end time.
- - `[Error ]`: The task error details.
- - `[FriendlyName ]`: The name.
- - `[GroupTaskCustomDetailChildTask ]`: The child tasks.
- - `[GroupTaskCustomDetailInstanceType ]`: The type of task details.
- - `[Name ]`: The unique Task name.
- - `[StartTime ]`: The start time.
- - `[State ]`: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other.
- - `[StateDescription ]`: The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped.
- - `[TaskId ]`: The Id.
- - `[TaskType ]`: The type of task. Details in CustomDetails property depend on this type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateProject.md
index 523456157a23..3c5bf9e8daab 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateProject.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateProject.md
@@ -38,7 +38,8 @@ Method to get a migrate project.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -108,7 +109,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationFabric.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationFabric.md
index b575bf74043e..675b5af1bb24 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationFabric.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationFabric.md
@@ -88,7 +88,8 @@ Get a specific fabric
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -188,7 +189,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationPolicy.md
index b9212dcb7c68..e3f1c86bbcb2 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationPolicy.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationPolicy.md
@@ -61,7 +61,8 @@ Get a specific one.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -146,7 +147,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainer.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainer.md
index b718ad32202b..ed49cba9199d 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainer.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainer.md
@@ -65,7 +65,8 @@ Gets a specific one.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -165,7 +166,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainerMapping.md
index c55142fec29a..90894e594f53 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainerMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationProtectionContainerMapping.md
@@ -53,7 +53,8 @@ Get a mapping detail.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -168,7 +169,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationRecoveryServicesProvider.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationRecoveryServicesProvider.md
index 4c01ec09ad41..e52bd6ff478f 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationRecoveryServicesProvider.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateReplicationRecoveryServicesProvider.md
@@ -46,7 +46,8 @@ List all.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -146,7 +147,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateRunAsAccount.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateRunAsAccount.md
index 351cfd3615d8..f36b5737a2d8 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateRunAsAccount.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateRunAsAccount.md
@@ -73,7 +73,8 @@ Accept wildcard characters: False
```
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -144,7 +145,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerReplication.md
index 58c86d874ce4..0d3d470d7f5b 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerReplication.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerReplication.md
@@ -409,17 +409,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`INPUTOBJECT `: Specifies the machine object of the replicating server.
- - `[Location ]`: Resource Location
- - `[ProviderSpecificDetail ]`: The migration provider custom settings.
- - `InstanceType `: Gets the instance type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSite.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSite.md
index ba5f153e0f21..8c7266aa8535 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSite.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSite.md
@@ -39,7 +39,8 @@ Get site by name
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -110,7 +111,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSolution.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSolution.md
index 59b37da8daf0..54a477416235 100644
--- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSolution.md
+++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateSolution.md
@@ -38,7 +38,8 @@ Get Migrate project solution by name.
## PARAMETERS
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -123,7 +124,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateHCIReplicationInfrastructure.md b/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateHCIReplicationInfrastructure.md
new file mode 100644
index 000000000000..a7c5894bd4bd
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateHCIReplicationInfrastructure.md
@@ -0,0 +1,217 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure
+schema: 2.0.0
+---
+
+# Initialize-AzMigrateHCIReplicationInfrastructure
+
+## SYNOPSIS
+Initializes the infrastructure for the migrate project.
+
+## SYNTAX
+
+```
+Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName -ResourceGroupName
+ -SourceApplianceName -TargetApplianceName [-CacheStorageAccountId ]
+ [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] []
+```
+
+## DESCRIPTION
+The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario.
+
+## EXAMPLES
+
+### Example 1: Initialize AzStackHCI replication infrastructure
+```powershell
+Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true
+```
+
+```output
+$true
+```
+
+Initialize AzStackHCI replication infrastructure.
+Cache storage account, replication policy, and replication extension will be created automatically.
+
+### Example 2: Initialize AzStackHCI replication infrastructure with custom cache storage account
+```powershell
+$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa"
+
+Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true
+```
+
+```output
+$true
+```
+
+Initialize AzStackHCI replication infrastructure with custom cache storage account.
+Replication policy and replication extension will be created automatically.
+
+## PARAMETERS
+
+### -CacheStorageAccountId
+Specifies the Storage Account ARM Id to be used for private endpoint scenario.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -PassThru
+Returns true when the command succeeds
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectName
+Specifies the name of the Azure Migrate project to be used for server migration.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ResourceGroupName
+Specifies the Resource Group of the Azure Migrate Project in the current subscription.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SourceApplianceName
+Specifies the source appliance name for the AzStackHCI scenario.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription ID.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetApplianceName
+Specifies the target appliance name for the AzStackHCI scenario.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+## OUTPUTS
+
+### System.Boolean
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateReplicationInfrastructure.md b/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateReplicationInfrastructure.md
index f364af122602..32e4cc529376 100644
--- a/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateReplicationInfrastructure.md
+++ b/src/Migrate/Migrate.Autorest/docs/Initialize-AzMigrateReplicationInfrastructure.md
@@ -34,6 +34,17 @@ True
Initialises the infrastructure for the migrate project.
+### Example 2: Initialises the infrastructure for the migrate project for private endpoint scenario.
+```powershell
+Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName "TestRG" -ProjectName "TestPEProject" -TargetRegion "centraluseuap" -Scenario "agentlessVMware" -CacheStorageAccountId "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/singhabh-rg/providers/Microsoft.Storage/storageAccounts/singhabhstoragepe1"
+```
+
+```output
+True
+```
+
+Initialises the infrastructure for the migrate project for private endpoint scenario.
+
## PARAMETERS
### -CacheStorageAccountId
@@ -183,7 +194,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateDiskMapping.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateDiskMapping.md
index 17a1669f5cfd..a875fb08a6fa 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateDiskMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateDiskMapping.md
@@ -108,7 +108,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIDiskMappingObject.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIDiskMappingObject.md
new file mode 100644
index 000000000000..10d7b3d9e2db
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIDiskMappingObject.md
@@ -0,0 +1,130 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject
+schema: 2.0.0
+---
+
+# New-AzMigrateHCIDiskMappingObject
+
+## SYNOPSIS
+Creates a new disk mapping
+
+## SYNTAX
+
+```
+New-AzMigrateHCIDiskMappingObject -DiskID -Format -IsDynamic -IsOSDisk
+ -Size []
+```
+
+## DESCRIPTION
+The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated
+
+## EXAMPLES
+
+### Example 1: Creates Disk to migrate
+```powershell
+New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX
+```
+
+```output
+DiskFileFormat : VHDX
+DiskId : a
+DiskSizeGb : 1
+IsDynamic : True
+IsOSDisk : True
+StorageContainerId :
+```
+
+Get disk object to provide input for New-AzMigrateHCIServerReplication
+
+## PARAMETERS
+
+### -DiskID
+Specifies the disk ID of the disk attached to the discovered server to be migrated.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Format
+Specifies the disk format.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -IsDynamic
+Specifies whether the disk is dynamic.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -IsOSDisk
+Specifies whether the disk contains the Operating System for the source server to be migrated.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Size
+Specifies the disk size in GB.
+
+```yaml
+Type: System.Int64
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCINicMappingObject.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCINicMappingObject.md
new file mode 100644
index 000000000000..e9ccdb6b7a0a
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCINicMappingObject.md
@@ -0,0 +1,114 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject
+schema: 2.0.0
+---
+
+# New-AzMigrateHCINicMappingObject
+
+## SYNOPSIS
+Creates an object to update NIC properties of a replicating server.
+
+## SYNTAX
+
+```
+New-AzMigrateHCINicMappingObject -NicID -TargetVirtualSwitchId [-CreateAtTarget ]
+ [-TargetTestVirtualSwitchId ] []
+```
+
+## DESCRIPTION
+The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated.
+This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server.
+
+## EXAMPLES
+
+### Example 1: Create NIC to migrate
+```powershell
+New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external"
+```
+
+```output
+NicId : a
+TargetNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external
+TestNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external
+SelectionTypeForFailover : SelectedByUser
+```
+
+Get NIC object to provide input for New-AzMigrateHCIServerReplication and Set-AzMigrateHCIServerReplication
+
+## PARAMETERS
+
+### -CreateAtTarget
+Specifies whether the this Nic should be created at target.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -NicID
+Specifies the ID of the NIC to be updated.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetTestVirtualSwitchId
+Specifies the test logical network ARM ID that the VMs will use.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetVirtualSwitchId
+Specifies the logical network ARM ID that the VMs will use.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIServerReplication.md
new file mode 100644
index 000000000000..f6b2d9f773c5
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateHCIServerReplication.md
@@ -0,0 +1,379 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication
+schema: 2.0.0
+---
+
+# New-AzMigrateHCIServerReplication
+
+## SYNOPSIS
+Starts replication for the specified server.
+
+## SYNTAX
+
+### ByIdDefaultUser (Default)
+```
+New-AzMigrateHCIServerReplication -MachineId -OSDiskID -TargetResourceGroupId
+ -TargetStoragePathId -TargetVirtualSwitchId -TargetVMName
+ [-IsDynamicMemoryEnabled ] [-SubscriptionId ] [-TargetTestVirtualSwitchId ]
+ [-TargetVMCPUCore ] [-TargetVMRam ] [-DefaultProfile ] [-Confirm] [-WhatIf]
+ []
+```
+
+### ByIdPowerUser
+```
+New-AzMigrateHCIServerReplication -DiskToInclude -MachineId
+ -NicToInclude -TargetResourceGroupId -TargetStoragePathId
+ -TargetVMName [-IsDynamicMemoryEnabled ] [-SubscriptionId ]
+ [-TargetVMCPUCore ] [-TargetVMRam ] [-DefaultProfile ] [-Confirm] [-WhatIf]
+ []
+```
+
+## DESCRIPTION
+The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project.
+
+## EXAMPLES
+
+### Example 1: When there is only OS disk to migrate
+```powershell
+New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Create or update protected item
+EndTime : 1/1/1900 8:54:47 PM
+Error : {}
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e
+Name : f2d3430a-2977-419f-abd5-11d171e17f5e
+ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555
+ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4
+ObjectInternalName : test_vm
+ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555
+ObjectType : ProtectedItem
+ReplicationProviderId : xxx-xxx-xxx
+SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc
+StartTime : 1/1/1900 8:49:27 PM
+State : Succeeded
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+This is for the scenario, when there is only one single disk that has to be protected.
+
+### Example 2: When there are multiple disks or NICs to migrate
+```powershell
+[AzStackHCIDiskInput[]]$DisksToInclude = @()
+$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD
+$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD
+$DisksToInclude += $OSDisk
+$DisksToInclude += $DataDisk
+
+[AzStackHCINicInput[]]$NicsToInclude = @()
+$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external"
+$NicsToInclude += $Nic
+
+New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Create or update protected item
+EndTime : 1/1/1900 2:27:14 PM
+Error : {}
+Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f855305c-5bed-4bc6-996e-d273115ab833
+Name : f855305c-5bed-4bc6-996e-d273115ab833
+ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc
+ObjectInternalName : test_vm
+ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectType : ProtectedItem
+ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630
+SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc
+StartTime : 1/1/1900 2:21:50 PM
+State : Succeeded
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+This is for the scenario, when there are multiple disks that has to be protected.
+
+## PARAMETERS
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DiskToInclude
+Specifies the disks on the source server to be included for replication.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[]
+Parameter Sets: ByIdPowerUser
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -IsDynamicMemoryEnabled
+Specifies if RAM is dynamic or not.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -MachineId
+Specifies the machine ARM ID of the discovered server to be migrated.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -NicToInclude
+Specifies the NICs on the source server to be included for replication.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]
+Parameter Sets: ByIdPowerUser
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -OSDiskID
+Specifies the Operating System disk for the source server to be migrated.
+
+```yaml
+Type: System.String
+Parameter Sets: ByIdDefaultUser
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription ID.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetResourceGroupId
+Specifies the target Resource Group Id where the migrated VM resources will reside.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetStoragePathId
+Specifies the storage path ARM ID where the VMs will be stored.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetTestVirtualSwitchId
+Specifies the test logical network ARM ID that the VMs will use.
+
+```yaml
+Type: System.String
+Parameter Sets: ByIdDefaultUser
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetVirtualSwitchId
+Specifies the logical network ARM ID that the VMs will use.
+
+```yaml
+Type: System.String
+Parameter Sets: ByIdDefaultUser
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetVMCPUCore
+Specifies the number of CPU cores.
+
+```yaml
+Type: System.Int32
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetVMName
+Specifies the name of the VM to be created.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetVMRam
+Specifies the target RAM size in MB.
+
+```yaml
+Type: System.Int64
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateNicMapping.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateNicMapping.md
index e782159a3e95..9e611274f09e 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateNicMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateNicMapping.md
@@ -155,7 +155,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateProject.md
index 8ec37a1163d8..acc0f929111a 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateProject.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateProject.md
@@ -169,16 +169,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`PROPERTY `: Specifies the project properties.
- - `[ProvisioningState ]`: Provisioning state of the migrate project.
- - `[RegisteredTool ]`: Gets or sets the list of tools registered with the migrate project.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationPolicy.md
index fe6b75fd7af5..8dbb1d7e0913 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationPolicy.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationPolicy.md
@@ -60,7 +60,8 @@ Accept wildcard characters: False
```
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -207,15 +208,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`PROVIDERSPECIFICINPUT `: The ReplicationProviderSettings.
- - `InstanceType `: The class type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationProtectionContainerMapping.md
index 924df663023d..7c11d1971b3b 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationProtectionContainerMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateReplicationProtectionContainerMapping.md
@@ -66,7 +66,8 @@ Accept wildcard characters: False
```
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -273,15 +274,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`PROVIDERSPECIFICINPUT `: Provider specific input for pairing.
- - `InstanceType `: The class type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateServerReplication.md
index 8841ad621738..15a664f7ef15 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateServerReplication.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateServerReplication.md
@@ -543,32 +543,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`DISKTAG `: Specifies the tag to be used for disk creation.
- - `[(Any) ]`: This indicates any property can be added to this object.
-
-`DISKTOINCLUDE `: Specifies the disks on the source server to be included for replication.
- - `DiskId `: The disk Id.
- - `IsOSDisk `: A value indicating whether the disk is the OS disk.
- - `LogStorageAccountId `: The log storage account ARM Id.
- - `LogStorageAccountSasSecretName `: The key vault secret name of the log storage account.
- - `[DiskEncryptionSetId ]`: The DiskEncryptionSet ARM Id.
- - `[DiskType ]`: The disk type.
-
-`INPUTOBJECT `: Specifies the discovered server to be migrated. The server object can be retrieved using the Get-AzMigrateServer cmdlet.
- - `[GuestOSDetailOstype ]`: Type of the operating system.
-
-`NICTAG `: Specifies the tag to be used for NIC creation.
- - `[(Any) ]`: This indicates any property can be added to this object.
-
-`VMTAG `: Specifies the tag to be used for VM creation.
- - `[(Any) ]`: This indicates any property can be added to this object.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateTestNicMapping.md b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateTestNicMapping.md
index a5b23887549b..9478918f97ac 100644
--- a/src/Migrate/Migrate.Autorest/docs/New-AzMigrateTestNicMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/New-AzMigrateTestNicMapping.md
@@ -13,7 +13,7 @@ Creates an object to update NIC properties of a test migrating server.
## SYNTAX
```
-New-AzMigrateTestNicMapping -NicID -TestNicSubnet []
+New-AzMigrateTestNicMapping -NicID -TestNicSubnet [-Confirm] [-WhatIf] []
```
## DESCRIPTION
@@ -22,17 +22,19 @@ This object is provided as an input to the Start-AzMigrateTestMigration cmdlet t
## EXAMPLES
-### Example 1: Create a NIC object for test migration
+### Example 1: Create a NIC object for test migration.
```powershell
- New-AzMigrateTestNicMapping -NicID "93e74c1b-79cc-4761-b642-91cc6bfc16b9" -TestNicSubnet "default"
+New-AzMigrateTestNicMapping -NicID a2399354-653a-464e-a567-d30ef5467a31 -TestNicSubnet subnet1
```
```output
IsPrimaryNic IsSelectedForMigration NicId TargetNicName TargetStaticIPAddress TargetSubnetName TestStaticIPAddress TestSubnetName
------------ ---------------------- ----- ------------- --------------------- ---------------- ------------------- --------------
- 93e74c1b-79cc-4761-b642-91cc6bfc16b9 default
+ a2399354-653a-464e-a567-d30ef5467a31 subnet1
```
+Creates a NIC object for test migration.
+
## PARAMETERS
### -NicID
@@ -65,6 +67,37 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
@@ -76,7 +109,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/README.md b/src/Migrate/Migrate.Autorest/docs/README.md
index 888608999710..c166cf748460 100644
--- a/src/Migrate/Migrate.Autorest/docs/README.md
+++ b/src/Migrate/Migrate.Autorest/docs/README.md
@@ -1,5 +1,5 @@
# Docs
-This directory contains the documentation of the cmdlets for the `Az.Migrate` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
+This directory contains the documentation of the cmdlets for the `Az.Migrate` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `../examples` folder.
## Info
- Modifiable: no
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Migrate` mo
- Packaged: yes
## Details
-The process of documentation generation loads `Az.Migrate` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.
\ No newline at end of file
+The process of documentation generation loads `Az.Migrate` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `../exports` folder. Additionally, when writing custom cmdlets in the `../custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `../examples` folder.
\ No newline at end of file
diff --git a/src/Migrate/Migrate.Autorest/docs/Register-AzMigrateProjectTool.md b/src/Migrate/Migrate.Autorest/docs/Register-AzMigrateProjectTool.md
index 6820626eb423..c326e5a34428 100644
--- a/src/Migrate/Migrate.Autorest/docs/Register-AzMigrateProjectTool.md
+++ b/src/Migrate/Migrate.Autorest/docs/Register-AzMigrateProjectTool.md
@@ -53,7 +53,8 @@ Accept wildcard characters: False
```
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -169,7 +170,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateHCIServerReplication.md
new file mode 100644
index 000000000000..6119150e772d
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateHCIServerReplication.md
@@ -0,0 +1,238 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication
+schema: 2.0.0
+---
+
+# Remove-AzMigrateHCIServerReplication
+
+## SYNOPSIS
+Stops replication for the migrated server.
+
+## SYNTAX
+
+### ByID (Default)
+```
+Remove-AzMigrateHCIServerReplication -TargetObjectID [-SubscriptionId ]
+ [-ForceRemove ] [-DefaultProfile ] [-Confirm] [-WhatIf] []
+```
+
+### ByInputObject
+```
+Remove-AzMigrateHCIServerReplication -InputObject [-SubscriptionId ]
+ [-ForceRemove ] [-DefaultProfile ] [-Confirm] [-WhatIf] []
+```
+
+## DESCRIPTION
+The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server.
+
+## EXAMPLES
+
+### Example 1: Remove replication by Id
+```powershell
+Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851"
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba
+Name : 2b0b356e-d106-43af-ad26-02631fcaebba
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc
+ObjectInternalName : testmachine
+ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectType : ProtectedItem
+ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630
+SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc
+StartTime : 7/25/2023 10:14:42 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Remove AzStackHCI replication by Id.
+
+### Example 2: Remove replication by input object
+```powershell
+$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851"
+
+Remove-AzMigrateHCIServerReplication -InputObject $InputObject
+
+$InputObject | Remove-AzMigrateHCIServerReplication
+```
+
+```output
+ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000
+AllowedAction : {Cancel}
+CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails
+CustomPropertyInstanceType : WorkflowDetails
+DisplayName : Delete protected item
+EndTime :
+Error : {}
+Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba
+Name : 2b0b356e-d106-43af-ad26-02631fcaebba
+ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc
+ObjectInternalName : testmachine
+ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0
+ObjectType : ProtectedItem
+ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630
+SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc
+StartTime : 7/25/2023 10:14:42 PM
+State : Started
+SystemDataCreatedAt :
+SystemDataCreatedBy :
+SystemDataCreatedByType :
+SystemDataLastModifiedAt :
+SystemDataLastModifiedBy :
+SystemDataLastModifiedByType :
+Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags
+TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7
+Task : {Prerequisite check, Deleting protected item}
+Type : Microsoft.DataReplication/replicationVaults/jobs
+```
+
+Remove AzStackHCI replication by replication input object.
+
+## PARAMETERS
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: System.Management.Automation.PSObject
+Parameter Sets: (All)
+Aliases: AzureRMContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ForceRemove
+Specifies whether the replication needs to be force removed.
+Default to "false".
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -InputObject
+Specifies the replcating server for which the replication needs to be disabled.
+The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+
+```yaml
+Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+Parameter Sets: ByInputObject
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -SubscriptionId
+Azure Subscription ID.
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: (Get-AzContext).Subscription.Id
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetObjectID
+Specifies the replcating server for which the replication needs to be disabled.
+The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet.
+
+```yaml
+Type: System.String
+Parameter Sets: ByID
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity
+
+## OUTPUTS
+
+### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel
+
+## NOTES
+
+## RELATED LINKS
+
diff --git a/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateProject.md
index 789326c77ed3..2ea0719f91f3 100644
--- a/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateProject.md
+++ b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateProject.md
@@ -51,7 +51,8 @@ Accept wildcard characters: False
```
### -DefaultProfile
-The credentials, account, tenant, and subscription used for communication with Azure.
+The DefaultProfile parameter is not functional.
+Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
```yaml
Type: System.Management.Automation.PSObject
@@ -167,7 +168,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateServerReplication.md
index 73dcb1f100b6..0a64ea24c59a 100644
--- a/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateServerReplication.md
+++ b/src/Migrate/Migrate.Autorest/docs/Remove-AzMigrateServerReplication.md
@@ -124,7 +124,8 @@ Accept wildcard characters: False
```
### -InputObject
-Specifies the machine object of the replicating server.
+Specifies the replcating server for which the replication needs to be disabled.
+The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet.
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
```yaml
@@ -155,7 +156,7 @@ Accept wildcard characters: False
```
### -TargetObjectID
-Specifies the replcating server for which the replicatio needs to be disabled.
+Specifies the replcating server for which the replication needs to be disabled.
The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet.
```yaml
@@ -181,17 +182,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`INPUTOBJECT `: Specifies the machine object of the replicating server.
- - `[Location ]`: Resource Location
- - `[ProviderSpecificDetail ]`: The migration provider custom settings.
- - `InstanceType `: Gets the instance type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Restart-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Restart-AzMigrateServerReplication.md
index 8a9747ef9d82..44c7c4d8c789 100644
--- a/src/Migrate/Migrate.Autorest/docs/Restart-AzMigrateServerReplication.md
+++ b/src/Migrate/Migrate.Autorest/docs/Restart-AzMigrateServerReplication.md
@@ -165,17 +165,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`INPUTOBJECT `: Specifies the machine object of the replicating server.
- - `[Location ]`: Resource Location
- - `[ProviderSpecificDetail ]`: The migration provider custom settings.
- - `InstanceType `: Gets the instance type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Resume-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Resume-AzMigrateServerReplication.md
index ef857f4653ba..f5f00086a5d6 100644
--- a/src/Migrate/Migrate.Autorest/docs/Resume-AzMigrateServerReplication.md
+++ b/src/Migrate/Migrate.Autorest/docs/Resume-AzMigrateServerReplication.md
@@ -212,17 +212,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
-COMPLEX PARAMETER PROPERTIES
-
-To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
-
-
-`INPUTOBJECT `: Specifies the replicating server for which the resume replication needs to be initiated. The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet
- - `[Location ]`: Resource Location
- - `[ProviderSpecificDetail ]`: The migration provider custom settings.
- - `InstanceType `: Gets the instance type.
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateDiskMapping.md b/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateDiskMapping.md
index d1286bceb748..1f9d2d7e143e 100644
--- a/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateDiskMapping.md
+++ b/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateDiskMapping.md
@@ -23,13 +23,13 @@ The Set-AzMigrateDiskMapping cmdlet updates a mapping of the source disk attache
### Example 1: Make disks
```powershell
-Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1"
+Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1" -IsOSDisk "True"
```
```output
-DiskId TargetDiskName
------- --------------
-6000C294-1217-dec3-bc18-81f117220424 ContosoDisk_1
+DiskId IsOSDisk TargetDiskName
+------ -------- --------------
+6000C294-1217-dec3-bc18-81f117220424 True ContosoDisk_1
```
Get disks object to provide input for Set-AzMigrateServerReplication
@@ -92,7 +92,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
-ALIASES
-
## RELATED LINKS
diff --git a/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateHCIServerReplication.md
new file mode 100644
index 000000000000..3db53e28c78f
--- /dev/null
+++ b/src/Migrate/Migrate.Autorest/docs/Set-AzMigrateHCIServerReplication.md
@@ -0,0 +1,292 @@
+---
+external help file:
+Module Name: Az.Migrate
+online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication
+schema: 2.0.0
+---
+
+# Set-AzMigrateHCIServerReplication
+
+## SYNOPSIS
+Updates the target properties for the replicating server.
+
+## SYNTAX
+
+```
+Set-AzMigrateHCIServerReplication -TargetObjectID
+ [-DynamicMemoryConfig ] [-IsDynamicMemoryEnabled ]
+ [-NicToInclude ] [-SubscriptionId ] [-TargetVMCPUCore ]
+ [-TargetVMName ] [-TargetVMRam