Migrate.Autorest/custom/New-AzMigrateLocalServerReplication.ps1


# ----------------------------------------------------------------------------------
#
# 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-AzMigrateLocalServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project.
.Link
https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratelocalserverreplication
#>

function New-AzMigrateLocalServerReplication {
    [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
    [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IJobModel])]
    [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()]
        [ValidateSet("true" , "false")]
        [ArgumentCompleter( { "true" , "false" })]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [System.String]
        # Specifies whether to migrate the server as an Azure Arc-enabled VM. When set to 'true', an Azure Arc-enabled machine resource with the same name as -TargetVMName must already exist in the resource group specified by -TargetResourceGroupId.
        ${MigrateAsArcVM},

        [Parameter()]
        [ValidateSet("Standard", "TrustedLaunch")]
        [ArgumentCompleter( { "Standard", "TrustedLaunch" })]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [System.String]
        # Specifies the security type of the target VM. 'TrustedLaunch' enables Secure Boot and vTPM, implies -EnableSecureBoot 'true', and requires a Generation 2 target VM. 'Standard' is accepted for either generation and on its own leaves the target inheriting the source.
        ${TargetVMSecurityOption},

        [Parameter()]
        [ValidateSet("true" , "false")]
        [ArgumentCompleter( { "true" , "false" })]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [System.String]
        # Specifies whether Secure Boot is enabled on the target VM. Enabling it requires a Generation 2 target VM; 'false' is accepted for either generation. When omitted and -TargetVMSecurityOption is not 'TrustedLaunch', the target VM inherits the Secure Boot setting of the source server.
        ${EnableSecureBoot},

        [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.AzLocalDiskInput[]]
        # Specifies the disks on the source server to be included for replication.
        ${DiskToInclude},

        [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.AzLocalNicInput[]]
        # 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 ARM 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(Mandatory)]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [System.String]
        # Specifies the source appliance name for the AzLocal scenario.
        ${SourceApplianceName},

        [Parameter(Mandatory)]
        [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
        [System.String]
        # Specifies the target appliance name for the AzLocal scenario.
        ${TargetApplianceName},
    
        [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 {
        $helperPath = [System.IO.Path]::Combine($PSScriptRoot, "Helper", "AzLocalCommonSettings.ps1")
        Import-Module $helperPath
        $helperPath = [System.IO.Path]::Combine($PSScriptRoot, "Helper", "AzLocalCommonHelper.ps1")
        Import-Module $helperPath

        $HasTargetVMSecurityOption = $PSBoundParameters.ContainsKey('TargetVMSecurityOption')
        $HasEnableSecureBoot = $PSBoundParameters.ContainsKey('EnableSecureBoot')
        if ($HasEnableSecureBoot) {
            $secureBootEnabled = [System.Convert]::ToBoolean($EnableSecureBoot)
        }

        # Purely a contradiction between parameters, so reject it before the module and service checks.
        if ($HasTargetVMSecurityOption -and $TargetVMSecurityOption -eq $TargetVMSecurityTypes.TrustedLaunch -and
            $HasEnableSecureBoot -and -not $secureBootEnabled) {
            throw "-EnableSecureBoot 'false' cannot be used with -TargetVMSecurityOption 'TrustedLaunch'."
        }

        CheckResourceGraphModuleDependency
        CheckResourcesModuleDependency

        $HasTargetVMCPUCore = $PSBoundParameters.ContainsKey('TargetVMCPUCore')
        $HasIsDynamicMemoryEnabled = $PSBoundParameters.ContainsKey('IsDynamicMemoryEnabled')
        if ($HasIsDynamicMemoryEnabled) {
            $isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled)
        }
        $HasMigrateAsArcVM = $PSBoundParameters.ContainsKey('MigrateAsArcVM')
        if ($HasMigrateAsArcVM) {
            $migrateAsArcVMEnabled = [System.Convert]::ToBoolean($MigrateAsArcVM)
        }
        $HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam')
        $HasTargetVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetVirtualSwitchId')
        $HasTargetTestVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId')

        $parameterSet = $PSCmdlet.ParameterSetName

        # Remove initial command parameters
        $null = $PSBoundParameters.Remove('MachineId')
        $null = $PSBoundParameters.Remove('TargetStoragePathId')
        $null = $PSBoundParameters.Remove('TargetVMCPUCore')
        $null = $PSBoundParameters.Remove('TargetVirtualSwitchId')
        $null = $PSBoundParameters.Remove('TargetTestVirtualSwitchId')
        $null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled')
        $null = $PSBoundParameters.Remove('MigrateAsArcVM')
        $null = $PSBoundParameters.Remove('TargetVMSecurityOption')
        $null = $PSBoundParameters.Remove('EnableSecureBoot')
        $null = $PSBoundParameters.Remove('TargetVMRam')
        $null = $PSBoundParameters.Remove('DiskToInclude')
        $null = $PSBoundParameters.Remove('NicToInclude')
        $null = $PSBoundParameters.Remove('TargetResourceGroupId')
        $null = $PSBoundParameters.Remove('TargetVMName')
        $null = $PSBoundParameters.Remove('OSDiskID')
        $null = $PSBoundParameters.Remove('SourceApplianceName')
        $null = $PSBoundParameters.Remove('TargetApplianceName')

        # Set common ErrorVariable and ErrorAction for get behaviors
        $null = $PSBoundParameters.Add('ErrorVariable', 'notPresent')
        $null = $PSBoundParameters.Add('ErrorAction', 'SilentlyContinue')

        # Validate ARM ID format from inputs
        if (!(Test-AzureResourceIdFormat -Data $MachineId -Format $IdFormats.MachineArmIdTemplate))
        {
            throw New-InvalidResourceIdProvidedException `
                -ResourceId $MachineId `
                -ResourceType "DiscoveredMachine" `
                -Format $IdFormats.MachineArmIdTemplate
        }

        if (!(Test-AzureResourceIdFormat -Data $TargetStoragePathId -Format $IdFormats.StoragePathArmIdTemplate)) {
            throw New-InvalidResourceIdProvidedException `
                -ResourceId $TargetStoragePathId `
                -ResourceType "StorageContainer" `
                -Format $IdFormats.StoragePathArmIdTemplate
        }

        if (!(Test-AzureResourceIdFormat -Data $TargetResourceGroupId -Format $IdFormats.ResourceGroupArmIdTemplate)) {
            throw New-InvalidResourceIdProvidedException `
                -ResourceId $TargetResourceGroupId `
                -ResourceType "ResourceGroup" `
                -Format $IdFormats.ResourceGroupArmIdTemplate
        }

        if ($HasTargetVirtualSwitchId -and !(Test-AzureResourceIdFormat -Data $TargetVirtualSwitchId -Format $IdFormats.LogicalNetworkArmIdTemplate)) {
            throw New-InvalidResourceIdProvidedException `
                -ResourceId $TargetVirtualSwitchId `
                -ResourceType "LogicalNetwork" `
                -Format $IdFormats.LogicalNetworkArmIdTemplate
        }

        if ($HasTargetTestVirtualSwitchId -and !(Test-AzureResourceIdFormat -Data $TargetTestVirtualSwitchId -Format $IdFormats.LogicalNetworkArmIdTemplate)) {
            throw New-InvalidResourceIdProvidedException `
                -ResourceId $TargetTestVirtualSwitchId `
                -ResourceType "LogicalNetwork" `
                -Format $IdFormats.LogicalNetworkArmIdTemplate
        }

        # Validate TargetVMName (pure parameter check; hoisted up-front so we fail fast
        # before doing any source/target discovery work).
        if ($TargetVMName.length -gt 64 -or $TargetVMName.length -eq 0) {
            throw "The target virtual machine name must be between 1 and 64 characters long."
        }
        elseif ($TargetVMName -notmatch "^[^_\W][a-zA-Z0-9\-]{0,63}(?<![-._])$") {
            throw "The target virtual machine name must begin with a letter or number, and can contain only letters, numbers, or hyphens(-). The names cannot contain special characters \/""[]:|<>+=;,?*@&, whitespace, or begin with '_' or end with '.' or '-'."
        }
        elseif (IsReservedOrTrademarked($TargetVMName)) {
            throw "The target virtual machine name '$TargetVMName' or part of the name is a trademarked or reserved word."
        }

        # Arc-enabled VM reuse preflight (only when -MigrateAsArcVM "true").
        # Verifies that the customer-onboarded Arc machine exists at the expected
        # target ARM tuple and has a reusable Kind. Performed up-front so the
        # cmdlet fails fast on Arc misconfig before any discovery work.
        if ($HasMigrateAsArcVM -and $migrateAsArcVMEnabled) {
            # Az.ConnectedMachine is a conditional dependency required only for the Arc
            # reuse preflight. Fail fast with an actionable install hint if it's missing.
            CheckConnectedMachineModuleDependency

            # $TargetResourceGroupId is "/subscriptions/{sub}/resourceGroups/{rg}".
            # Format already validated above by Test-AzureResourceIdFormat.
            $targetRgIdArray = $TargetResourceGroupId.Split("/")
            $targetSubId     = $targetRgIdArray[2]
            $targetRgName    = $targetRgIdArray[4]

            Test-ArcMachineReuseEligibility `
                -TargetSubscriptionId    $targetSubId `
                -TargetResourceGroupName $targetRgName `
                -TargetVMName            $TargetVMName
        }

        # $MachineId is in the format of
        # "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.OffAzure/{2}/{3}/machines/{4}"
        $MachineIdArray = $MachineId.Split("/")
        $ResourceGroupName = $MachineIdArray[4] # {1}
        $SiteType = $MachineIdArray[7] # {2}
        $SiteName = $MachineIdArray[8] # {3}
        $MachineName = $MachineIdArray[10] # {4}

        # Get the source site and the discovered machine
        if ($SiteType -eq $SiteTypes.HyperVSites) {
            $instanceType = $AzLocalInstanceTypes.HyperVToAzLocal

            # Get Hyper-V site with ResourceGroupName, SiteName
            $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
            $null = $PSBoundParameters.Add('SiteName', $SiteName)
            $siteObject = Az.Migrate.Internal\Get-AzMigrateHyperVSite @PSBoundParameters
            if ($null -eq $siteObject)
            {
                throw New-AzMigrateSiteNotFoundException `
                    -Name $SiteName `
                    -ResourceGroupName $ResourceGroupName `
                    -SiteType $SiteType
            }

            # Get Hyper-V machine with ResourceGroupName, SiteName, MachineName
            $null = $PSBoundParameters.Add('MachineName', $MachineName)
            $machine = Az.Migrate.Internal\Get-AzMigrateHyperVMachine @PSBoundParameters
            if ($null -eq $machine)
            {
                throw New-AzMigrateDiscoveredMachineNotFoundException `
                    -Name $MachineName `
                    -ResourceGroupName $ResourceGroupName `
                    -SiteName $SiteName
            }
            $null = $PSBoundParameters.Remove('MachineName')

            # Get RunAsAccount
            if (![string]::IsNullOrEmpty($machine.HostId))
            {
                # machine is on a single Hyper-V host
                $hostIdArray = $machine.HostId.Split("/")
                if ($hostIdArray.Length -lt 11) {
                    throw "Invalid Hyper-V Host ARM ID '$($machine.HostId)'"
                }

                $hostResourceGroupName = $hostIdArray[4]
                $hostSiteName = $hostIdArray[8]
                $hostName = $hostIdArray[10]

                # Get Hyper-V host with ResourceGroupName, SiteName, HostName
                $null = $PSBoundParameters.Add('HostName', $hostName)
                $hyperVHost = Az.Migrate.Internal\Get-AzMigrateHyperVHost @PSBoundParameters
                if ($null -eq $hyperVHost)
                {
                    throw New-OffAzureResourceNotFoundException `
                        -Scenario "HyperV" `
                        -Type "Host" `
                        -Name $hostName `
                        -ResourceGroupName $hostResourceGroupName `
                        -SiteName $hostSiteName
                }
                $null = $PSBoundParameters.Remove('HostName')
                
                $runAsAccountId = $hyperVHost.RunAsAccountId
            }
            elseif(![string]::IsNullOrEmpty($machine.ClusterId))
            {
                # machine is on a Hyper-V cluster
                $clusterIdArray = $machine.ClusterId.Split("/")
                if ($clusterIdArray.Length -lt 11) {
                    throw "Invalid Hyper-V Cluster ARM ID '$($machine.ClusterId)'"
                }

                $clusterResourceGroupName = $clusterIdArray[4]
                $clusterSiteName = $clusterIdArray[8]
                $clusterName = $clusterIdArray[10]

                # Get Hyper-V cluster with ResourceGroupName, SiteName, ClusterName
                $null = $PSBoundParameters.Add('ClusterName', $clusterName)
                $hyperVCluster = Az.Migrate.Internal\Get-AzMigrateHyperVCluster @PSBoundParameters
                if ($null -eq $hyperVCluster)
                {
                    throw throw New-OffAzureResourceNotFoundException `
                        -Scenario "HyperV" `
                        -Type "Cluster" `
                        -Name $clusterName `
                        -ResourceGroupName $clusterResourceGroupName `
                        -SiteName $clusterSiteName
                }
                $null = $PSBoundParameters.Remove('ClusterName')

                $runAsAccountId = $hyperVCluster.RunAsAccountId
            }
        }
        elseif ($SiteType -eq $SiteTypes.VMwareSites)
        {
            $instanceType = $AzLocalInstanceTypes.VMwareToAzLocal

            # Get VMware site with ResourceGroupName, SiteName
            $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName)
            $null = $PSBoundParameters.Add('SiteName', $SiteName)
            $siteObject = Az.Migrate.private\Get-AzMigrateSite_Get @PSBoundParameters
            if ($null -eq $siteObject)
            {
                throw New-AzMigrateSiteNotFoundException `
                    -Name $SiteName `
                    -ResourceGroupName $ResourceGroupName `
                    -SiteType $SiteType
            }

            # Get VMware machine with ResourceGroupName, SiteName, MachineName
            $null = $PSBoundParameters.Add('MachineName', $MachineName)
            $machine = Az.Migrate.Internal\Get-AzMigrateMachine @PSBoundParameters
            if ($null -eq $machine)
            {
                throw New-AzMigrateDiscoveredMachineNotFoundException `
                    -Name $MachineName `
                    -ResourceGroupName $ResourceGroupName `
                    -SiteName $SiteName
            }
            $null = $PSBoundParameters.Remove('MachineName')

            # Get RunAsAccount
            if (![string]::IsNullOrEmpty($machine.VCenterId))
            {
                # machine is on a single vCenter
                $vCenterIdArray = $machine.VCenterId.Split("/")
                if ($vCenterIdArray.Length -lt 11) {
                    throw "Invalid VMware vCenter ARM ID '$($machine.VCenterId)'"
                }

                $vCenterResourceGroupName = $vCenterIdArray[4]
                $vCenterSiteName = $vCenterIdArray[8]
                $vCenterName = $vCenterIdArray[10]

                # Get VMware vCenter with ResourceGroupName, SiteName, Name
                $null = $PSBoundParameters.Add('Name', $vCenterName)
                $vmwareVCenter = Az.Migrate.Internal\Get-AzMigrateVCenter @PSBoundParameters
                if ($null -eq $vmwareVCenter)
                {
                    throw New-OffAzureResourceNotFoundException `
                        -Scenario "VMware" `
                        -Type "VCenter" `
                        -Name $vCenterName `
                        -ResourceGroupName $vCenterResourceGroupName `
                        -SiteName $vCenterSiteName
                }
                $null = $PSBoundParameters.Remove('Name')
                
                $runAsAccountId = $vmwareVCenter.RunAsAccountId
            }
        }
        else
        {
            throw "Site type of '$SiteType' in -MachineId is not supported. Only '$($SiteTypes.HyperVSites)' and '$($SiteTypes.VMwareSites)' are supported."
        }
        if ([string]::IsNullOrEmpty($runAsAccountId)) {
            throw "Unable to determine RunAsAccount for site '$SiteName' from machine '$MachineName'. Please verify your appliance setup and provided -MachineId."
        }
        $null = $PSBoundParameters.Remove('SiteName')
        
        # $siteObject is not null or exception would have been thrown
        $ProjectName = $siteObject.DiscoverySolutionId.Split("/")[8]

        # Get Data Replication Service (AMH solution) with ResourceGroupName, Name, MigrateProjectName
        $amhSolutionName = $AzMigrateSolutions.DataReplicationSolution
        $null = $PSBoundParameters.Add('MigrateProjectName', $ProjectName)
        $null = $PSBoundParameters.Add('Name', $amhSolutionName)
        $amhSolution = Az.Migrate.private\Get-AzMigrateSolution_Get @PSBoundParameters
        if ($null -eq $amhSolution)
        {
            throw New-AzMigrateSolutionNotFoundException `
                -Name $amhSolutionName `
                -ResourceGroupName $ResourceGroupName `
                -ProjectName $ProjectName
        }
        $null = $PSBoundParameters.Remove('Name')
        $null = $PSBoundParameters.Remove('MigrateProjectName')
        
        # Validate replication vault
        $vaultId = $amhSolution.DetailExtendedDetail["vaultId"]
        $vaultIdArray = $vaultId.Split("/")
        if ($vaultIdArray.Length -lt 9)
        {
            throw New-ReplicationVaultNotFoundInAMHSolutionException -VaultId $vaultId
        }
        $replicationVaultName = $vaultIdArray[8]

        # Get replication vault with ResourceGroupName, Name
        $null = $PSBoundParameters.Add('Name', $replicationVaultName)
        $replicationVault = Az.Migrate.Internal\Get-AzMigrateVault @PSBoundParameters
        if ($null -eq $replicationVault) 
        {
            throw "No Replication Vault '$replicationVaultName' found in Resource Group '$ResourceGroupName'. Please verify your Azure Migrate project setup."
        }
        elseif ($replicationVault.Property.ProvisioningState -ne [ProvisioningState]::Succeeded)
        {
            throw "The Replication Vault '$replicationVaultName' is not in a valid state. The provisioning state is '$($replicationVault.Property.ProvisioningState)'. Please verify your Azure Migrate project setup."
        }
        $null = $PSBoundParameters.Remove('Name')

        # Validate replication prequisites
        Test-ReplicationPrequisites `
            -ResourceGroupName $ResourceGroupName `
            -VaultName $replicationVaultName `
            -ProtectedItemName $MachineName `
            -MigrationType $instanceType

        # Access Discovery Service
        $discoverySolutionName = $AzMigrateSolutions.DiscoverySolution
        # Get Discovery Solution with ResourceGroupName, Name, MigrateProjectName
        $null = $PSBoundParameters.Add('Name', $discoverySolutionName)
        $null = $PSBoundParameters.Add('MigrateProjectName', $ProjectName)
        $discoverySolution = Az.Migrate.private\Get-AzMigrateSolution_Get @PSBoundParameters
        if ($null -eq $discoverySolution)
        {
            throw  New-AzMigrateSolutionNotFoundException `
                -Name $discoverySolutionName `
                -ResourceGroupName $ResourceGroupName `
                -ProjectName $ProjectName
        }
        $null = $PSBoundParameters.Remove('MigrateProjectName')
        $null = $PSBoundParameters.Remove('Name')

        # 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 (-not ($sourceSiteId -match $hyperVSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex) -and
            -not ($sourceSiteId -match $vmwareSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex)) {
            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 healthy asrv2 fabrics in the resource group
        # Get all fabrics with ResourceGroupName
        $allFabrics = Az.Migrate.private\Get-AzMigrateLocalReplicationFabric_List1 @PSBoundParameters `
            | Where-Object {
                $_.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -and
                $_.Property.CustomProperty.MigrationSolutionId -eq $amhSolution.Id
            }

        # Filter for source fabric
        if ($instanceType -eq $AzLocalInstanceTypes.HyperVToAzLocal)
        {
            $fabricInstanceType = $FabricInstanceTypes.HyperVInstance
        }
        else { # $instanceType -eq $AzLocalInstanceTypes.VMwareToAzLocal
            $fabricInstanceType = $FabricInstanceTypes.VmwareInstance
        }

        $sourceFabric = $allFabrics | Where-Object {
            $_.Property.CustomProperty.InstanceType -ceq $fabricInstanceType -and
            $_.Name.StartsWith($SourceApplianceName, [System.StringComparison]::InvariantCultureIgnoreCase)
        }

        if ($null -eq $sourceFabric)
        {
            throw "Couldn't find connected source appliance with the name '$SourceApplianceName'. Deploy a source appliance by completing the Discover step of migration for your on-premises environment."
        }

        # Get source fabric agent (dra) with ResourceGroupName, FabricName
        $null = $PSBoundParameters.Add('FabricName', $sourceFabric.Name)
        $sourceDras = Az.Migrate.Internal\Get-AzMigrateFabricAgent @PSBoundParameters
        $sourceDra = $sourceDras | Where-Object {
            $_.Property.MachineName -eq $SourceApplianceName -and
            $_.Property.CustomProperty.InstanceType -eq $fabricInstanceType -and
            $_.Property.IsResponsive -eq $true
        }
        if ($null -eq $sourceDra)
        {
            throw "The source appliance '$SourceApplianceName' is in a disconnected state. Ensure that the source appliance is running and has connectivity before proceeding."
        }
        $null = $PSBoundParameters.Remove('FabricName')

        $sourceDra = $sourceDra[0]

        # Filter for target fabric
        $fabricInstanceType = $FabricInstanceTypes.AzLocalInstance
        $targetFabric = $allFabrics | Where-Object {
            $_.Property.CustomProperty.InstanceType -ceq $fabricInstanceType -and
            $_.Name.StartsWith($TargetApplianceName, [System.StringComparison]::InvariantCultureIgnoreCase)
        }

        if ($null -eq $targetFabric)
        {
            throw "Couldn't find connected target appliance with the name '$TargetApplianceName'. Deploy a target appliance by completing the Configuration step of migration for your Azure Local environment."
        }

        # Get target fabric agent (dra) with ResourceGroupName, FabricName
        $null = $PSBoundParameters.Add('FabricName', $targetFabric.Name)
        $targetDras = Az.Migrate.Internal\Get-AzMigrateFabricAgent @PSBoundParameters
        $targetDra = $targetDras | Where-Object {
            $_.Property.MachineName -eq $TargetApplianceName -and
            $_.Property.CustomProperty.InstanceType -eq $fabricInstanceType -and
            $_.Property.IsResponsive -eq $true
        }
        if ($null -eq $targetDra)
        {
            "The target appliance '$TargetApplianceName' is in a disconnected state. Ensure that the target appliance is running and has connectivity before proceeding."
        }
        $null = $PSBoundParameters.Remove('FabricName')

        $targetDra = $targetDras[0]

        # Validate Policy
        $policyName = $replicationVaultName + $instanceType + "policy"
        # Get replication policy with ResourceGroupName, Name, VaultName
        $null = $PSBoundParameters.Add('Name', $policyName)
        $null = $PSBoundParameters.Add('VaultName', $replicationVaultName)
        $policy = Az.Migrate.Internal\Get-AzMigratePolicy @PSBoundParameters
        if ($null -eq $policy)
        {
            throw "The replication policy '$policyName' not found. The replication infrastructure is not initialized. Run the Initialize-AzMigrateLocalReplicationInfrastructure command."
        }
        elseif ($policy.Property.ProvisioningState -ne [ProvisioningState]::Succeeded)
        {
            throw "The replication policy '$policyName' is not in a valid state. The provisioning state is '$($policy.Property.ProvisioningState)'. Re-run the Initialize-AzMigrateLocalReplicationInfrastructure command."
        }
        $null = $PSBoundParameters.Remove('Name')

        # Validate Replication Extension
        $replicationExtensionName = ($sourceFabric.Id -split '/')[-1] + "-" + ($targetFabric.Id -split '/')[-1] + "-MigReplicationExtn"
        # Get replication extension with ResourceGroupName, Name, VaultName
        $null = $PSBoundParameters.Add('Name', $replicationExtensionName)
        $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension @PSBoundParameters
        if ($null -eq $replicationExtension)
        {
            throw "The replication extension '$replicationExtensionName' not found. The replication infrastructure is not initialized. Run the Initialize-AzMigrateLocalReplicationInfrastructure command."
        }
        elseif ($replicationExtension.Property.ProvisioningState -ne [ProvisioningState]::Succeeded)
        {
            throw "The replication extension '$replicationExtensionName' is not in a valid state. The provisioning state is '$($replicationExtension.Property.ProvisioningState)'. Re-run the Initialize-AzMigrateLocalReplicationInfrastructure command."
        }
        $null = $PSBoundParameters.Remove('Name')
        
        # Get ARC Resource Bridge info
        $targetClusterId = $targetFabric.Property.CustomProperty.Cluster.ResourceName
        $targetClusterIdArray = $targetClusterId.Split("/")
        $targetSubscription = $targetClusterIdArray[2]
        $arbArgQuery = GetARGQueryForArcResourceBridge -HCIClusterID $targetClusterId
        $arbArgResult = Az.ResourceGraph\Search-AzGraph -Query $arbArgQuery -Subscription $targetSubscription
        if ($null -eq $arbArgResult) {
            throw "$($ArcResourceBridgeValidationMessages.NoClusters). Validate target cluster with id '$targetClusterId' exists."
        }
        elseif ($arbArgResult.statusOfTheBridge -ne "Running") {
            throw "$($ArcResourceBridgeValidationMessages.NotRunning). Make sure the Arc Resource Bridge is online before retrying."
        }

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

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

        $customProperties.InstanceType = $instanceType
        $customProperties.CustomLocationRegion = $arbArgResult.CustomLocationRegion
        $customProperties.FabricDiscoveryMachineId = $machine.Id
        $customProperties.RunAsAccountId = $runAsAccountId
        $customProperties.SourceFabricAgentName = $sourceDra.Name

        # Validate storage path exists and is in a usable state
        $storagePath = Get-AzResource `
            -ResourceId $TargetStoragePathId `
            -ErrorVariable notPresent `
            -ErrorAction SilentlyContinue
        if ($null -eq $storagePath) {
            throw "Storage path with Id '$TargetStoragePathId' not found. Please provide a valid storage path ARM ID."
        }

        # Creation must have succeeded for the storage path to be usable
        $creationStatus = $storagePath.Properties.status.provisioningStatus.status
        if ([string]::IsNullOrEmpty($creationStatus)) {
            throw "Storage path '$($storagePath.Name)' creation status is unavailable. Please verify the storage path resource is fully provisioned."
        }
        if ($creationStatus -ne "Succeeded") {
            throw "Storage path '$($storagePath.Name)' has a creation provisioning status of '$creationStatus'. Only storage paths with a successful creation can be used. Please select a different storage path or wait for provisioning to complete."
        }

        # The latest operation (ProvisioningState) must also be Succeeded
        $provisioningState = $storagePath.Properties.provisioningState
        if ([string]::IsNullOrEmpty($provisioningState)) {
            throw "Storage path '$($storagePath.Name)' provisioning state is unavailable. Please verify the storage path resource is fully provisioned."
        }
        if ($provisioningState -ne "Succeeded") {
            throw "Storage path '$($storagePath.Name)' has a provisioning state of '$provisioningState'. Only storage paths with a 'Succeeded' provisioning state can be used. Please resolve the issue or select a different storage path."
        }

        $customProperties.StorageContainerId = $TargetStoragePathId
        $customProperties.TargetArcClusterCustomLocationId = $arbArgResult.CustomLocation
        $customProperties.TargetFabricAgentName = $targetDra.Name
        $customProperties.TargetHciClusterId = $targetClusterId
        $customProperties.TargetResourceGroupId = $TargetResourceGroupId
        $customProperties.TargetVMName = $TargetVMName
        $customProperties.IsDynamicRam = if ($HasIsDynamicMemoryEnabled) { $isDynamicRamEnabled } else {  $isSourceDynamicMemoryEnabled }
        if ($HasMigrateAsArcVM) {
            $customProperties.MigrateAsArcVM = $migrateAsArcVMEnabled
        }
    
        # Determine target VM Hyper-V Generation
        if ($SiteType -eq $SiteTypes.HyperVSites) { 
            # Hyper-V source
            $customProperties.HyperVGeneration = $machine.Generation
        }
        else { 
            #Vmware source, non-BOIS VMs will be migrated to Gen2
            $customProperties.HyperVGeneration = if ($machine.Firmware -ieq "BIOS") { "1" } else { "2" }
        }

        # Gen 1 target VMs do not support Secure Boot or vTPM; fail before the service round-trip.
        if ($HasTargetVMSecurityOption -or $HasEnableSecureBoot) {
            # For VMware sources -MachineName is an opaque id, so report the discovered name.
            $sourceName = if ([string]::IsNullOrEmpty($machine.DisplayName)) { $MachineName } else { $machine.DisplayName }

            $securityDecision = Resolve-AzMigrateTargetSecurityOption `
                -Mode 'Create' `
                -HyperVGeneration $customProperties.HyperVGeneration `
                -HasTargetVMSecurityOption $HasTargetVMSecurityOption `
                -TargetVMSecurityOption $TargetVMSecurityOption `
                -HasEnableSecureBoot $HasEnableSecureBoot `
                -SecureBootEnabled ([bool]$secureBootEnabled)

            if ($securityDecision.Gen2Required) {
                throw "Secure Boot and Trusted Launch capabilities require a Generation 2 (EFI) VM. The source server '$sourceName' maps to a Generation 1 (BIOS) VM."
            }

            # The service rejects turning Secure Boot off for a Gen 2 source that has it on.
            if ($securityDecision.VerifySourceSecureBoot -and
                $true -eq (Get-AzMigrateSourceSecureBootState -MachineId $MachineId)) {
                throw "Source server '$sourceName' has Secure Boot enabled, so it cannot be migrated with -EnableSecureBoot 'false'. Omit -EnableSecureBoot to keep Secure Boot enabled on the target VM, or disable Secure Boot on the source server first."
            }

            if ($null -ne $securityDecision.SecurityOption) {
                $customProperties.SecurityOption = $securityDecision.SecurityOption
            }
        }

        # Validate TargetVMCPUCore
        if ($HasTargetVMCPUCore)
        {
            if ($TargetVMCPUCore -lt $TargetVMCPUCores.Min -or $TargetVMCPUCore -gt $TargetVMCPUCores.Max)
            {
                throw "Specify -TargetVMCPUCore between $($TargetVMCPUCores.Min) and $($TargetVMCPUCores.Max)."
            }
            $customProperties.TargetCpuCore = $TargetVMCPUCore
        }
        else
        {
            $customProperties.TargetCpuCore = $machine.NumberOfProcessorCore
        }

        # Validate TargetVMRam
        if ($HasTargetVMRam)
        {
            if ($customProperties.HyperVGeneration -eq "1") {
                # Between 512 MB and 1 TB
                if ($TargetVMRam -lt $TargetVMRamInMB.Gen1Min -or $TargetVMRam -gt $TargetVMRamInMB.Gen1Max)
                {
                    throw "Specify -TargetVMRAM between $($TargetVMRamInMB.Gen1Min) and $($TargetVMRamInMB.Gen1Max) MB (i.e., 1 TB) for Hyper-V Generation 1 VM."
                }
            }
            else # Hyper-V Generation 2
            {
                # Between 32 MB and 12 TB
                if ($TargetVMRam -lt $TargetVMRamInMB.Gen2Min -or $TargetVMRam -gt $TargetVMRamInMB.Gen2Max)
                {
                    throw "Specify -TargetVMRAM between $($TargetVMRamInMB.Gen2Min) and $($TargetVMRamInMB.Gen2Max) MB (i.e., 12 TB) for Hyper-V Generation 2 VM."
                }
            }

            $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.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."
                }
            }
            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."
                }
            }

            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 = $VMNicSelection.SelectedByUser
                }
                $nics += $NicObject
            }
        }
        else
        {
            # PowerUser
            if ($null -eq $DiskToInclude -or $DiskToInclude.length -eq 0) {
                throw "Invalid DiskToInclude. At least one disk is required."
            }

            # Validate OSDisk is set.
            $osDisk = $DiskToInclude | Where-Object { $_.IsOSDisk }
            if (($null -eq $osDisk) -or ($osDisk.length -ne 1)) {
                throw "Invalid DiskToInclude. One disk must be designated as the OS disk."
            }
            
            # Validate DiskToInclude
            [PSCustomObject[]]$uniqueDisks = @()
            foreach ($disk in $DiskToInclude) {
                # Enforce VHDX for Gen2 VMs
                if ($customProperties.HyperVGeneration -eq "2" -and $disk.DiskFileFormat -eq "VHD") {
                    throw "Please specify 'VHDX' as Format for the disk with id '$($disk.DiskId)' in -DiskToInclude by re-running New-AzMigrateLocalDiskMappingObject."
                }

                # PhysicalSectorSize must be 512 for VHD format if it is set
                if ($disk.DiskFileFormat -eq "VHD" -and $null -ne $disk.DiskPhysicalSectorSize -and $disk.DiskPhysicalSectorSize -ne 512) {
                    throw "Invalid Physical sector size of $($disk.DiskPhysicalSectorSize) is found for VHD format. Please replace disk with id '$($disk.DiskId)' in -DiskToInclude by re-running New-AzMigrateLocalDiskMappingObject with 512 as -PhysicalSectorSize."
                }

                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."
                    }
                }

                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 included. Please remove the duplicate entry and try again."
                }

                $uniqueNics += $nic.NicId
                
                $htNic = @{}
                $nic.PSObject.Properties | ForEach-Object { $htNic[$_.Name] = $_.Value }

                if ($htNic.SelectionTypeForFailover -eq $VMNicSelection.SelectedByUser -and
                    [string]::IsNullOrEmpty($htNic.TargetNetworkId)) {
                    throw throw "The TargetVirtualSwitchId parameter is required when the CreateAtTarget flag is set to 'true'. NIC '$($htNic.NicId)'. Please utilize the New-AzMigrateLocalNicMappingObject command to properly create a Nic mapping object."
                }

                $nics += [PSCustomObject]$htNic
            }
        }

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

        # Remove common ErrorVariable and ErrorAction for get behaviors
        $null = $PSBoundParameters.Remove('ErrorVariable')
        $null = $PSBoundParameters.Remove('ErrorAction')

        if ($PSCmdlet.ShouldProcess($MachineId, "Replicate VM.")) {
            # Create protected item with ResourceGroupName, VaultName, Name, Property
            $null = $PSBoundParameters.Add('Name', $MachineName)
            $null = $PSBoundParameters.Add('Property', $protectedItemProperties)
            $null = $PSBoundParameters.Add('NoWait', $true)
            $operation = Az.Migrate.Internal\New-AzMigrateProtectedItem @PSBoundParameters
            $null = $PSBoundParameters.Remove('NoWait')
            $null = $PSBoundParameters.Remove('Property')
            $null = $PSBoundParameters.Remove('Name')

            # Get job with ResourceGroupName, VaultName, Name
            $jobName = $operation.Target.Split("/")[-1].Split("?")[0].Split("_")[0]
            $null = $PSBoundParameters.Add('Name', $jobName)
            return Az.Migrate.Internal\Get-AzMigrateLocalReplicationJob @PSBoundParameters
        }
    }
}
# SIG # Begin signature block
# MIIncQYJKoZIhvcNAQcCoIInYjCCJ14CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBi7ZgLuu7pxbGs
# oJMBxWdTZImeM4T9qYfRVVxOgou1JKCCDMkwggYEMIID7KADAgECAhMzAAACHPrN
# xZvoL37EAA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