Skip to content

New-AzMigrateServerReplication is calling the get-AzVMSize command from 10.0.1, which removed -LOCATION as a parameter #27981

@ChristopherGLewis

Description

@ChristopherGLewis

Description

The Az.Migrate module's New-AzMigrateServerReplication at some point calls the Get-AzVMZSize (

$null = $PSBoundParameters.Add('Location', $TargetRegion)
$allAvailableSkus = Get-AzVMSize @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue
)

which is deprecated in the Az.compute 10.0.1 release. This causes the command to fail with:

342 | New-AzMigrateServerReplication -LicenseType $LicenseType …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| A parameter cannot be found that matches parameter name 'Location'.

PS C:> $error[0] | select *

PSMessageDetails :
Exception : System.Management.Automation.ParameterBindingException: A parameter cannot be found that matches parameter name 'Location'.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : InvalidArgument: (:) [Get-AzVMSize], ParameterBindingException
FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.Compute.GetAzureVMSizeCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at New-AzMigrateServerReplication,
C:\Users\XXX\Documents\PowerShell\Modules\Az.Migrate\2.6.0\Migrate.Autorest\custom\New-AzMigrateServerReplication.ps1: line 474
at New-AzMigrateServerReplication,
C:\Users\XXX\Documents\PowerShell\Modules\Az.Migrate\2.6.0\Migrate.Autorest\exports\ProxyCmdletDefinitions.ps1: line 5605
at , C:\Users\XXX\Desktop\AzureReadyFoundation\AzMigrateAutomation\Start-AzMigrateReplication.ps1: line 342
at , : line 1

Issue script & Debug output

(Stripped to last REST API passing command)

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : af88f866-6ac2-4811-a4b1-51c8dc3757ba 6/17/2025 7:49:57 PM
X-Content-Type-Options        : nosniff
x-ms-client-request-id        : af88f866-6ac2-4811-a4b1-51c8dc3757ba
x-ms-operation-identifier     : tenantId=XXX  
x-ms-ratelimit-remaining-subscription-reads: 249
x-ms-ratelimit-remaining-subscription-global-reads: 3749
x-ms-correlation-request-id   : 89b3ce42-6680-446b-8ccd-9d301b2eb22e
x-ms-routing-request-id       : EASTUS:20250617T194957Z:89b3ce42-6680-446b-8ccd-9d301b2eb22e
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: AAF2ABEAFEE1439B88E4FA544C14F8B4 Ref B: BN1AA2051015025 Ref C: 2025-06-17T19:49:56Z
Date                          : Tue, 17 Jun 2025 19:49:57 GMT

Body:
{
  "id": "/Subscriptions/XXX/resourceGroups/azmigrate-prod-rg/providers/Microsoft.RecoveryServices/vaults/azrmigrate016706vault/replicationFabrics/azrmigrate0105f0replicationfabric/replicationProtectionContainers/azrmigrate0105f0replicationcontainer/replicationProtectionContainerMappings/containermapping",     
  "name": "containermapping",
  "type": "Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings",
  "properties": {
    "targetProtectionContainerId": "Microsoft Azure",
    "targetProtectionContainerFriendlyName": "Microsoft Azure",
    "providerSpecificDetails": {
      "instanceType": "VMwareCbt",
      "keyVaultId": null,
      "keyVaultUri": null,
      "storageAccountId": "/subscriptions/xxx/resourceGroups/AzMigrate-Prod-RG/providers/Microsoft.Storage/storageAccounts/azrmigrate016706eus2",
      "storageAccountSasSecretName": null,
      "serviceBusConnectionStringSecretName": null,
      "targetLocation": "eastus2",
      "roleSizeToNicCountMap": {
        "default": 1,
        "extraSmall": 2,
        "small": 2,
        "medium": 2,
        "large": 2,
        "a6": 2,
        "a7": 4,
        "a8": 2,
        "a9": 4,
        "a10": 2,
        "a11": 4,
        "standard_NV6": 2,
        "standard_NV12": 2,
        "standard_NV24": 4,
. . . 
        
        "standard_EC20as_v5": 8,
        "standard_EC32as_v5": 8,
        "standard_EC48as_v5": 8,
        "standard_EC64as_v5": 8,
        "standard_EC96as_v5": 8,
        "standard_PB6s": 1
      },
      "excludedSkus": [
        "Standard_DC2s",
        "Standard_DC4s",
        "Standard_DC8s"
      ]
    },
    "health": "Normal",
    "healthErrorDetails": [],
    "policyId": "/Subscriptions/XXX/resourceGroups/azmigrate-prod-rg/providers/Microsoft.RecoveryServices/vaults/azrmigrate016706vault/replicationPolicies/migrateazrmigrate016706sitepolicy",
    "state": "Paired",
    "sourceProtectionContainerFriendlyName": "azrmigrate0105f0replicationcontainer",
    "sourceFabricFriendlyName": "azrmigrate0105f0replicationfabric",
    "targetFabricFriendlyName": "Microsoft Azure",
    "policyFriendlyName": "migrateazrmigrate016706sitepolicy"
  }
}


DEBUG: ResponseCreated: 
DEBUG: BeforeResponseDispatch: 
DEBUG: 2:49:57 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: Finally: 
DEBUG: CmdletAfterAPICall: 
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd: 
DEBUG: CmdletProcessRecordEnd: 

Error in next command

Environment data

C:\Temp> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Error occurs with 
Az.Compute 10.0.1 
Az.Migrate 2.8.0

Error output

$error[0] | select *

PSMessageDetails :
Exception : System.Management.Automation.ParameterBindingException: A parameter cannot be found that matches parameter name 'Location'.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : InvalidArgument: (:) [Get-AzVMSize], ParameterBindingException
FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.Compute.GetAzureVMSizeCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at New-AzMigrateServerReplication,
C:\Users\XXX\Documents\PowerShell\Modules\Az.Migrate\2.6.0\Migrate.Autorest\custom\New-AzMigrateServerReplication.ps1: line 474
at New-AzMigrateServerReplication,
C:\Users\XXX\Documents\PowerShell\Modules\Az.Migrate\2.6.0\Migrate.Autorest\exports\ProxyCmdletDefinitions.ps1: line 5605
at , C:\Users\XXX\Desktop\AzureReadyFoundation\AzMigrateAutomation\Start-AzMigrateReplication.ps1: line 342
at , : line 1
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    MigrateService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions