LogicAppCollaborative / PsLogicAppExtractor

MIT License
3 stars 3 forks source link

Error after using 0.6.1 - Exception: Assert: Task Export-LogicApp.AzCli does not exist. #52

Open Ruprect opened 1 year ago

Ruprect commented 1 year ago

After re-installing my computer, I was unable to run my script to export Logic Apps.

When running my powershell and runbook (see below) I get the following error:

Exception: Error: 29/06/2023 12.56.37:  At ...\PowerShell\Modules\psake\4.9.0\public\Assert.ps1:69 char:9 +
   throw ('Assert: {0}' -f$failureMessage) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] 
    Exception: Assert: Task Export-LogicApp.AzCli does not exist.

But by uninstalling 0.6.1 and installing version 0.5.15 the error is fixed:

UnInstall-Module -Name PsLogicAppExtractor
Install-Module -Name PsLogicAppExtractor -RequiredVersion 0.5.15
My powershell script

```powershell Invoke-PsLaExtractor -Runbook $runbookpath ` -SubscriptionId $SubscriptionId ` -ResourceGroup $ResourceGroup ` -Name "$LogicAppName" ` -OutputPath "$RootPath/Logic Apps/" ```

My runbook

```powershell # Object to store the needed parameters for when running the export Properties { $SubscriptionId = "" $ResourceGroup = "" $Name = "" $ApiVersion = "2019-05-01" } # Used to import the needed classes into the powershell session, to help with the export of the Logic App ."$(Get-PSFConfigValue -FullName PsLogicAppExtractor.ModulePath.Classes)\PsLogicAppExtractor.class.ps1" # Path variable for all the tasks that is available from the PsLogicAppExtractor module $pathTasks = $(Get-PSFConfigValue -FullName PsLogicAppExtractor.ModulePath.Tasks) # Include all the tasks that is available from the PsLogicAppExtractor module Include "$pathTasks\All\All.task.ps1" # Array to hold all tasks for the default task $listTasks = @() # Building the list of tasks for the default task #Pick ONE of these two $listTasks += "Export-LogicApp.AzCli" #$listTasks += "Export-LogicApp.AzAccount" $listTasks += "ConvertTo-Raw" $listTasks += "Set-Raw.ApiVersion" $listTasks += "ConvertTo-Arm" $listTasks += "Set-Arm.Connections.ManagedApis.IdFormatted" $listTasks += "Set-Arm.Connections.ManagedApis.AsParameter" $listTasks += "Set-Arm.LogicApp.Name.AsParameter" $listTasks += "Set-Arm.LogicApp.Parm.AsParameter" # Default tasks, the via the dependencies will run all tasks Task -Name "default" -Depends $listTasks ```

Splaxi commented 1 year ago

This is expected, as we have breaking changes. But I'm more than happy to assist you in getting unblocked.

The reason was that we were having multiple files (internal ones), where the only difference was which tool to use: AzCli or Az.Powershell.

So to make things simpler to maintaing, and make it easier for the end-user (someone like you) - this have been moved out to the Invoke-PsLaExtractor parameter tools. This instructs the cmdlets which tool to use, when executing different tasks.

https://github.com/LogicAppCollaborative/PsLogicAppExtractor/blob/development/docs/Invoke-PsLaExtractor.md#-tools

So your script should look like:

Invoke-PsLaExtractor -Runbook $runbookpath `
   -SubscriptionId $SubscriptionId `
   -ResourceGroup $ResourceGroup `
   -Name "$LogicAppName" `
   -OutputPath "$RootPath/Logic Apps/"
   -Tools "AzCli"

and your runbook should have this change

#Pick ONE of these two
$listTasks += "Export-LogicApp"
#$listTasks += "Export-LogicApp.AzCli"
#$listTasks += "Export-LogicApp.AzAccount"