Azure / azure-powershell-migration

Tools and resources to help migrate PowerShell scripts between incompatible versions of Az and AzureRM modules
MIT License
35 stars 16 forks source link

Doesn't pickup calls that are in a variable #134

Open AtleeRRN opened 8 months ago

AtleeRRN commented 8 months ago

Component [X] PowerShell module [] VSCode extension [] Other

Description of the issue Does not seem to migrate commands within a variable.

Describe how to reproduce the issue

Function Confirm-MicrosoftGraphServicePrincipal {
    $graphsp = Get-AzureADServicePrincipal -SearchString "Microsoft Graph"
    if (!$graphsp) {
        $graphsp = Get-AzureADServicePrincipal -SearchString "Microsoft.Azure.AgregatorService"
    }
    if (!$graphsp) {
        Login-AzureRmAccount -Credential $Credential
        New-AzureRmADServicePrincipal -ApplicationId "00000003-0000-0000-c000-000000000000"
        $graphsp = Get-AzureADServicePrincipal -SearchString "Microsoft Graph"
    }
    return $graphsp
}

Will only pick up

1 test.ps1:8:9 Cmdlet ReadyToUpgrade New-AzureRmADServicePrincipal New-AzADServicePrincipal 2 test.ps1:7:9 Cmdlet ReadyToUpgrade Login-AzureRmAccount Login-AzAccount

I expect Get-AzureADServicePrincipal to be changed to Get-AzADServicePrincipal

Environment PSVersion 7.3.10 https://www.powershellgallery.com/packages/Az.Tools.Migration/11.0.0 Windows 11 22631.3007

Error output

Additional context