Forum Discussion
Custom Best Practice Analyzer (BPA)
I am seeking assistance with creating a custom Best Practice Analyzer (BPA) to ensure that my environment adheres to specific best practices that are not covered by the built-in BPA rules.
Currently, I am in the process of developing a custom BPA with my own set of rules using Sempy_Labs. However, I am facing challenges when attempting to pass my custom rules into the analyzer.
Has anyone here worked on creating custom BPA code or have examples of scripts that you could share? I would greatly appreciate guidance on the best approach for building a custom analyzer, as well as any resources or advice on how to implement and pass my custom rules successfully.
Thank you in advance for any help or insights you can provide!
Hello falguni
try this approach
Start by outlining the specific best practices you want to enforce. These could include optimizing DAX expressions, ensuring proper data types, or maintaining naming conventions.
Use JSON for Rule Definition: BPA rules are defined in JSON format.Use`sempy_labs.create_model_bpa_semantic_model()` to generate a semantic model for analysis. This function links the BPA results with the `modelbparesults` delta table in your Fabric lh
import sempy_labs as sl
sl.create_model_bpa_semantic_model(
dataset="CustomBPA",
lakehouse="YourLakehouseName",
lakehouse_workspace="YourWorkspaceID"
)Use the `create_report_from_reportjson()` function from Sempy_Labs to load custom rules into your BPA
sl.report.create_report_from_reportjson(
report="CustomBPAReport",
dataset="CustomBPA",
report_json="path/to/your/rules.json"
)https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html
please accept the answer and give kudos if this is helpfulHi falguni
Thank you for reaching out to the Microsoft Fabric community. We understand your need for a custom Best Practice Analyzer (BPA) to enforce specific best practices.- When implementing a custom BPA, challenges may include defining custom rules, ensuring they are correctly structured and applied, and retrieving relevant datasets for validation. Custom BPA rules should include Rule ID, Name & Description, Condition, and Severity Level.
- Once the rules are defined, the BPA Analyzer will load them, retrieve datasets/reports from Microsoft Fabric, apply rule conditions to check compliance, and generate a summary report.
- To ensure successful execution, verify that rules are in the correct format, data source connectivity is established, and the analyzer execution is properly triggered.Once the BPA runs, results should be logged and reported for analysis.
Please refer to the following Microsoft documentation for further details:
Run Best Practices Analyzer Scans and Manage Scan Results_1 | Microsoft Learn
If my response has resolved your query, please mark it as the Accepted Solution to help others. Additionally, I would appreciate a 'Kudos' if you found my response helpful.
A special thanks to nilendraFabric for you prompt response.Thank you!
5 Replies
- nilendraFabric
Super User
Hello falguni
try this approach
Start by outlining the specific best practices you want to enforce. These could include optimizing DAX expressions, ensuring proper data types, or maintaining naming conventions.
Use JSON for Rule Definition: BPA rules are defined in JSON format.Use`sempy_labs.create_model_bpa_semantic_model()` to generate a semantic model for analysis. This function links the BPA results with the `modelbparesults` delta table in your Fabric lh
import sempy_labs as sl
sl.create_model_bpa_semantic_model(
dataset="CustomBPA",
lakehouse="YourLakehouseName",
lakehouse_workspace="YourWorkspaceID"
)Use the `create_report_from_reportjson()` function from Sempy_Labs to load custom rules into your BPA
sl.report.create_report_from_reportjson(
report="CustomBPAReport",
dataset="CustomBPA",
report_json="path/to/your/rules.json"
)https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html
please accept the answer and give kudos if this is helpful - v-karpurapud
Community Support
Hi falguni
Thank you for reaching out to the Microsoft Fabric community. We understand your need for a custom Best Practice Analyzer (BPA) to enforce specific best practices.- When implementing a custom BPA, challenges may include defining custom rules, ensuring they are correctly structured and applied, and retrieving relevant datasets for validation. Custom BPA rules should include Rule ID, Name & Description, Condition, and Severity Level.
- Once the rules are defined, the BPA Analyzer will load them, retrieve datasets/reports from Microsoft Fabric, apply rule conditions to check compliance, and generate a summary report.
- To ensure successful execution, verify that rules are in the correct format, data source connectivity is established, and the analyzer execution is properly triggered.Once the BPA runs, results should be logged and reported for analysis.
Please refer to the following Microsoft documentation for further details:
Run Best Practices Analyzer Scans and Manage Scan Results_1 | Microsoft Learn
If my response has resolved your query, please mark it as the Accepted Solution to help others. Additionally, I would appreciate a 'Kudos' if you found my response helpful.
A special thanks to nilendraFabric for you prompt response.Thank you!
- v-karpurapud
Community Support
Hi falguni
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- v-karpurapud
Community Support
Hello falguni
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you!
- v-karpurapud
Community Support
Hello falguni
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.