Skip to content

Commit fa8118b

Browse files
author
Ankit Baluni (from Dev Box)
committed
Enhance Get-AzMigrateServerMigrationStatus cmdlet to support -Expedite parameter
- Added -Expedite parameter to expedite the operation of a replicating server. - Updated documentation to include new parameter and usage examples. - Modified examples to reflect new project and resource group names. - Enhanced output formatting in examples for clarity. - Added test case for GetByPrioritiseServer functionality.
1 parent 95c90e6 commit fa8118b

13 files changed

+652
-199
lines changed

src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
2121
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
2222
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Migrate")]
23-
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.8.0")]
24-
[assembly: System.Reflection.AssemblyVersionAttribute("2.8.0")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26-
[assembly: System.CLSCompliantAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Migrate.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.Migrate.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Migrate.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.Migrate.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}

src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1

Lines changed: 344 additions & 109 deletions
Large diffs are not rendered by default.

src/Migrate/Migrate.Autorest/custom/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Custom
2-
This directory contains custom implementation for non-generated cmdlets for the `Az.Migrate` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.Migrate.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.Migrate` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.Migrate.custom.psm1`. This file should not be modified.
33

44
## Info
55
- Modifiable: yes
@@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
1515
For script cmdlets, these are loaded via the `Az.Migrate.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
1616

1717
## Purpose
18-
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
1919

2020
## Usage
21-
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
2222
- Break
2323
- DefaultProfile
2424
- HttpPipelineAppend
@@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
3636
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Migrate`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Migrate`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
39+
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.Migrate`. For more information, see [README.md](../internal/README.md) in the `../internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.Migrate.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

src/Migrate/Migrate.Autorest/docs/Az.Migrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Migrate
3-
Module Guid: 7cbf023d-6b60-494a-8cdb-ab27463fef7d
3+
Module Guid: 54155e7c-dd37-4932-9420-89a7bcdd9892
44
Download Help Link: https://learn.microsoft.com/powershell/module/az.migrate
55
Help Version: 1.0.0.0
66
Locale: en-US

src/Migrate/Migrate.Autorest/docs/Get-AzMigrateServerMigrationStatus.md

Lines changed: 105 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Get-AzMigrateServerMigrationStatus -MachineName <String> -ProjectName <String> -
3131
[-SubscriptionId <String>] [-DefaultProfile <PSObject>] [<CommonParameters>]
3232
```
3333

34+
### GetByPrioritiseServer
35+
```
36+
Get-AzMigrateServerMigrationStatus -Expedite -MachineName <String> -ProjectName <String>
37+
-ResourceGroupName <String> [-SubscriptionId <String>] [-DefaultProfile <PSObject>] [<CommonParameters>]
38+
```
39+
3440
### GetHealthByMachineName
3541
```
3642
Get-AzMigrateServerMigrationStatus -Health -MachineName <String> -ProjectName <String>
@@ -44,14 +50,16 @@ The Get-AzMigrateServerMigrationStatus cmdlet retrieves the replication status f
4450

4551
### Example 1: List status by project name.
4652
```powershell
47-
Get-AzMigrateServerMigrationStatus -ResourceGroupName cbtpvtrg -ProjectName migpvt
53+
Get-AzMigrateServerMigrationStatus -ProjectName "cbt-resync-gql" -ResourceGroupName "ankitbaluni-resync-rg"
4854
```
4955

5056
```output
51-
Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore
52-
--------- ------ ----- -------- ----------- ------------- ----------- ------ -------- ---------
53-
migpvt CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1
54-
migpvt CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1
57+
58+
Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore ESXiHost
59+
--------- ------ ----- -------- ----------- ------------- ----------- ------ -------- --------- --------
60+
nosbm-test-ds el41-r5w12r1-3 InitialReplication InProgress 48 % 3 hr 48 min 12 hr 37 min 1230 Mbps Normal - IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
61+
nosbm-test-ds el41-r5w2k8r2-1 DeltaReplication Completed - - - - Normal 9/4/2025, 3:04:45 PM IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
62+
nosbm-test-ds dsinha-cbt-test DeltaReplication Completed - - - - Normal 9/4/2025, 2:58:21 PM IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
5563
5664
5765
@@ -64,44 +72,102 @@ Get by project name.
6472

6573
### Example 2: List status by machine name.
6674
```powershell
67-
Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -MachineName "CVM-Win2019"
75+
Get-AzMigrateServerMigrationStatus -ProjectName "cbt-resync-gql" -ResourceGroupName "ankitbaluni-resync-rg" -MachineName "Rhel8-Vm"
6876
```
6977

7078
```output
71-
Server CVM-Win2019 is currently healthy.
79+
Server Rhel8-Vm is currently healthy.
80+
81+
Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync ESXiHost Datastore
82+
--------- ------ ----- -------- ----------- ------------- ----------- -------- -------- ---------
83+
cbtresyncgql Rhel8-Vm DeltaReplication Completed - - - - 7/14/2025, 9:51:05 PM idclab-vcen8.fareast.corp.microsoft.com_10.150.102.181 IDCLAB-B161-3TB
7284
73-
Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync Datastore
74-
--------- ------ ----- -------- ----------- ------------- ----------- -------- ---------
75-
migpvt CVM-Win2019 DeltaReplication Completed - - - - 12/7/2023, 11:18:07 AM Shared_1TB, datastore1
7685
7786
87+
Disk Level Operation Status:
7888
79-
Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore
80-
---- ----- -------- ----------- ------------- ----------- ---------
81-
TestVM DeltaReplication Completed - - - - Shared_1TB
82-
CVM-Win2019 DeltaReplication Completed - - - - datastore1
89+
Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore
90+
---- ----- -------- ----------- ------------- ----------- ---------
91+
Rhel8-Vm DeltaReplication Completed - - - - IDCLAB-B161-3TB
8392
```
8493

8594
Get by machine name.
8695

87-
### Example 2: List status by appliance name.
96+
### Example 3: List status by appliance name.
8897
```powershell
89-
Get-AzMigrateServerMigrationStatus -ProjectName "migpvt-ecyproj" -ResourceGroupName "cbtprivatestamprg" -ApplianceName "migpvt"
98+
Get-AzMigrateServerMigrationStatus -ProjectName "cbt-resync-gql" -ResourceGroupName "ankitbaluni-resync-rg" -ApplianceName "cbtresyncgql"
9099
```
91100

92101
```output
93-
Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore
94-
------ ----- -------- ----------- ------------- ----------- ------ -------- ---------
95-
CVM-Win2019 DeltaReplication Completed - - - - Normal 12/7/2023, 11:18:07 AM Shared_1TB, datastore1
96-
CVM-Win2022 DeltaReplication Completed - - - - Normal 12/7/2023, 10:41:42 AM datastore1
102+
Server State Progress TimeElapsed TimeRemaining UploadSpeed Health LastSync Datastore ESXiHost
103+
------ ----- -------- ----------- ------------- ----------- ------ -------- --------- --------
104+
el41-r5w12r1-3 InitialReplication InProgress 48 % 3 hr 48 min 12 hr 37 min 1230 Mbps Normal - IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
105+
el41-r5w2k8r2-1 DeltaReplication Completed - - - - Normal 9/4/2025, 3:04:45 PM IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
106+
dsinha-cbt-test DeltaReplication Completed - - - - Normal 9/4/2025, 2:58:21 PM IDCLAB-T100_10TB idclab-vcen65.corp.microsoft.com_10.150.84.28
97107
98108
109+
To check expedite the operation of a server use the command
110+
Get-AzMigrateServerMigrationStatus -ProjectName <String> -ResourceGroupName <String> -MachineName <String> -Expedite
111+
99112
To resolve the health issue use the command
100113
Get-AzMigrateServerMigrationStatus -ProjectName <String> -ResourceGroupName <String> -MachineName <String> -Health
101114
```
102115

103116
Get by appliance name.
104117

118+
### Example 4: Expedite replication for a server.
119+
```powershell
120+
Get-AzMigrateServerMigrationStatus -ProjectName "cbt-resync-gql" -ResourceGroupName "ankitbaluni-resync-rg" -MachineName "Rhel8-Vm" -Expedite
121+
```
122+
123+
```output
124+
Server Information:
125+
126+
Appliance Server State Progress TimeElapsed TimeRemaining UploadSpeed LastSync ESXiHost Datastore
127+
--------- ------ ----- -------- ----------- ------------- ----------- -------- -------- ---------
128+
cbtresyncgql Rhel8-Vm DeltaReplication Completed - - - - 7/14/2025, 9:51:05 PM idclab-vcen8.fareast.corp.microsoft.com_10.150.102.181 IDCLAB-B161-3TB
129+
130+
131+
132+
Disk Level Operation Status:
133+
134+
Disk State Progress TimeElapsed TimeRemaining UploadSpeed Datastore
135+
---- ----- -------- ----------- ------------- ----------- ---------
136+
Rhel8-Vm DeltaReplication Completed - - - - IDCLAB-B161-3TB
137+
138+
139+
Resource Sharing:
140+
141+
The following VMs share at least one resource (Appliance, ESXi Host, or Datastore) with VM 'Rhel8-Vm'. The 'SharedResourceType' and 'SharedResourceName' columns indicate which resource is shared.
142+
143+
Appliance Server SharedResourceType State TimeRemaining ESXiHost Datastore
144+
--------- ------ ------------------ ----- ------------- -------- ---------
145+
cbtresyncgql wave-selfhost-vm8 Appliance DeltaReplication Completed - idclab-vcen8.fareast.corp.microsoft.com_10.150.102.191 Shared_1TB
146+
cbtresyncgql el41-r5w12r2-1 Appliance DeltaReplication Completed - idclab-vcen65.corp.microsoft.com_10.150.84.28 IDCLAB-T100_10TB
147+
cbtresyncgql el41-r5w2k8r2-1 Appliance DeltaReplication Completed - idclab-vcen65.corp.microsoft.com_10.150.84.28 IDCLAB-T100_10TB
148+
cbtresyncgql el41-r5w12r1-2 Appliance DeltaReplication Completed - idclab-vcen65.corp.microsoft.com_10.150.84.28 IDCLAB-T100_10TB
149+
cbtresyncgql ubuntu22-liverserver-bios-nolvm Appliance, ESXiHost, Datastore DeltaReplication Completed - idclab-vcen8.fareast.corp.microsoft.com_10.150.102.181 IDCLAB-B161-3TB
150+
151+
152+
Resource utilization information for migration operations:
153+
154+
Resource Capacity Utilization for server migrations Total utilization Status
155+
-------- -------- --------------------------------- ----------------- ------
156+
Appliance RAM Sum : Primary and scale out appliances 32768 MB 1808 MB 7014 MB Underutilized
157+
Appliance CPU Sum : Primary and scale out appliances 4 Cores - 99% At capacity
158+
Network bandwidth Sum : Primary and scale out appliances 1192 MBps - - Underutilized
159+
ESXi host NFC buffer 32 MB 8 MB - Underutilized
160+
Parallel Disks Replicated Sum : Primary and scale out appliances 58 3 - Underutilized
161+
Datastore 'IDCLAB-B161-3TB' Snapshot Count 15 2 - Underutilized
162+
163+
164+
Based on the resource utilization seen above, here are suggestions to expedite server Rhel8-Vm migration:
165+
166+
1. CPU is At capacity. Pause or stop other migrations under this appliance, or increase CPU resources if possible.
167+
```
168+
169+
Expedite replication for a specific server.
170+
105171
## PARAMETERS
106172

107173
### -ApplianceName
@@ -134,6 +200,21 @@ Accept pipeline input: False
134200
Accept wildcard characters: False
135201
```
136202
203+
### -Expedite
204+
Specifies whether to expedite the operation of a replicating server.
205+
206+
```yaml
207+
Type: System.Management.Automation.SwitchParameter
208+
Parameter Sets: GetByPrioritiseServer
209+
Aliases:
210+
211+
Required: True
212+
Position: Named
213+
Default value: None
214+
Accept pipeline input: False
215+
Accept wildcard characters: False
216+
```
217+
137218
### -Filter
138219
OData filter options.
139220
@@ -165,12 +246,11 @@ Accept wildcard characters: False
165246
```
166247
167248
### -MachineName
168-
[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)]
169-
Specifies the display name of the replicating machine.
249+
Specifies the display name of the replicating machine.
170250
171251
```yaml
172252
Type: System.String
173-
Parameter Sets: GetByMachineName, GetHealthByMachineName
253+
Parameter Sets: GetByMachineName, GetByPrioritiseServer, GetHealthByMachineName
174254
Aliases:
175255

176256
Required: True
@@ -181,8 +261,7 @@ Accept wildcard characters: False
181261
```
182262
183263
### -ProjectName
184-
[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)]
185-
Specifies the Azure Migrate project in the current subscription.
264+
Specifies the Azure Migrate project in the current subscription.
186265
187266
```yaml
188267
Type: System.String
@@ -197,8 +276,7 @@ Accept wildcard characters: False
197276
```
198277
199278
### -ResourceGroupName
200-
[Parameter(ParameterSetName = 'GetByPrioritiseServer', Mandatory)]
201-
Specifies the Resource Group of the Azure Migrate Project in the current subscription.
279+
Specifies the Resource Group of the Azure Migrate Project in the current subscription.
202280
203281
```yaml
204282
Type: System.String

0 commit comments

Comments
 (0)