Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
111 stars 76 forks source link

New-AzStorageMoverNfsEndpoint parameter $Host results in "You cannot call a method on a null-valued expression" #1174

Closed yifanz7 closed 1 year ago

yifanz7 commented 1 year ago

Cmdlet New-AzStorageMoverNfsEndpoint errors out with

PS C:\Users\yifanzhang> New-AzStorageMoverNfsEndpoint -Name testnfsendasdasd1 -ResourceGroupName yifanz1 -StorageMoverName testpreviewsm1 -Host 10.0.0.1 -NfsVersion 'NFSv3' -Export '/'
You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Az.StorageMover\1.0.0\exports\ProxyCmdletDefinitions.ps1:4172 char:13
+             [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePS ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvokeMethodOnNull

It seems like the parameter $Host has conflicts with some system parameter called $host and the input $host overwrites the system $host value. The cmdlet had worked before when the module Az.StorageMover was first released

dolauli commented 1 year ago

It was fixed in https://github.com/Azure/autorest.powershell/commit/4ae3580bc73142af5e2b905728366ef99c282078.