From 007053bdf061405c5093543c2272a0352cfecb11 Mon Sep 17 00:00:00 2001 From: "Ankit Baluni (from Dev Box)" Date: Mon, 28 Apr 2025 15:56:14 +0530 Subject: [PATCH 1/4] Add Get-AzMigrateServerMigrationStatus cmdlet and associated documentation - Implemented the Get-AzMigrateServerMigrationStatus cmdlet to retrieve the replication status of servers in Azure Migrate. - Added detailed parameter descriptions and examples in the markdown documentation. - Created example usage scenarios for the cmdlet in the examples markdown file. - Added unit tests for the cmdlet with placeholders for future implementation. --- .../Get-AzMigrateServerMigrationStatus.ps1 | 622 ++++++++++++++++++ .../Get-AzMigrateServerMigrationStatus.md | 254 +++++++ .../Get-AzMigrateServerMigrationStatus.md | 59 ++ ...t-AzMigrateServerMigrationStatus.Tests.ps1 | 33 + 4 files changed, 968 insertions(+) create mode 100644 src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1 create mode 100644 src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md create mode 100644 src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md create mode 100644 src/Migrate/Migrate.Autorest/test/Get-AzMigrateServerMigrationStatus.Tests.ps1 diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1 new file mode 100644 index 000000000000..91272c764bce --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1 @@ -0,0 +1,622 @@ + +# ---------------------------------------------------------------------------------- +# +# 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 status. +.Description +The Get-AzMigrateServerMigrationStatus cmdlet retrieves the replication status for the replicating server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateservermigrationstatus +#> +function Get-AzMigrateServerMigrationStatus { + [OutputType([PSCustomObject[]])] + [CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)] + param( + [Parameter(ParameterSetName = 'ListByName', Mandatory)] + [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)] + [Parameter(ParameterSetName = 'GetHealthByMachineName', Mandatory)] + [Parameter(ParameterSetName = 'GetByApplianceName', Mandatory)] + #[Parameter(ParameterSetName = 'GetByPrioritiseServer', 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)] + [Parameter(ParameterSetName = 'GetHealthByMachineName', Mandatory)] + [Parameter(ParameterSetName = 'GetByApplianceName', Mandatory)] + #[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate project in the current subscription. + ${ProjectName}, + + [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)] + [Parameter(ParameterSetName = 'GetHealthByMachineName', Mandatory)] + #[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the display name of the replicating machine. + ${MachineName}, + + [Parameter(ParameterSetName = 'GetByApplianceName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the appliance. + ${ApplianceName}, + + [Parameter(ParameterSetName = 'GetHealthByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Management.Automation.SwitchParameter] + # Specifies whether the health issues to show for replicating server. + ${Health}, + + [Parameter(ParameterSetName = 'ListByName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName = 'ListByName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [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 { + Function MakeTable ($TableName, $ColumnArray) { + foreach($Col in $ColumnArray) { + $MCol = New-Object System.Data.DataColumn $Col; + $TableName.Columns.Add($MCol) + } + } + + $appMap = @{} + + Function PopulateApplianceDetails ($projName, $rgName) { + # Get vault name from SMS solution. + $smsSolution = Get-AzMigrateSolution -MigrateProjectName $projName -ResourceGroupName $rgName -Name "Servers-Migration-ServerMigration" + + if (-not $smsSolution.DetailExtendedDetail.AdditionalProperties.vaultId) { + throw 'Azure Migrate appliance not configured. Setup Azure Migrate appliance before proceeding.' + } + + $VaultName = $smsSolution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8] + + # Get all appliances and sites in the project from SDS solution. + $sdsSolution = Get-AzMigrateSolution -MigrateProjectName $projName -ResourceGroupName $rgName -Name "Servers-Discovery-ServerDiscovery" + + if ($null -ne $sdsSolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) { + $appMapV2 = $sdsSolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json + # Fetch all appliances from V2 map first. Then these can be updated if found again in V3 map. + foreach ($item in $appMapV2) { + $appMap[$item.SiteId.Split('/')[-1]] = $item.ApplianceName + } + } + + if ($null -ne $sdsSolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) { + $appMapV3 = $sdsSolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json + foreach ($item in $appMapV3) { + $t = $item.psobject.properties + $appMap[$t.Value.SiteId.Split('/')[-1]] = $t.Name + } + } + } + + Function GetApplianceName ($site) { + if (!$appMap.ContainsKey($site)) { + return "No appliance found for site name: $site" + } + return $appMap[$site] + } + + Function GetState { + param( + [string]$State, + [object]$ReplicationMigrationItem + ) + + if ([string]::IsNullOrEmpty($State)) { + if ($ReplicationMigrationItem.MigrationState -match "InitialSeedingInProgress" -or $ReplicationMigrationItem.MigrationState -match "EnableMigrationInProgress" -or $ReplicationMigrationItem.MigrationState -match "Replicating") { + return "InitialReplication Queued" + } + elseif ($ReplicationMigrationItem.MigrationState -match "InitialSeedingFailed") { + return "InitialReplication Failed" + } + return $ReplicationMigrationItem.MigrationState + } + + if ($ReplicationMigrationItem.MigrationState -match "MigrationInProgress" -and $ReplicationMigrationItem.migrationProgressPercentage -eq $null) { + return "FinalDeltaReplication Queued" + } + + if ($ReplicationMigrationItem.MigrationState -eq "MigrationSucceeded") { + return "Migration Completed" + } + + $State = $State -replace "PlannedFailoverOverDeltaReplication", "FinalDeltaReplication" + return $State + } + + function Convert-MillisecondsToTime { + param ( + [int]$Milliseconds + ) + + if ($Milliseconds -eq $null) { + return $null + } + + $TotalMinutes = [math]::Floor($Milliseconds / 60000) + $Hours = [math]::Floor($TotalMinutes / 60) + $Minutes = $TotalMinutes % 60 + + if ($Hours -eq 0) { + if ($Minutes -eq 0) + { + return "-" + } + return "$Minutes min" + } else { + return "$Hours hr $Minutes min" + } + } + + function Convert-ToMbps { + param ( + [double]$UploadSpeedInBytesPerSecond + ) + + if ($UploadSpeedInBytesPerSecond -eq $null -or $UploadSpeedInBytesPerSecond -eq 0) { + return "-" + } + + # Conversion factor: 1 byte = 8 bits + $UploadSpeedInBitsPerSecond = $UploadSpeedInBytesPerSecond * 8 + + # Conversion factor: 1 megabit = 1,000,000 bits + $UploadSpeedInMbps = [math]::Round($UploadSpeedInBitsPerSecond / 1e6) + + return "$UploadSpeedInMbps Mbps" + } + + function Add-Percent { + param ( + [double]$Value + ) + + if ($Value -ne $null -and $Value -ne 0) { + return "$Value%" + } else { + return "-" + } + } + + function ConvertToCustomTimeFormat { + param ( + [string]$LocalTimeString + ) + + if ([string]::IsNullOrEmpty($LocalTimeString)) { + return "-" + } + + # Parse the input string + $localTime = [datetime]::ParseExact($LocalTimeString, "MM/dd/yyyy HH:mm:ss", $null) + + # Format the local time as desired + $formattedTime = Get-Date $localTime -Format "M/d/yyyy, h:mm:ss tt" + + return $formattedTime + } + + $parameterSet = $PSCmdlet.ParameterSetName + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove('ProjectName') + $HasFilter = $PSBoundParameters.ContainsKey('Filter') + $HasSkipToken = $PSBoundParameters.ContainsKey('SkipToken') + $null = $PSBoundParameters.Remove('Filter') + $null = $PSBoundParameters.Remove('SkipToken') + $null = $PSBoundParameters.Remove('MachineName') + $null = $PSBoundParameters.Remove('ApplianceName') + $null = $PSBoundParameters.Remove('Health') + #$null = $PSBoundParameters.Remove('Expedite') + + $output = New-Object System.Collections.ArrayList # Create a hashtable to store the output. + + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration") + $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('ResourceName', $VaultName) + + if ($HasFilter) { + $null = $PSBoundParameters.Add("Filter", $Filter) + } + if ($HasSkipToken) { + $null = $PSBoundParameters.Add("SkipToken", $SkipToken) + } + + PopulateApplianceDetails $ProjectName $ResourceGroupName + + if ($parameterSet -eq "GetByApplianceName" -and !$appMap.ContainsValue($ApplianceName)) + { + throw "No appliance found with name $ApplianceName" + } + + if ($parameterSet -eq "GetByMachineName" -or $parameterSet -eq "GetHealthByMachineName" -or $parameterSet -eq "GetByPrioritiseServer") { + $ReplicationMigrationItems = Get-AzMigrateServerReplication -ProjectName $ProjectName -ResourceGroupName $ResourceGroupName -MachineName $MachineName + } + else { + $ReplicationMigrationItems = Get-AzMigrateServerReplication -ProjectName $ProjectName -ResourceGroupName $ResourceGroupName + } + + if ($ReplicationMigrationItems -eq $null) { + if ($parameterSet -eq "GetByMachineName" -or $parameterSet -eq "GetHealthByMachineName") { + Write-Host "No replicating machine found with name $MachineName." + } + else { + Write-Host "No replicating machine found." + } + return; + } + + $vmMigrationStatusTable = New-Object System.Data.DataTable("") + + if ($parameterSet -eq "GetByApplianceName") { + $column = @("Server", "State", "Progress", "TimeElapsed", "TimeRemaining", "UploadSpeed", "Health", "LastSync", "Datastore") + } + elseif ($parameterSet -eq "ListByName") { + $column = @("Appliance", "Server", "State", "Progress", "TimeElapsed", "TimeRemaining", "UploadSpeed", "Health", "LastSync", "Datastore") + } + else { + $column = @("Appliance", "Server", "State", "Progress", "TimeElapsed", "TimeRemaining", "UploadSpeed", "LastSync", "Datastore") + } + + MakeTable $vmMigrationStatusTable $column + + foreach ($ReplicationMigrationItem in $ReplicationMigrationItems) { + if ($parameterSet -eq "GetByMachineName") { + if ($ReplicationMigrationItem.health -eq "Normal") { + $op = $output.Add("`nServer $MachineName is currently healthy.") + } + elseif ($ReplicationMigrationItem.health -eq "None") { + $op = $output.Add("`nServer $MachineName is in $($ReplicationMigrationItems.ReplicationStatus) state.") + } + else { + $op = $output.Add("`nServer $MachineName is currently facing critical error/ warning. Please run the command given below to know about the errors and resolutions.`n`nGet-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -Appliance -MachineName -Health") + } + } + + if ($parameterSet -eq "GetByMachineName" -or $parameterSet -eq "GetHealthByMachineName" -or $parameterSet -eq "GetByPrioritiseServer") { + $ReplicationMigrationItem = Get-AzMigrateServerReplication -TargetObjectID $ReplicationMigrationItem.Id + } + + $site = $ReplicationMigrationItem.ProviderSpecificDetail.vmwareMachineId.Split('/')[-3] + $appName = GetApplianceName $site + $row1 = $vmMigrationStatusTable.NewRow() + if ($parameterSet -eq "GetByApplianceName" -and $appName -ne $ApplianceName) { + continue; + } + if ($parameterSet -ne "GetByApplianceName") { + $row1["Appliance"] = $appName + } + + $row1["Server"] = $ReplicationMigrationItem.MachineName + $row1["State"] = GetState -State $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailState -ReplicationMigrationItem $ReplicationMigrationItem + if ($ReplicationMigrationItem.ReplicationStatus -match "Pause" -and $ReplicationMigrationItem.MigrationState -notmatch "migration") { + $row1["State"] = $ReplicationMigrationItem.ReplicationStatus + $row1["TimeRemaining"] = "-" + $row1["UploadSpeed"] = "-" + $row1["Progress"] = "-" + $row1["TimeElapsed"] = "-" + } + elseif ($ReplicationMigrationItem.ReplicationStatus -match "Resum") { + $row1["State"] = $ReplicationMigrationItem.ReplicationStatus + $row1["TimeRemaining"] = Convert-MillisecondsToTime -Milliseconds $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailTimeRemaining + $row1["UploadSpeed"] = Convert-ToMbps -UploadSpeedInBytesPerSecond $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailUploadSpeed + $row1["Progress"] = Add-Percent -Value $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailProgressPercentage + $row1["TimeElapsed"] = Convert-MillisecondsToTime -Milliseconds $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailTimeElapsed + } + elseif ($ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailState -match "Completed") { + $row1["TimeRemaining"] = "-" + $row1["UploadSpeed"] = "-" + $row1["Progress"] = "-" + $row1["TimeElapsed"] = "-" + } + else { + $row1["TimeRemaining"] = Convert-MillisecondsToTime -Milliseconds $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailTimeRemaining + $row1["UploadSpeed"] = Convert-ToMbps -UploadSpeedInBytesPerSecond $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailUploadSpeed + $row1["Progress"] = Add-Percent -Value $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailProgressPercentage + $row1["TimeElapsed"] = Convert-MillisecondsToTime -Milliseconds $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailTimeElapsed + } + + if ($parameterSet -eq "ListByName" -or $parameterSet -eq "GetByApplianceName") { + if ([string]::IsNullOrEmpty($ReplicationMigrationItem.health) -or $ReplicationMigrationItem.health -eq "None") { + $row1["Health"] = "-" + } + else { + $row1["Health"] = $ReplicationMigrationItem.health + } + } + $row1["LastSync"] = ConvertToCustomTimeFormat -LocalTimeString $ReplicationMigrationItem.ProviderSpecificDetail.lastRecoveryPointReceived + + #$row1["ESXiHost"] = $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailHostName + if (-not [string]::IsNullOrEmpty($ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailDataStore)) { + $row1["Datastore"] = $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailDataStore -join ', ' + } + else { + $row1["Datastore"] = "-" + } + + $vmMigrationStatusTable.Rows.Add($row1) + + if( $parameterSet -eq "GetByMachineName" -or $parameterSet -eq "GetHealthByMachineName" -or $parameterSet -eq "GetByPrioritiseServer") { + if ($parameterSet -eq "GetHealthByMachineName" -or $parameterSet -eq "GetByPrioritiseServer") { + $op = $output.Add("`nServer Information:") + } + + $vmMigrationStatusTable = $vmMigrationStatusTable | Format-Table -AutoSize | Out-String + $op = $output.Add($vmMigrationStatusTable) # Store the table in the output hashtable + + $diskStatusTable = New-Object System.Data.DataTable("") + $diskcolumn = @("Disk", "State", "Progress", "TimeElapsed", "TimeRemaining", "UploadSpeed", "Datastore") + + MakeTable $diskStatusTable $diskcolumn + + foreach($disk in $ReplicationMigrationItem.ProviderSpecificDetail.ProtectedDisk) { + $row = $diskStatusTable.NewRow() + $row["Disk"] = $disk.DiskName + $row["State"] = GetState -State $disk.GatewayOperationDetailState -ReplicationMigrationItem $ReplicationMigrationItem + + if ($ReplicationMigrationItem.ReplicationStatus -match "Pause" -and $ReplicationMigrationItem.MigrationState -notmatch "migration") { + $row["State"] = $ReplicationMigrationItem.ReplicationStatus + $row["TimeRemaining"] = "-" + $row["UploadSpeed"] = "-" + $row["Progress"] = "-" + $row["TimeElapsed"] = "-" + } + elseif ($ReplicationMigrationItem.ReplicationStatus -match "Resum") { + $row["State"] = $ReplicationMigrationItem.ReplicationStatus + #$row["TimeRemaining"] = Convert-MillisecondsToTime -Milliseconds $disk.GatewayOperationDetailTimeRemaining + $row["TimeRemaining"] = "-" + $row["UploadSpeed"] = "-" + #$row["UploadSpeed"] = Convert-ToMbps -UploadSpeedInBytesPerSecond $disk.GatewayOperationDetailUploadSpeed + #$row["Progress"] = Add-Percent -Value $disk.GatewayOperationDetailProgressPercentage + $row["Progress"] = "-" + $row["TimeElapsed"] = "-" + #$row["TimeElapsed"] = Convert-MillisecondsToTime -Milliseconds $disk.GatewayOperationDetailTimeElapsed + } + elseif ($disk.GatewayOperationDetailState -match "Completed") { + $row["Progress"] = "-" + $row["TimeElapsed"] = "-" + $row["TimeRemaining"] = "-" + $row["UploadSpeed"] = "-" + } + else { + $row["TimeRemaining"] = Convert-MillisecondsToTime -Milliseconds $disk.GatewayOperationDetailTimeRemaining + $row["UploadSpeed"] = Convert-ToMbps -UploadSpeedInBytesPerSecond $disk.GatewayOperationDetailUploadSpeed + $row["Progress"] = Add-Percent -Value $disk.GatewayOperationDetailProgressPercentage + $row["TimeElapsed"] = Convert-MillisecondsToTime -Milliseconds $disk.GatewayOperationDetailTimeElapsed + } + + if (-not [string]::IsNullOrEmpty($disk.GatewayOperationDetailDataStore)) { + $row["Datastore"] = $disk.GatewayOperationDetailDataStore -join ', ' + } + else { + $row["Datastore"] = "-" + } + $diskStatusTable.Rows.Add($row) + } + + if ($parameterSet -eq "GetHealthByMachineName" -or $parameterSet -eq "GetByPrioritiseServer") { + $op = $output.Add("`nDisk Level Operation Status:") + } + + $diskStatusTable = $diskStatusTable | Format-Table -AutoSize | Out-String + $op = $output.Add($diskStatusTable) # Store the table in the output hashtable + } + + if ($parameterSet -eq "GetHealthByMachineName") { + if ($ReplicationMigrationItem.health -eq "Normal") { + $op = $output.Add("No warnings or critical errors for this server.") + } + else { + $op = $output.Add("List of warning or critical errors for this server with their resolutions: `n") + $healthError = $ReplicationMigrationItem.HealthError + foreach ($error in $healthError) { + $op = $output.Add("Error Message: $($error.ErrorMessage)`nPossible Causes: $($error.PossibleCaus)`nRecommended Actions: $($error.RecommendedAction)`n`n") + } + } + } + + <#if( $parameterSet -eq "GetByPrioritiseServer") { + $vmMigrationTable = New-Object System.Data.DataTable("") + $column = @("Appliance", "Server", "State", "TimeRemaining", "ESXiHost", "Datastore") + MakeTable $vmMigrationTable $column + + foreach($MigrationItem in $ReplicationMigrationItems) { + $site = $MigrationItem.ProviderSpecificDetail.vmwareMachineId.Split('/')[-3] + $appName1 = GetApplianceName $site + if ($MigrationItem.MachineName -eq $ReplicationMigrationItem.MachineName -and $appName1 -eq $appName) { + continue; + } + + if ($appName1 -ne $appName) { + continue; + } + + $row1 = $vmMigrationTable.NewRow() + $row1["Appliance"] = $appName1 + $row1["Server"] = $MigrationItem.MachineName + $row1["State"] = $MigrationItem.ProviderSpecificDetail.GatewayOperationDetailState + $row1["TimeRemaining"] = $MigrationItem.ProviderSpecificDetail.GatewayOperationDetailTimeRemaining + $row1["ESXiHost"] = $MigrationItem.ProviderSpecificDetail.GatewayOperationDetailHostName + $row1["Datastore"] = $MigrationItem.ProviderSpecificDetail.GatewayOperationDetailDataStore + $vmMigrationTable.Rows.Add($row1) + } + $op = $output.Add("Resource Sharing: `n`nVM $($ReplicationMigrationItem.MachineName) shares at least one resource with the following VM. These include ESXi host, Datastore or primary appliance.") + $vmMigrationTable = $vmMigrationTable | Format-Table -AutoSize | Out-String + $op = $output.Add($vmMigrationTable) + + $resourceUtilizationTable = New-Object System.Data.DataTable("") + $column = @("Resource", "Capacity", "Utilization for server migrations", "Total utilization", "Status") + MakeTable $resourceUtilizationTable $column + $row1 = $resourceUtilizationTable.NewRow() + $row1["Resource"] = "Appliance RAM Sum : Primary and scale out appliances" + $row1["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.RamDetailCapacity + $row1["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.RamDetailProcessUtilization + $row1["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.RamDetailTotalUtilization + $row1["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.RamDetailStatus + $resourceUtilizationTable.Rows.Add($row1) + + $row2 = $resourceUtilizationTable.NewRow() + $row2["Resource"] = "Appliance CPU Sum : Primary and scale out appliances" + $row2["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.CpuDetailCapacity + $row2["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.CpuDetailProcessUtilization + $row2["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.CpuDetailTotalUtilization + $row2["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.CpuDetailStatus + $resourceUtilizationTable.Rows.Add($row2) + + $row3 = $resourceUtilizationTable.NewRow() + $row3["Resource"] = "Network bandwidth Sum : Primary and scale out appliances" + $row3["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.NetworkBandwidthCapacity + $row3["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.NetworkBandwidthProcessUtilization + $row3["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.NetworkBandwidthTotalUtilization + $row3["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.NetworkBandwidthStatus + $resourceUtilizationTable.Rows.Add($row3) + + $row4 = $resourceUtilizationTable.NewRow() + $row4["Resource"] = "ESXi host NFC buffer" + $row4["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.EsxiNfcBufferCapacity + $row4["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.EsxiNfcBufferProcessUtilization + $row4["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.EsxiNfcBufferTotalUtilization + $row4["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.EsxiNfcBufferStatus + $resourceUtilizationTable.Rows.Add($row4) + + $row5 = $resourceUtilizationTable.NewRow() + $row5["Resource"] = "Parallel Disks Replicated Sum : Primary and scale out appliances" + $row5["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DiskReplicationDetailCapacity + $row5["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DiskReplicationDetailProcessUtilization + $row5["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DiskReplicationDetailTotalUtilization + $row5["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DiskReplicationDetailStatus + $resourceUtilizationTable.Rows.Add($row5) + + $row6 = $resourceUtilizationTable.NewRow() + $row6["Resource"] = "Datastore Snapshot Count (for each datastore corresponding to the server s disks)" + $row6["Capacity"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DatastoreSnapshotCapacity + $row6["Utilization for server migrations"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DatastoreSnapshotProcessUtilization + $row6["Total utilization"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DatastoreSnapshotTotalUtilization + $row6["Status"] = $ReplicationMigrationItem.ProviderSpecificDetail.ApplianceMonitoringDetail.DatastoreSnapshotStatus + $resourceUtilizationTable.Rows.Add($row6) + + $op = $output.Add("Resource utilization information for migration operations:") + $resourceUtilizationTable = $resourceUtilizationTable | Format-Table -AutoSize | Out-String + $op = $output.Add($resourceUtilizationTable) + + # Add Recomendation actions logic for expedite. + + Write-Host "Based on the resource utilization seen above following are suggestion you can take to expedite server $($ReplicationMigrationItem.MachineName) migration :" -ForegroundColor White + Write-Host "1. Pause replication for servers S2, S3, in delta sync who are migrating under appliance A1." + Write-Host "2. Stop replication for servers S4 in Initial replication migrating under appliance A1." + Write-Host "3. Increase the Network bandwidth available for appliances so that upload speeds can increase." + Write-Host "4. Increase the NFC buffer size to increase the upload speed." + Write-Host "5. Perform storage Vmotion on server $($ReplicationMigrationItem.MachineName)." + }#> + } + + if ($parameterSet -eq "GetByApplianceName" -or $parameterSet -eq "ListByName") { + $vmMigrationStatusTable = $vmMigrationStatusTable | Format-Table -AutoSize | Out-String + $op = $output.Add($vmMigrationStatusTable) + + $diskStatusTable = $diskStatusTable | Format-Table -AutoSize | Out-String + $op = $output.Add($diskStatusTable) +# $op = $output.Add("To check expedite the operation of a server use the command") +# $op = $output.Add("Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Expedite`n") + $op = $output.Add("To resolve the health issue use the command") + $op = $output.Add("Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health`n") + } + + return $output; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md new file mode 100644 index 000000000000..97d7567bc560 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md @@ -0,0 +1,254 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateservermigrationstatus +schema: 2.0.0 +--- + +# Get-AzMigrateServerMigrationStatus + +## SYNOPSIS +Retrieves the details of the replicating server status. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName + [-SubscriptionId ] [-Filter ] [-SkipToken ] [-DefaultProfile ] + [] +``` + +### GetByApplianceName +``` +Get-AzMigrateServerMigrationStatus -ApplianceName -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetByMachineName +``` +Get-AzMigrateServerMigrationStatus -MachineName -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetHealthByMachineName +``` +Get-AzMigrateServerMigrationStatus -Health -MachineName -ProjectName + -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateServerMigrationStatus cmdlet retrieves the replication status for the replicating server. + +## EXAMPLES + +### Example 1: List status by project name. +```powershell +Get-AzMigrateServerReplication -ResourceGroupName cbtpvtrg -ProjectName migpvt +``` + +```output +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +migpvt CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by project name. + +### Example 2: List status by machine name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -MachineName "CVM-Win2019" +``` + +```output +Server CVM-Win2019 is currently healthy. + +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 + + + +Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore +---- ----- -------- ----------- ------------- ----------- --------- +TestVM DeltaReplication Completed - - - - Shared_1TB +CVM-Win2019 DeltaReplication Completed - - - - datastore1 +``` + +Get by machine name. + +### Example 2: List status by appliance name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -ApplianceName "migpvt" +``` + +```output +Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by appliance name. + +## PARAMETERS + +### -ApplianceName +Specifies the name of the appliance. + +```yaml +Type: System.String +Parameter Sets: GetByApplianceName +Aliases: + +Required: True +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 +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: ListByName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Health +Specifies whether the health issues to show for replicating server. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: GetHealthByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + Specifies the display name of the replicating machine. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, GetHealthByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + Specifies 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 +``` + +### -ResourceGroupName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + 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 +``` + +### -SkipToken +The pagination token. + +```yaml +Type: System.String +Parameter Sets: ListByName +Aliases: + +Required: False +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 + +## OUTPUTS + +## NOTES + +## RELATED LINKS \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md new file mode 100644 index 000000000000..8b3c53bd9dad --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md @@ -0,0 +1,59 @@ +### Example 1: List status by project name. +```powershell +Get-AzMigrateServerReplication -ResourceGroupName cbtpvtrg -ProjectName migpvt +``` + +```output +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +migpvt CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by project name. + +### Example 2: List status by machine name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -MachineName "CVM-Win2019" +``` + +```output +Server CVM-Win2019 is currently healthy. + +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 + + + +Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore +---- ----- -------- ----------- ------------- ----------- --------- +TestVM DeltaReplication Completed - - - - Shared_1TB +CVM-Win2019 DeltaReplication Completed - - - - datastore1 +``` + +Get by machine name. + +### Example 2: List status by appliance name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -ApplianceName "migpvt" +``` + +```output +Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by appliance name. \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateServerMigrationStatus.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateServerMigrationStatus.Tests.ps1 new file mode 100644 index 000000000000..53e86c5e3abb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateServerMigrationStatus.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMigrateServerMigrationStatus')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMigrateServerMigrationStatus.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMigrateServerMigrationStatus' { + It 'ListByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetByApplianceName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetByMachineName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetHealthByMachineName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} \ No newline at end of file From 0e9084c4e2ae31bc1c80be4b946361c58994ff2a Mon Sep 17 00:00:00 2001 From: "Ankit Baluni (from Dev Box)" Date: Tue, 13 May 2025 10:50:22 +0530 Subject: [PATCH 2/4] Fix cmdlet name in documentation examples for Get-AzMigrateServerMigrationStatus --- .../Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md | 2 +- .../examples/Get-AzMigrateServerMigrationStatus.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md index 97d7567bc560..5c9b85ad8c4e 100644 --- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md +++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md @@ -44,7 +44,7 @@ The Get-AzMigrateServerMigrationStatus cmdlet retrieves the replication status f ### Example 1: List status by project name. ```powershell -Get-AzMigrateServerReplication -ResourceGroupName cbtpvtrg -ProjectName migpvt +Get-AzMigrateServerMigrationStatus -ResourceGroupName cbtpvtrg -ProjectName migpvt ``` ```output diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md index 8b3c53bd9dad..f96c0400057b 100644 --- a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md @@ -1,6 +1,6 @@ ### Example 1: List status by project name. ```powershell -Get-AzMigrateServerReplication -ResourceGroupName cbtpvtrg -ProjectName migpvt +Get-AzMigrateServerMigrationStatus -ResourceGroupName cbtpvtrg -ProjectName migpvt ``` ```output From e265ea3893c9603e668d28d3d7f21a388628f807 Mon Sep 17 00:00:00 2001 From: "Ankit Baluni (from Dev Box)" Date: Wed, 14 May 2025 12:48:24 +0530 Subject: [PATCH 3/4] Add entry for Get-AzMigrateServerMigrationStatus cmdlet in ChangeLog --- src/Migrate/Migrate/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Migrate/Migrate/ChangeLog.md b/src/Migrate/Migrate/ChangeLog.md index 48af4130fe1f..e3158d436438 100644 --- a/src/Migrate/Migrate/ChangeLog.md +++ b/src/Migrate/Migrate/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Implemented the Get-AzMigrateServerMigrationStatus cmdlet to retrieve the replication status of servers in Azure Migrate. ## Version 2.7.0 * Updated Data.Replication to newer API version From aeda9a140d73b61634e3f2f520a491d9c44156ce Mon Sep 17 00:00:00 2001 From: "Ankit Baluni (from Dev Box)" Date: Wed, 14 May 2025 14:14:58 +0530 Subject: [PATCH 4/4] Add documentation for Get-AzMigrateServerMigrationStatus cmdlet --- .../Properties/AssemblyInfo.cs | 1 + .../Migrate.Autorest/docs/Az.Migrate.md | 5 +- .../Get-AzMigrateServerMigrationStatus.md | 5 +- .../Migrate.Autorest/generate-info.json | 2 +- src/Migrate/Migrate.sln | 87 +++++- src/Migrate/Migrate/Az.Migrate.psd1 | 17 +- src/Migrate/Migrate/help/Az.Migrate.md | 3 + .../Get-AzMigrateServerMigrationStatus.md | 257 ++++++++++++++++++ 8 files changed, 358 insertions(+), 19 deletions(-) create mode 100644 src/Migrate/Migrate/help/Get-AzMigrateServerMigrationStatus.md diff --git a/src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs b/src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs index 8ecfe6531dff..e89d125eabea 100644 --- a/src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs +++ b/src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs @@ -26,3 +26,4 @@ [assembly: System.CLSCompliantAttribute(false)] + diff --git a/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md b/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md index a3510cdfbe80..989eb4e43378 100644 --- a/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md +++ b/src/Migrate/Migrate.Autorest/docs/Az.Migrate.md @@ -1,6 +1,6 @@ --- Module Name: Az.Migrate -Module Guid: 72e0bbdf-2561-4f4e-90e1-2a27c36b7ab8 +Module Guid: ac145a87-2ada-4b6f-9d19-a70ac116949d Download Help Link: https://learn.microsoft.com/powershell/module/az.migrate Help Version: 1.0.0.0 Locale: en-US @@ -47,6 +47,9 @@ Gets the details of registered recovery services provider. ### [Get-AzMigrateRunAsAccount](Get-AzMigrateRunAsAccount.md) Method to get run as account. +### [Get-AzMigrateServerMigrationStatus](Get-AzMigrateServerMigrationStatus.md) +Retrieves the details of the replicating server status. + ### [Get-AzMigrateServerReplication](Get-AzMigrateServerReplication.md) Retrieves the details of the replicating server. diff --git a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md index 5c9b85ad8c4e..68ebb9d23196 100644 --- a/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md +++ b/src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md @@ -249,6 +249,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS +### System.Management.Automation.PSObject[] + ## NOTES -## RELATED LINKS \ No newline at end of file +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/generate-info.json b/src/Migrate/Migrate.Autorest/generate-info.json index 1eadcf07bbdc..ddad3cae25ad 100644 --- a/src/Migrate/Migrate.Autorest/generate-info.json +++ b/src/Migrate/Migrate.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "145f526c-1786-4548-bea6-6c9c35ec0f0e" + "generate_Id": "294629d2-9bde-467f-93f2-ae5986835c27" } diff --git a/src/Migrate/Migrate.sln b/src/Migrate/Migrate.sln index 1eee604afe06..d97e4033fab5 100644 --- a/src/Migrate/Migrate.sln +++ b/src/Migrate/Migrate.sln @@ -19,49 +19,119 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accoun EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migrate", "Migrate\Migrate.csproj", "{1847EC8D-87A5-4772-9E75-1DEA1DC531EE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Migrate", "..\..\generated\Migrate\Migrate.Autorest\Az.Migrate.csproj", "{DE49266B-1267-409E-A68D-49AE62DD73A5}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Migrate.Autorest", "Migrate.Autorest", "{9AA2C35A-2264-B74D-8556-EB72BD88EE60}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Migrate", "..\..\generated\Migrate\Migrate.Autorest\Az.Migrate.csproj", "{DF96B8E2-9EE8-48C9-B915-96C0787FB394}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|Any CPU.Build.0 = Debug|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|x64.ActiveCfg = Debug|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|x64.Build.0 = Debug|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|x86.ActiveCfg = Debug|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Debug|x86.Build.0 = Debug|Any CPU {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|Any CPU.ActiveCfg = Release|Any CPU {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|Any CPU.Build.0 = Release|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|x64.ActiveCfg = Release|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|x64.Build.0 = Release|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|x86.ActiveCfg = Release|Any CPU + {395019BE-8D3A-46E4-9CFB-7E298FEEB747}.Release|x86.Build.0 = Release|Any CPU {F8556062-9A47-4812-8D95-213808B0B620}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F8556062-9A47-4812-8D95-213808B0B620}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Debug|x64.ActiveCfg = Debug|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Debug|x64.Build.0 = Debug|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Debug|x86.ActiveCfg = Debug|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Debug|x86.Build.0 = Debug|Any CPU {F8556062-9A47-4812-8D95-213808B0B620}.Release|Any CPU.ActiveCfg = Release|Any CPU {F8556062-9A47-4812-8D95-213808B0B620}.Release|Any CPU.Build.0 = Release|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Release|x64.ActiveCfg = Release|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Release|x64.Build.0 = Release|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Release|x86.ActiveCfg = Release|Any CPU + {F8556062-9A47-4812-8D95-213808B0B620}.Release|x86.Build.0 = Release|Any CPU {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|x64.Build.0 = Debug|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Debug|x86.Build.0 = Debug|Any CPU {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|Any CPU.Build.0 = Release|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|x64.ActiveCfg = Release|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|x64.Build.0 = Release|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|x86.ActiveCfg = Release|Any CPU + {AA3B61A6-4FC7-4C41-9B09-408BA70BB905}.Release|x86.Build.0 = Release|Any CPU {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|x64.ActiveCfg = Debug|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|x64.Build.0 = Debug|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|x86.ActiveCfg = Debug|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Debug|x86.Build.0 = Debug|Any CPU {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|Any CPU.ActiveCfg = Release|Any CPU {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|Any CPU.Build.0 = Release|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|x64.ActiveCfg = Release|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|x64.Build.0 = Release|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|x86.ActiveCfg = Release|Any CPU + {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F}.Release|x86.Build.0 = Release|Any CPU {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|x64.ActiveCfg = Debug|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|x64.Build.0 = Debug|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|x86.ActiveCfg = Debug|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Debug|x86.Build.0 = Debug|Any CPU {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|Any CPU.Build.0 = Release|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|x64.ActiveCfg = Release|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|x64.Build.0 = Release|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|x86.ActiveCfg = Release|Any CPU + {D8D28132-CE20-45C8-8476-6B88C891D945}.Release|x86.Build.0 = Release|Any CPU {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|x64.ActiveCfg = Debug|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|x64.Build.0 = Debug|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|x86.ActiveCfg = Debug|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Debug|x86.Build.0 = Debug|Any CPU {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|Any CPU.Build.0 = Release|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|x64.ActiveCfg = Release|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|x64.Build.0 = Release|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|x86.ActiveCfg = Release|Any CPU + {B799EA2F-9E28-421A-9301-BB061C6ADDC2}.Release|x86.Build.0 = Release|Any CPU {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|x64.ActiveCfg = Debug|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|x64.Build.0 = Debug|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|x86.ActiveCfg = Debug|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Debug|x86.Build.0 = Debug|Any CPU {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|Any CPU.Build.0 = Release|Any CPU - {DE49266B-1267-409E-A68D-49AE62DD73A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DE49266B-1267-409E-A68D-49AE62DD73A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DE49266B-1267-409E-A68D-49AE62DD73A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DE49266B-1267-409E-A68D-49AE62DD73A5}.Release|Any CPU.Build.0 = Release|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|x64.ActiveCfg = Release|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|x64.Build.0 = Release|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|x86.ActiveCfg = Release|Any CPU + {1847EC8D-87A5-4772-9E75-1DEA1DC531EE}.Release|x86.Build.0 = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|x64.ActiveCfg = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|x64.Build.0 = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|x86.ActiveCfg = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Debug|x86.Build.0 = Debug|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|Any CPU.Build.0 = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|x64.ActiveCfg = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|x64.Build.0 = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|x86.ActiveCfg = Release|Any CPU + {DF96B8E2-9EE8-48C9-B915-96C0787FB394}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {395019BE-8D3A-46E4-9CFB-7E298FEEB747} = {2D0176AD-AE30-4235-9D62-17043F0D4CD8} @@ -70,5 +140,6 @@ Global {FB2B969F-E6FB-4E6E-9D2A-E52F4F53F51F} = {2D0176AD-AE30-4235-9D62-17043F0D4CD8} {D8D28132-CE20-45C8-8476-6B88C891D945} = {2D0176AD-AE30-4235-9D62-17043F0D4CD8} {B799EA2F-9E28-421A-9301-BB061C6ADDC2} = {2D0176AD-AE30-4235-9D62-17043F0D4CD8} + {DF96B8E2-9EE8-48C9-B915-96C0787FB394} = {9AA2C35A-2264-B74D-8556-EB72BD88EE60} EndGlobalSection EndGlobal diff --git a/src/Migrate/Migrate/Az.Migrate.psd1 b/src/Migrate/Migrate/Az.Migrate.psd1 index f5f9a3b3c72d..721df5e4e976 100644 --- a/src/Migrate/Migrate/Az.Migrate.psd1 +++ b/src/Migrate/Migrate/Az.Migrate.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2/25/2025 +# Generated on: 5/14/2025 # @{ @@ -51,16 +51,16 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.0.2'; }) +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.1.0'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Migrate.Autorest/bin/Az.Migrate.private.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() +ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() +TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = 'Migrate.Autorest/Az.Migrate.format.ps1xml' @@ -76,8 +76,9 @@ FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob', 'Get-AzMigrateReplicationProtectionContainer', 'Get-AzMigrateReplicationProtectionContainerMapping', 'Get-AzMigrateReplicationRecoveryServicesProvider', - 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication', - 'Get-AzMigrateSite', 'Get-AzMigrateSolution', + 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerMigrationStatus', + 'Get-AzMigrateServerReplication', 'Get-AzMigrateSite', + 'Get-AzMigrateSolution', 'Initialize-AzMigrateLocalReplicationInfrastructure', 'Initialize-AzMigrateReplicationInfrastructure', 'New-AzMigrateDiskMapping', 'New-AzMigrateLocalDiskMappingObject', @@ -122,7 +123,7 @@ PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate' + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Migrate' # A URL to the license for this module. LicenseUri = 'https://aka.ms/azps-license' @@ -150,7 +151,7 @@ PrivateData = @{ } # End of PSData hashtable - } # End of PrivateData hashtable +} # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' diff --git a/src/Migrate/Migrate/help/Az.Migrate.md b/src/Migrate/Migrate/help/Az.Migrate.md index 4992779cd54e..efa9a16d290d 100644 --- a/src/Migrate/Migrate/help/Az.Migrate.md +++ b/src/Migrate/Migrate/help/Az.Migrate.md @@ -47,6 +47,9 @@ Gets the details of registered recovery services provider. ### [Get-AzMigrateRunAsAccount](Get-AzMigrateRunAsAccount.md) Method to get run as account. +### [Get-AzMigrateServerMigrationStatus](Get-AzMigrateServerMigrationStatus.md) +Retrieves the details of the replicating server status. + ### [Get-AzMigrateServerReplication](Get-AzMigrateServerReplication.md) Retrieves the details of the replicating server. diff --git a/src/Migrate/Migrate/help/Get-AzMigrateServerMigrationStatus.md b/src/Migrate/Migrate/help/Get-AzMigrateServerMigrationStatus.md new file mode 100644 index 000000000000..6748d123aa68 --- /dev/null +++ b/src/Migrate/Migrate/help/Get-AzMigrateServerMigrationStatus.md @@ -0,0 +1,257 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateservermigrationstatus +schema: 2.0.0 +--- + +# Get-AzMigrateServerMigrationStatus + +## SYNOPSIS +Retrieves the details of the replicating server status. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateServerMigrationStatus -ResourceGroupName -ProjectName [-SubscriptionId ] + [-Filter ] [-SkipToken ] [-DefaultProfile ] + [] +``` + +### GetByApplianceName +``` +Get-AzMigrateServerMigrationStatus -ResourceGroupName -ProjectName [-SubscriptionId ] + -ApplianceName [-DefaultProfile ] [] +``` + +### GetByMachineName +``` +Get-AzMigrateServerMigrationStatus -ResourceGroupName -ProjectName [-SubscriptionId ] + -MachineName [-DefaultProfile ] [] +``` + +### GetHealthByMachineName +``` +Get-AzMigrateServerMigrationStatus -ResourceGroupName -ProjectName [-SubscriptionId ] + -MachineName [-Health] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +The Get-AzMigrateServerMigrationStatus cmdlet retrieves the replication status for the replicating server. + +## EXAMPLES + +### Example 1: List status by project name. +```powershell +Get-AzMigrateServerMigrationStatus -ResourceGroupName cbtpvtrg -ProjectName migpvt +``` + +```output +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +migpvt CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by project name. + +### Example 2: List status by machine name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -MachineName "CVM-Win2019" +``` + +```output +Server CVM-Win2019 is currently healthy. + +Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync Datastore +--------- ------ ----- -------- ----------- ------------- ----------- -------- --------- +migpvt CVM-Win2019 DeltaReplication Completed - - - - 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 + + + +Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore +---- ----- -------- ----------- ------------- ----------- --------- +TestVM DeltaReplication Completed - - - - Shared_1TB +CVM-Win2019 DeltaReplication Completed - - - - datastore1 +``` + +Get by machine name. + +### Example 2: List status by appliance name. +```powershell +Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -ApplianceName "migpvt" +``` + +```output +Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore +------ ----- -------- ----------- ------------- ----------- ------ -------- --------- +CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1 +CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1 + + +To resolve the health issue use the command +Get-AzMigrateServerMigrationStatus -ProjectName -ResourceGroupName -MachineName -Health +``` + +Get by appliance name. + +## PARAMETERS + +### -ApplianceName +Specifies the name of the appliance. + +```yaml +Type: System.String +Parameter Sets: GetByApplianceName +Aliases: + +Required: True +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 +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: ListByName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Health +Specifies whether the health issues to show for replicating server. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: GetHealthByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + Specifies the display name of the replicating machine. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, GetHealthByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + Specifies 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 +``` + +### -ResourceGroupName +[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)] + 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 +``` + +### -SkipToken +The pagination token. + +```yaml +Type: System.String +Parameter Sets: ListByName +Aliases: + +Required: False +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 + +## OUTPUTS + +### System.Management.Automation.PSObject[] + +## NOTES + +## RELATED LINKS