Deprecated Actions IV: Scanning Solutions

The three previous posts in this series have examined how to obtain a list of deprecated actions in connectors, so that we can consider migrating to an updated action or alternative connector. In this post I will demonstrate a script that checks power platform solutions for deprecated actions.

Scenario

We are following healthy ALM practices and storing our solutions ‘unpacked’ in source control. We’d like a tool similar to the Power Apps solution checker that checks if any deprecated actions exist within a solution.

Introducing Connector History and Connector Status

Using the techniques in the previous posts we can obtain the status of connectors and actions from Microsoft’s connector-reference. To make it easier to consume, the modified output of this process has been automated and published to the connectorstatus.com micro-site and associated github repository.

Always refer to Microsoft’s connector-reference because connectorstatus.com and the associated github repository are published ‘as-is’ and on a best-effort basis.

PowerShell Script

ConnectorCheck.ps1 is a Powershell script that examines an unpacked solution and reports on the connectors and actions used. The script:

  1. Downloads the current unofficial consolidated JSON list of deprecated actions from connectorstatus.com.
  2. Checks that the solnfolder parameter contains a solution by checking the file Other\Solution.xml exists.
  3. Scans any power automate cloud flows examining any connection references and actions used.
  4. Scans any Power Fx (aka canvas apps) examining any connection references and actions used.
  5. Reports on the number of times each action is used and if the action is deprecated.
  6. If any deprecated actions are used it reports on the connector, action, file and line number where found.

This script is available in the github.com/filcole/ConnectorCheck repository. The syntax to run the script is:

ConnectorCheck.ps1 [-solnfolder] <String> [-skipCloudFlows] [-skipPowerFx] [<CommonParameters>]

-solnfolder must be a path to a folder containing an unpacked solution.
-skipCloudFlows will prevent scanning of power automate cloud flows (see step 3 above).
-skipPowerFx will prevent scanning of Power Fx formulas (see step 4 above).

To use the script the solution must be unpacked (e.g. via solutionpackager.exe /action:extract, pac solution unpack). If the solution contains any Power Fx files (canvas app .msapp files) these must also be unpacked with with pac canvas unpack. The ALM Accelerator for Advanced Makers (Preview) pipeline performs these steps as part of its process of exporting a solution.

The PowerShell script depends on the internal structure of a Power Platform solution, and as such may stop working if Microsoft alter the solution structure.

Example Usage and Output

For demonstration purposes we’ll use the publicly available solutions in the COE Starter Kit. These comprise a number of solutions containing multiple cloud flows, canvas apps and connectors. For this example we’ll use the CenterofExcellenceCoreComponentsTeams solution, the source of which is browseable here.

The output of the script is shown below.

PS C:\Dev\Repos\ConnectorChecker> .\ConnectorCheck.ps1 -solnFolder ..\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage

Downloading deprecated actions from https://connectorstatus.com/Deprecated.json
Read 502 deprecated actions
Scanning flows in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\Workflows
Scanning flow AdminCapacityAlerts-108A99EF-B08C-EB11-A812-000D3A1F6308.json
Scanning flow AdminCompliancedetailrequestTeamsv3-F75822C8-C4B4-EB11-8236-000D3A15F3CC.json
Scanning flow AdminCompliancedetailrequestv2Teams-5B902817-229D-EB11-B1AC-000D3A1345FC.json
Scanning flow AdminSyncTemplatev3-9E9FFF08-A643-EB11-A813-000D3A1BB495.json
Scanning flow AdminSyncTemplatev3Apps-2617D7A7-2C3B-EB11-A813-000D3A1BB495.json
Scanning flow AdminSyncTemplatev3Connectors-7E1DDB35-613D-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3CustomConnectors-AE1EF367-1B3E-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3Desktopflowruns-025CD295-93F2-EA11-A815-000D3A31CF04.json
Scanning flow AdminSyncTemplatev3Desktopflows-8091A1F0-1042-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3FlowActionDetails-7EBB10A6-5041-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3Flows-D9F8DF64-C838-EB11-A813-000D3A1BB495.json
Scanning flow AdminSyncTemplatev3ModelDrivenApps-B94B3718-C23F-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3PVA-B1404DE5-6444-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminSyncTemplatev3SyncFlowErrors-69C0077E-DF40-EB11-A813-000D3A8F4AD6.json
Scanning flow AdminWelcomeEmailv3-F98071EE-73A6-EB11-B1AC-000D3A19E1B0.json
Scanning flow CLEANUP-AdminSyncTemplatev3CheckDeleted-41419923-AB44-EB11-A813-000D3A8F4AD6.json
Scanning flow CLEANUP-AdminSyncTemplatev3ConnectionStatus-D753F10F-F03E-EB11-A813-000D3A8F4AD6.json
Scanning flow CLEANUP-AdminSyncTemplatev3OrphanedMakers-E05CFB27-740D-EB11-A814-000D3A1BB7BB.json
Scanning flow CLEANUP-AdminSyncTemplatev3PowerAppsUserSharedWith-B0EDF614-AD0F-EB11-A814-000D3A1BB7BB.json
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisapp_3a757_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_appcatalog_90b40_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_dlpeditorv2_fcf06_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_powerplatformadminview_4f3be_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src
Scanning CanvasApp in C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src

