Power Apps Checker Action
Tags: actionshackathon, powerapps
Published: 2020-09-06 04:37:07

[Power Apps Checker](https://powerapps.microsoft.com/en-us/blog/make-higher-quality-apps-with-solution-checker/) is a Microsoft service that helps you to check the quality of your Solutions and generates recommendations and suggestions that can be used to improve the quality of your solution. It is sort of the ESLint for Power Apps Solutions.

For example below are some rules that are checked by Power Apps Checker

|Id| Description                                                                                                                                                               
|- | -                                                                                                                                                              
|meta-remove-dup-reg                     | Do not duplicate plug-in step registration                                                                                                                                      
|flow-avoid-invalid-reference            | Include valid references for actions                                                                                                                                            
|web-avoid-crm2011-service-soap          | Do not target the Microsoft Dynamics CRM 2011 SOAP services                                                                                                                     
|il-avoid-unpub-metadata                 | Retrieve published metadata                                                                                                                                                     
|il-avoid-crm2011-depr-message           | Do not use Microsoft Dynamics CRM 2011 deprecated messages                                                                                                                      
|app-avoid-autostart                     | Autostart of video and audio files can be distracting. Let users choose whether to play or not.                                                                                 
|app-formula-issues-low                  | There are formula issues for the app reported by app checker that are of low severity                                                                                           
|app-use-delayoutput-text-input          |                                                                                                                                                                                 
|web-use-navigation-api                  | Use the navigation APIs                                                                                                                                                         
|web-avoid-isactivitytype                |                                                                                                                                                                                 
|flow-avoid-recursive-loop               | Avoid recursive action as they may result in an infinite trigger loop                                                                                                           
|il-specify-column                       | Retrieve specific columns for an entity via query APIs                                                                                                                          
|app-formula-issues-medium               | There are formula issues for the app reported by app checker that are of medium severity                                                                                        
|web-use-global-context                  | Use the global context                                                                                                                                                          
|app-include-readable-screen-name        | People who are blind, have low vision, or a reading disability rely on screen titles to navigate using the screen reader.                                                       
|meta-avoid-crm4-event                   | Do not use Microsoft Dynamics CRM 4.0 plug-in registration stage                                                                                                                
|web-use-client-context                  | Use client contexts                                                                                                                                                             
|app-avoid-interactive-html              | Your app won't work correctly and will not be accessible if you place interactive HTML elements.                                                                                
|web-remove-debug-script                 | Avoid including debug script in non-development environments                                                                                                                    
|web-avoid-2011-api                      | Do not use the deprecated Microsoft Dynamics CRM 2011 object model                                                                                                              
|web-avoid-modals                        | Use the Client API functions for Dialogs                                                                                                                                        
|app-include-alternative-input           | Some users can't use a pen and require another way to input information. Example: Typing in a signature.                                                                        
|meta-avoid-silverlight                  | Silverlight web resource usage is deprecated                                                                                                                                    
|il-use-autonumber-feature               | Use the built-in auto number feature instead of a custom auto numbering solution                                                                                                
|il-avoid-parallel-plugin                | The usage of parallel patterns should be avoided within plug-ins                                                                                                                
|app-include-tab-order                   | When a screen reader reads the elements of a slide, it's important that they appear in the order that a user would see them, instead of the order they were added to the slide. 
|app-include-helpful-control-setting     | Changing this property setting will give the user better information about the function of the controls in your app.                                                            
|il-avoid-specialized-update-ops         | Do not use specialized update operation requests                                                                                                                                
|web-use-strict-mode                     | Use strict mode when possible                                                                                                                                                   
|il-avoid-lock-plugin                    | Avoid lock of static members in plug-ins                                                                                                                                        
|app-reduce-screen-controls              |                                                                                                                                                                                 
|il-avoid-batch-plugin                   | Avoid usage of batch request types in plug-ins and workflow activities                                                                                                          
|app-include-captions                    | Without captions, people with disabilities may not get any of the information in a video or audio segment.                                                                      
|meta-avoid-reg-no-attribute             | Include filtering attributes with plug-in registration                                                                                                                          
|app-include-accessible-label            | If there's no accessible text, people who can’t see the screen won't understand what’s in images and controls.                                                                  
|web-remove-console                      | Remove console statements in client script                                                                                                                                      
|meta-remove-inactive                    | Remove deactivated or disabled customizations                                                                                                                                   
|web-avoid-crm2011-service-odata         | Do not target the Microsoft Dynamics CRM 2011 OData 2.0 endpoint                                                                                                                
|web-avoid-browser-specific-api          | Avoid using Internet Explorer legacy APIs or browser plug-ins                                                                                                                   
|web-use-async                           | Interact with HTTP and HTTPS resources asynchronously                                                                                                                           
|meta-avoid-reg-retrieve                 | Limit the registration of plug_ins for Retrieve and RetrieveMultiple messages                                                                                                   
|meta-avoid-retrievemultiple-annotation  | Avoid registering a plugin on RetrieveMultiple of annotation                                                                                                                    
|web-use-strict-equality-operators       | Use strict equality operators                                                                                                                                                   
|web-use-relative-uri                    | Do not use absolute CDS for Apps endpoint URLs                                                                                                                                  
|web-use-offline                         | Use the offline API                                                                                                                                                             
|app-make-focusborder-visible            | If the focus isn't visible, people who don't use a mouse won't be able to see it when they're interacting with the app.                                                         
|web-remove-alert                        | Remove alert statements in client script                                                                                                                                        
|app-formula-issues-high                 | There are formula issues for the app reported by app checker that are of high severity                                                                                          
|app-include-tab-index                   | People who use the keyboard with your app will not be able to access this element without a tab stop.                                                                           
|flow-outlook-attachment-missing-info    | Include all required outlook attachment information                                                                                                                             
|il-turn-off-keepalive                   | Set KeepAlive to false when interacting with external hosts in a plug-in                                                                                                        
|web-avoid-window-top                    | Avoid using window.top                                                                                                                                                          
|app-include-state-indication-text       | Users won't get confirmation of their actions if the state of the control isn't showing.                                                                                        
|web-use-grid-api                        | Use the grid APIs                                                                                                                                                               
|web-avoid-eval                          | Do not use the 'eval' function or its functional equivalents.                                                                                                                   
|web-use-org-setting                     | Use organization settings                                                                                                                                                       
|web-unsupported-syntax                  | web-unsupported-syntax                                                                                                                                                                                                 

This Action uses the [Power Apps Checker PS module](https://docs.microsoft.com/en-us/powershell/powerapps/get-started-powerapps-checker?WT.mc_id=BA-MVP-5002420). You would need to register a new app on Azure AD, give it access to PowerApps-Advisor application and also create a secret. You would then be able to use the ApplicationId and Secret in this Action.

![Azure AD](https://dev-to-uploads.s3.amazonaws.com/i/v4koxiwr586q1uxkieb9.png)

Here is sample output of the Action running.

![Action Run](https://dev-to-uploads.s3.amazonaws.com/i/w1ds5j06socepid82va1.png)

The action also create a new issue with the Power Apps Checker recommendations, if there are any.

![Recommendations as Issue](https://dev-to-uploads.s3.amazonaws.com/i/uiynbxzusfv4yc5ob75z.png)

The sarif file with the full set of recommendations is also uploaded into your repo.

![sarif file](https://dev-to-uploads.s3.amazonaws.com/i/tzke29nsrnkagdjlsqno.png)

You can use [Jonas Rapp](https://twitter.com/rappen)'s [Power Apps Checker Tool] (https://powerappschecker.com/) tool to read the whole file.

![sarif file](https://dev-to-uploads.s3.amazonaws.com/i/usavzymofwev0g56m46l.png)

### Sample Workflow

Here is a sample Workflow on how you can use the Power Apps Solution Checker Action in your workflow.

```yaml
name: powerapps-solution-checker-sample
on:
  workflow_dispatch:
    inputs:
      solutionName:
        description: "Solution Name"
        required: true
        default: 'Solution Name'
      sourceEnvironmentUrl:
        description: "Source Environment URL"
        required: true
        default: 'https://xxxx.crm.dynamics.com'       
      ruleSet:
        description: "Rule Set"
        required: true
        default: 'Solution Checker' 
      geography:
        description: "Geography"
        required: true
        default: 'Australia'                           
      saveResults:
        description: "Save results of Power Apps Solution Checker"
        required: false
        default: "true"                              

jobs:
  build:
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v2
                                
      - name: Power Apps Checker
        id: powerapps-checker
        uses: rajyraman/powerapps-checker@v1.2
        with: 
          token: ${{ secrets.GITHUB_TOKEN }}
          solutionName: ${{ github.event.inputs.solutionName }}
          sourceEnvironmentUrl: ${{ github.event.inputs.sourceEnvironmentUrl }}
          applicationId: ${{ secrets.APPLICATION_ID }}
          applicationSecret: ${{ secrets.APPLICATION_SECRET }}
          tenantId: ${{ secrets.TENANT_ID }}
          geography: ${{ github.event.inputs.geography }}
          saveResults: ${{ github.event.inputs.saveResults }}
          
      # Ideally, you would have a deploy step here, which should be blocked until issues identified by the Power Apps Solution checker have been resolved         
      - run: echo "Solution Checker identified issues. DON'T deploy."
        if: steps.powerapps-checker.outputs.issueNumber != ''
        
      - run: echo "AOK. Deploy."
        if: steps.powerapps-checker.outputs.issueNumber == ''        
```

### Submission Category: 

Wacky Wildcards


### Yaml File or Link to Code

{% github rajyraman/powerapps-solution-checker %}