Forum Discussion
Why does PSRule produce more findings than Template Analyzer when both use PSRule Azure rules?
Short version: yes, the difference is expected. The two tools look like they're running the same rules because the rule IDs match, but they aren't running the same engine.
Template Analyzer doesn't run the PSRule engine. Its rules are a set of JSON rules shipped in its built-in rules file, and they use the same rule names as PSRule's rules, which is why you see AZR-000166 and the rest in both outputs. There is no PSRule.Rules.Azure version bundled inside Template Analyzer to keep in step with 1.32.1, so your second question doesn't quite apply the way you'd expect.
That also answers the count difference. Template Analyzer's built-in rule set is a subset of what PSRule ships, focused on template structure, so the resource-level security checks like the MySQL Entra-only authentication and the storage secure-transfer findings only appear on the PSRule side. The include-non-security-rules switch only turns on the non-security rules inside Template Analyzer's own set; it doesn't pull in the rest of PSRule's rules.
The other thing to check is parameters. Template Analyzer evaluates the ARM JSON your Bicep compiles to, and if you don't pass a parameters file with the -p option it invents placeholder values, which its own documentation says makes results less accurate. A lot of the security checks depend on parameter values, so they can be skipped or judged against a made-up value. Standalone PSRule expands Bicep itself, modules included, and reads parameter files, so it sees the real values. On an AVM-heavy repo that difference alone can account for several findings.
So for your last question: yes, for a Bicep and AVM repo I'd treat standalone PSRule for Azure as the scanner of record, and Template Analyzer as the lighter pre-deployment gate. If you want to narrow the gap before settling on that, pass Template Analyzer the real parameter values with -p and run it with --include-non-security-rules, then compare again on the same compiled template. The two will never match exactly though, because they're different engines with different rule sets.