Skip to content

Commit 4637215

Browse files
Az.Migrate - New-AzMigrateServerReplication - Minor change to switch deprecated Get-AzVMSize -loc to Get-AzComputeResourceSKU -loc (#28019)
1 parent 02f92f5 commit 4637215

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Migrate/Migrate.Autorest/custom/New-AzMigrateServerReplication.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ function New-AzMigrateServerReplication {
471471
$null = $PSBoundParameters.Remove('ResourceName')
472472
$null = $PSBoundParameters.Remove('SubscriptionId')
473473
$null = $PSBoundParameters.Add('Location', $TargetRegion)
474-
$allAvailableSkus = Get-AzVMSize @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
474+
#Get-AzVMSku -Location is deprecated, replicate using Get-AzComputeResourceSKU and a where clause
475+
$allAvailableSkus = Get-AzComputeResourceSKU @PSBoundParameters| Where-Object { $_.ResourceType.Contains("virtualMachines") }
475476
if ($null -ne $allAvailableSkus) {
476477
$matchingComputeSku = $allAvailableSkus | Where-Object { $_.Name -eq $TargetVMSize }
477478
if ($null -ne $matchingComputeSku) {
@@ -747,4 +748,4 @@ public static int hashForArtifact(String artifact)
747748

748749
}
749750

750-
}
751+
}

src/Migrate/Migrate/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21-
21+
* Fixed bugs in `New-AzMigrateServerReplication` caused by deprecation of `Get-AzVmSize -location`
22+
2223
## Version 2.8.0
2324
* Implemented the Get-AzMigrateServerMigrationStatus cmdlet to retrieve the replication status of servers in Azure Migrate.
2425
* Fixed bugs in `New-AzMigrateLocalServerReplication` that caused HyperVSite or VMwareSite not found.

0 commit comments

Comments
 (0)