Skip to content

Commit

Permalink
Migrate Migrate from generation to main (Azure#26925)
Browse files Browse the repository at this point in the history
* Move Migrate to main

* Update ChangeLog.md

---------

Co-authored-by: Yabo Hu <yabhu@microsoft.com>
  • Loading branch information
azure-powershell-bot and VeryEarly authored Dec 24, 2024
1 parent 3513c12 commit 1ac6db6
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 25 deletions.
12 changes: 9 additions & 3 deletions src/Migrate/Migrate.Autorest/custom/New-AzMigrateDiskMapping.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function New-AzMigrateDiskMapping {
${IsOSDisk},

[Parameter(Mandatory)]
[ValidateSet("Standard_LRS", "Premium_LRS", "StandardSSD_LRS")]
[ArgumentCompleter( { "Standard_LRS", "Premium_LRS", "StandardSSD_LRS" })]
[ValidateSet("Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "PremiumV2_LRS")]
[ArgumentCompleter( { "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "PremiumV2_LRS"})]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the type of disks to be used for the Azure VM.
Expand All @@ -61,7 +61,8 @@ function New-AzMigrateDiskMapping {
$validDiskTypeSpellings = @{
Standard_LRS = "Standard_LRS";
Premium_LRS = "Premium_LRS";
StandardSSD_LRS = "StandardSSD_LRS"
StandardSSD_LRS = "StandardSSD_LRS";
PremiumV2_LRS = "PremiumV2_LRS";
}
$DiskObject.DiskType = $validDiskTypeSpellings[$DiskType]

Expand All @@ -73,6 +74,11 @@ function New-AzMigrateDiskMapping {
if ($PSBoundParameters.ContainsKey('DiskEncryptionSetID')) {
$DiskObject.DiskEncryptionSetId = $DiskEncryptionSetID
}

if ($DiskObject.IsOSDisk -eq "true" -and $DiskObject.DiskType -eq $validDiskTypeSpellings["PremiumV2_LRS"]) {
throw "Premium SSD V2 disk is not supported as an OS Disk in Azure."
}

return $DiskObject
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,17 @@ public static int hashForArtifact(String artifact)
}


# Check for duplicate disk UUID in user input/discovered VM.
# Check for duplicate disk UUID in user input/discovered VM and Premium V2 disk validations.
foreach ($disk in $ProviderSpecificDetails.DisksToInclude)
{
if ($uniqueDiskUuids.Contains($disk.DiskId)) {
throw "The disk uuid '$($disk.DiskId)' is already taken."
}

if (-not $HasTargetAVZone -and $disk.DiskType -eq "PremiumV2_LRS") {
throw "Premium SSD V2 disk can only be attached to zonal VMs."
}

$res = $uniqueDiskUuids.Add($disk.DiskId)
}

Expand Down
21 changes: 15 additions & 6 deletions src/Migrate/Migrate.Autorest/examples/New-AzMigrateDiskMapping.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
### Example 1: Make disks
### Example 1: Make Standard disks
```powershell
New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true'
New-AzMigrateDiskMapping -DiskID a -DiskType Standard_LRS -IsOSDisk 'true'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard true
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard_LRS true
```

Get disks object to provide input for New-AzMigrateServerReplication
### Example 2: Make Premium V2 disks
```powershell
New-AzMigrateDiskMapping -DiskID b -DiskType PremiumV2_LRS -IsOSDisk 'false'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
b PremiumV2_LRS false
```

Get disks object to provide input for New-AzMigrateServerReplication
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is for the scenario, when there is only one single disk that has to be prot
```powershell
$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true'
$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false'
$DisksToInclude = @()
$DisksToInclude += $OSDisk
$DisksToInclude += $DataDisk
New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Creates a new disk mapping
.Description
The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attached to the server to be migrated
.Example
New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true'
New-AzMigrateDiskMapping -DiskID a -DiskType Standard_LRS -IsOSDisk 'true'
.Example
New-AzMigrateDiskMapping -DiskID b -DiskType PremiumV2_LRS -IsOSDisk 'false'
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202401.IVMwareCbtDiskInput
Expand All @@ -45,7 +47,7 @@ param(
${IsOSDisk},

[Parameter(Mandatory)]
[ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS" })]
[ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "PremiumV2_LRS"})]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the type of disks to be used for the Azure VM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx4/resourceG
.Example
$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true'
$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false'
$DisksToInclude = @()
$DisksToInclude += $OSDisk
$DisksToInclude += $DataDisk
New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4365,7 +4365,9 @@ Creates a new disk mapping
.Description
The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attached to the server to be migrated
.Example
New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true'
New-AzMigrateDiskMapping -DiskID a -DiskType Standard_LRS -IsOSDisk 'true'
.Example
New-AzMigrateDiskMapping -DiskID b -DiskType PremiumV2_LRS -IsOSDisk 'false'
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202401.IVMwareCbtDiskInput
Expand All @@ -4390,7 +4392,7 @@ param(
${IsOSDisk},

[Parameter(Mandatory)]
[ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS" })]
[ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "PremiumV2_LRS"})]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the type of disks to be used for the Azure VM.
Expand Down Expand Up @@ -5275,6 +5277,7 @@ New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx4/resourceG
.Example
$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true'
$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false'
$DisksToInclude = @()
$DisksToInclude += $OSDisk
$DisksToInclude += $DataDisk
New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true
Expand Down
23 changes: 18 additions & 5 deletions src/Migrate/Migrate.Autorest/help/New-AzMigrateDiskMapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@ The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attache

## EXAMPLES

### Example 1: Make disks
### Example 1: Make Standard disks
```powershell
New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true'
New-AzMigrateDiskMapping -DiskID a -DiskType Standard_LRS -IsOSDisk 'true'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard true
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard_LRS true
```



### Example 2: Make Premium V2 disks
```powershell
New-AzMigrateDiskMapping -DiskID b -DiskType PremiumV2_LRS -IsOSDisk 'false'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
b PremiumV2_LRS false
```

Get disks object to provide input for New-AzMigrateServerReplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ This is for the scenario, when there is only one single disk that has to be prot
```powershell
$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true'
$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false'
$DisksToInclude = @()
$DisksToInclude += $OSDisk
$DisksToInclude += $DataDisk
New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true
Expand Down
2 changes: 1 addition & 1 deletion src/Migrate/Migrate/Az.Migrate.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 12/17/2024
# Generated on: 12/24/2024
#

@{
Expand Down
1 change: 1 addition & 0 deletions src/Migrate/Migrate/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added support for PremiumV2 disk type.
* Added SBM support.

## Version 2.5.0
Expand Down
21 changes: 16 additions & 5 deletions src/Migrate/Migrate/help/New-AzMigrateDiskMapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,26 @@ The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attache

## EXAMPLES

### Example 1: Make disks
### Example 1: Make Standard disks
```powershell
New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true'
New-AzMigrateDiskMapping -DiskID a -DiskType Standard_LRS -IsOSDisk 'true'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard true
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
a Standard_LRS true
```

### Example 2: Make Premium V2 disks
```powershell
New-AzMigrateDiskMapping -DiskID b -DiskType PremiumV2_LRS -IsOSDisk 'false'
```

```output
DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName
------------------- ------ -------- -------- ------------------- ------------------------------
b PremiumV2_LRS false
```

Get disks object to provide input for New-AzMigrateServerReplication
Expand Down
1 change: 1 addition & 0 deletions src/Migrate/Migrate/help/New-AzMigrateServerReplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ This is for the scenario, when there is only one single disk that has to be prot
```powershell
$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true'
$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false'
$DisksToInclude = @()
$DisksToInclude += $OSDisk
$DisksToInclude += $DataDisk
New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true
Expand Down

0 comments on commit 1ac6db6

Please sign in to comment.