Summary of 202 usages:

 36 usages of Office365Users|UserProfileV2
 17 usages of commondataserviceforapps|ListRecords
 17 usages of PowerAppsforAdmins|GetAdminAppRoleAssignment
 16 usages of Office365Users|UserPhotoV2
 14 usages of *** DEPRECATED *** Office365Users|SearchUser
 13 usages of PowerAppsforAdmins|EditAdminAppRoleAssignment
 11 usages of PowerAutomateforAdmins|EditAdminFlowOwnerRole
  9 usages of PowerAppsforAdmins|SetAdminAppOwner
  6 usages of Office365Users|UserPhotoMetadata
  5 usages of Office365Users|MyProfileV2
  5 usages of office365|SendEmailV2
  5 usages of MicrosoftFlowforAdmins|EditAdminFlowOwnerRole
  5 usages of PowerAutomateforAdmins|GetAdminFlowOwnerRole
  5 usages of MicrosoftFlowforAdmins|GetAdminFlowOwnerRole
  4 usages of Office365Outlook|SendEmailV2
  4 usages of *** DEPRECATED *** Office365Users|UserProfile
  3 usages of powerplatformforadmins|Get-AdminEnvironment
  2 usages of PowerAppsforAdmins|RemoveAdminApp
  2 usages of PowerAutomateforAdmins|RemoveAdminFlow
  2 usages of PowerPlatformforAdmins|CreatePolicyV2
  2 usages of PowerPlatformforAdmins|UpdatePolicyV2
  2 usages of *** DEPRECATED *** Office365Users|UserPhoto
  2 usages of Flow|DeleteFlow
  2 usages of commondataserviceforapps|CreateRecord
  1 usages of powerappsforadmins|Get-AdminAppRoleAssignment
  1 usages of powerappsforadmins|Get-AdminApps
  1 usages of PowerAppsforAdmins|GetAdminConnectors
  1 usages of office365groups|ListGroupMembers
  1 usages of office365groups|AddMemberToGroup
  1 usages of PowerAppsforMakers|GetConnectors
  1 usages of *** DEPRECATED *** Office365|SendEmail
  1 usages of Flow|GetFlow
  1 usages of commondataserviceforapps|UpdateRecord
  1 usages of PowerPlatformforAdmins|GetAdminEnvironment
  1 usages of powerplatformforadmins|GetSingleEnvironment
  1 usages of PowerPlatformforAdmins|ListPoliciesV2
  1 usages of commondataservice|GetItems_V2

Usages of deprecated actions: 21

Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisapp_3a757_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:390
Office365Users|UserPhoto in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisapp_3a757_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:631
Office365Users|UserProfile in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:168
Office365Users|UserProfile in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:169
Office365Users|UserPhoto in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:188
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:700
Office365Users|UserProfile in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\Screen1.fx.yaml:264
Office365Users|UserProfile in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_adminaccessthisflow_886fb_DocumentUri_msapp_src\Src\Screen1.fx.yaml:265
Office365|SendEmail in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_appcatalog_90b40_DocumentUri_msapp_src\Src\scrDetail.fx.yaml:761
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src\Src\AppDetailsMakerScreen.fx.yaml:1222
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src\Src\AppDetailsScreen.fx.yaml:1212
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:955
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src\Src\OrphanedAppScreen.fx.yaml:1017
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setapppermissions_37e74_DocumentUri_msapp_src\Src\OwnerScreen.fx.yaml:966
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\FlowDetailsScreen.fx.yaml:1280
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\HomeScreen.fx.yaml:946
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\OrphanedFlowScreen.fx.yaml:878
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\OwnerScreen.fx.yaml:965
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\scrHome.fx.yaml:2291
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\scrOrphaned.fx.yaml:736
Office365Users|SearchUser in Power Fx at C:\Dev\Repos\coe-starter-kit\CenterofExcellenceCoreComponentsTeams\SolutionPackage\CanvasApps\admin_setflowpermissions_ce2bb_DocumentUri_msapp_src\Src\scrOwner.fx.yaml:868

By reviewing the output we can see that the script:

  1. Downloaded and parsed 502 deprecated actions from connectorstatus.com
  2. Scanned multiple cloud flows in the Workflows folder and multiple canvas apps (Power Fx) in the CanvasApps folder.
  3. Found 202 usages of actions, listing them in decreasing order of number of times used.
  4. Found 21 usages of deprecated actions, listing the connector, action and location where the deprecated action is used. e.g. The SearchUser operation in the Office 365 Users connector.

It should be stated that even though the COE starter kit does reference some deprecated actions, it is fully functional and a well-engineered and maintained solution.

Summary

Using the CheckConnectors.ps1 script:

  • We can check our solutions for usages of actions.
  • We are informed if any deprecated actions that are in use in the solution.

Improvements

  1. Work towards adding something similar to the ALM Accelerator for Advanced Makers (Preview). See issue 985.
  2. Work towards adding something similar to the COE Starter Kit to monitor existing environments. See issue 981.
  3. Add support for triggers.

Source Code

You can get the source code in the CheckConnector github repo. I am a beginner at PowerShell and any improvements, corrections, or comments are greatly appreciated, either via github or any of my socials: LinkedIn or Twitter.

References