
Question 1: What are the benefits of using Azure Application Insights with Canvas Apps?
Answer – Azure Application Insights, a powerful monitoring tool from Microsoft, is designed to track application performance and identify failures. Commonly used in professional development settings, it offers real-time insights to enhance application reliability and improve user experience. Unlike Power Apps licensing, which is based on user access, Azure Application Insights follows a pay-as-you-go model, charging based on usage metrics. This makes it highly scalable and adaptable to diverse use cases. It can integrate with nearly all Power Platform products, including Dataverse, by embedding simple JavaScript code or establishing a connection. For Canvas Apps, integration is as straightforward as adding an instrumentation key to the App object for live monitoring.
Application Insights can out of the box track the following:
👉 performance monitoring: failed requests, response times
👉 user flow analytics: aggregated chart for user interactions, what screens a user visited, how much time was spent on a given screen
👉 user session data: session identifier, IP address, browser, or operating system
👉 unhandled errors: all unhandled errors are traced automatically in the standard app error reporting routine with data like in the AllErrors table
To fully leverage the capabilities of Application Insights, it’s advisable to plan tracking strategies ahead of time. Although the tool offers useful built-in telemetry, developers can gain deeper insights by incorporating custom tracking. By strategically using the Trace function in critical app components such as combo boxes, text inputs, or buttons, you can create detailed, event-specific logs that align with the app’s unique requirements.
A standout feature of Azure Monitor, and by extension Application Insights, is Azure Alert. This allows you to define real-time, custom alerts based on event monitoring, significantly enhancing response times in the event of a failure.
Question 2: What is the use of PCF in Power Platform? How PCF differ from Web Resources?
Answer – The Power Apps Component Framework (PCF) offers a robust toolkit for professional developers to build custom, reusable, and seamlessly integrated extensions. Unlike Web Resources, PCF components are rendered directly within the same pipeline as standard Power Apps components, allowing for richer API integration and a more native user experience. In contrast, Web Resources are layered on top of the Power Apps engine and are primarily used for implementing custom business logic or event handlers.
Below are the components required for PCF:
To build your own PCF components you need:
👉 Code editor like Visual Studio Code
👉 node.js for installing all JavaScript dependencies
👉 Microsoft Power Platform CLI (command line interface) for initialization of all components and creation of PCF solution
👉 .NET Build tools or .Net SDK for building the solution
PCFs can be effortlessly deployed to model-driven apps or Power Pages without requiring additional setup. However, for Canvas apps, there is a potential prerequisite: administrators must enable PCFs in the environment settings through the Admin Center. The steps are: Admin Center -> Manage -> Environments -> Your Environment -> Settings -> Product -> Features -> Power Apps Component Framework for Canvas Apps. This restriction is in place because the Canvas Apps Studio engine exposes personal user tokens, which could be vulnerable to misuse by malicious PCF authors.
Question 3: How to trace user interactions and errors in Power Apps?
Answer – Tracing user interactions and errors in Power Apps involves leveraging built-in tools, custom logging, and external services like Azure Application Insights. Here’s how you can effectively track both:
Using Power Apps Monitor
- Purpose: Built-in debugging tool for Power Apps.
- Steps:
- Open your app in Power Apps Studio.
- Navigate to Monitor from the settings menu.
- Run the app to capture real-time events, such as user interactions, API calls, and errors.
- Review the logs for errors or performance bottlenecks.
- Best For: Debugging during development and testing.
Leveraging Error Handling
- Use the OnError property of controls or the IfError() function to capture and handle errors.
- Log errors to a SharePoint list, Dataverse table, or an external system for analysis.
- Example
IfError(
SubmitForm(Form1),
Notify("An error occurred: " & ErrorInfo.Message, NotificationType.Error)
)
Custom Tracing with Azure Application Insights
- Integrate Application Insights for advanced monitoring and logging.
- For Canvas Apps:
- Add the Instrumentation Key from Application Insights to the App object.
- Use the
Trace()
function to log custom events, errors, or user interactions.
- For Model-Driven Apps:
- Embed JavaScript to capture and log interactions or errors.
Trace(
"User clicked the Submit button",
TraceSeverity.Information,
{ UserID: User().Email, Timestamp: Now() }
)
Using Power Automate for Logging
- Create a flow triggered by actions in the app (e.g., button clicks).
- Record the actions or errors to a central location like a SharePoint list or Dataverse.
Enable Analytics in Power Platform Admin Center
- For apps using Dataverse, enable analytics in the Power Platform Admin Center to view detailed telemetry.
- Navigate to Admin Center > Analytics > Power Apps to analyze user activity and errors.
Log User Activity to a Data Source
- Log interactions such as button clicks, form submissions, or navigation to a SharePoint list, Dataverse table, or Azure SQL Database.
- Example – Add the following in the OnSelect property of a button:
Patch(
InteractionLog,
Defaults(InteractionLog),
{ UserID: User().Email, Action: "Button Click", Timestamp: Now() }
)
Question 4: What is the use of App.OnError?
Answer – The App.OnError property in Power Apps is used to define a global error-handling mechanism for your app. It allows you to specify actions to take when unhandled errors occur during app execution, providing a centralized way to manage errors across your app.
Key Uses of App.OnError
- Global Error Logging:
- Capture and log errors for debugging purposes.
- Save error details (e.g., error message, time, user) to a database, SharePoint list, or monitoring tool.
- Error Notification:
- Display user-friendly messages to inform users about the error.
- Example: “An unexpected error occurred. Please try again later.”
- Custom Recovery Logic:
- Define steps to recover from specific errors.
- Example: Retry an operation, reset variables, or redirect the user to another screen.
- Consistent Error Handling:
- Provide a uniform approach to error handling across all screens and controls.
How App.OnError Works
- Triggering the Event:
- The App.OnError property is triggered when an error occurs that is not handled by a specific control or operation.
- Error Context Variables: When an error occurs, the following variables are automatically available within App.OnError:
Error
: Contains the error message.ErrorKind
: Identifies the type of error (e.g.,ErrorKind.Validation
,ErrorKind.Network
).LastSubmit
: Contains the record that was last submitted if the error occurred during a submission.
Scenarios Where App.OnError is Useful
- Handling unexpected data validation errors.
- Logging failed API calls or data submissions.
- Providing a fallback mechanism for unhandled exceptions.
- Displaying helpful messages during network outages.
Code Example for App.OnError
Switch(
ErrorKind,
// Handle validation errors
ErrorKind.Validation,
Notify("Validation Error: " & Error, NotificationType.Error);
Set(
GlobalErrorLog,
"Validation Error: " & Error
),
// Handle network errors
ErrorKind.Network,
Notify("Network Error: Please check your internet connection.", NotificationType.Error);
Set(
GlobalErrorLog,
"Network Error: " & Error
),
// Handle other errors
Notify("An unexpected error occurred. Please contact support.", NotificationType.Error);
Set(
GlobalErrorLog,
"Unexpected Error: " & Error
)
);
// (Optional) - Log the error to a SharePoint list for tracking
Patch(
'ErrorLogs',
Defaults('ErrorLogs'),
{
Title: "Error Log",
ErrorMessage: GlobalErrorLog,
ErrorType: Text(ErrorKind),
UserEmail: User().Email,
ErrorTime: Now()
}
);
Question 5: What is the use of “hidenavbar=true” in Canvas App?
Answer – A Canvas App can be loaded without the default Microsoft top navigation bar by adding a specific URL parameter. Simply include “hidenavbar=true” in the app’s direct link.
👉 We can use the ? operator to add it at the end of the URL.
Question 6: What are the different ways to handle errors in Canvas Apps?
Answer – There are many ways to handle errors in Canvas App.
1. Using IfError Function
- Purpose: Handles specific errors for an expression or operation.
- Usage: Wrap potentially error-prone operations in
IfError
to define fallback logic.
IfError(
Patch(MyDataSource, Defaults(MyDataSource), {Name: "John Doe"}),
Notify("Error occurred while saving data: " & Error, NotificationType.Error),
Notify("Data saved successfully!", NotificationType.Success)
)
2. Using App.OnError Property
- Purpose: Provides a global mechanism for handling unhandled errors in the app.
- Usage: Define error-handling logic for all unexpected errors.
If(
ErrorKind = ErrorKind.Validation,
Notify("Validation Error: " & Error, NotificationType.Error),
Notify("An unexpected error occurred: " & Error, NotificationType.Error)
);
3. Error Handling in Form Controls
- Purpose: Leverage the built-in validation of form controls to display errors.
- Usage: Validate user inputs and display error messages for incorrect data.
If(
FormControl.Valid,
SubmitForm(FormControl),
Notify("Please fill in all required fields correctly.", NotificationType.Error)
)
4. Using Try…Catch Equivalent (IfError) with Conditional Logic
- Purpose: Simulate
Try...Catch
behavior using conditional checks and error-handling functions. - Usage: Combine
IfError
orErrors
with conditional logic.
IfError(
SubmitForm(MyForm),
Notify("Failed to submit the form. Please try again.", NotificationType.Error)
)
5. Preventive Error Handling with Validations
- Purpose: Minimize runtime errors by validating data and inputs before performing operations.
- Usage: Add conditions to check data integrity before executing functions.
If(
IsBlank(TextInput1.Text),
Notify("Name cannot be blank!", NotificationType.Error),
Patch(MyDataSource, Defaults(MyDataSource), {Name: TextInput1.Text})
)
Question 7: How to pass the context variable to the next screen?
Answer – In Canvas Apps, a context variable can be passed to the next screen using the Navigate function. 😊
E.g. – Navigate(ScreenName, Transition, {ContextVariableName: Value})
E.g. – Navigate(Screen2, ScreenTransition.Fade, {Var1: Value1, Var2: Value2})
Question 8: What are the alternatives of On-Premises Data Gateway for connecting Power Platform to locally hosted data sources / servers?
Answer – The On-Premises Data Gateway is the primary solution provided by Microsoft for connecting Power Platform (Power Apps, Power Automate, Power BI, etc.) to on-premises data sources. However, there are other alternative solutions available as mentioned below:
1. Direct API Integration
- Description: Build APIs hosted on your local servers to expose the required data and services.
- How It Works:
- Develop REST or SOAP APIs to securely expose data.
- Use Azure API Management to manage and secure these APIs.
- Power Platform can then connect to these APIs via a custom connector.
- Pros:
- No dependency on the On-Premises Data Gateway.
- Scalable and reusable across applications.
- Cons:
- Requires technical expertise to build and maintain APIs.
- May involve exposing internal data to the internet, requiring robust security measures.
2. Azure Virtual Network (VNet / VPN) Integration
- Description: Use Azure VNets to connect securely to on-premises systems through VPN Gateway or ExpressRoute.
- How It Works:
- Set up a VPN or ExpressRoute between your on-premises network and Azure.
- Host the necessary data or APIs on a virtual network in an Azure environment (e.g., Azure App Service, Azure SQL).
- Power Platform accesses the data through Azure-hosted services.
- Pros:
- Secure and high-performance connection.
- Scalable for enterprise solutions.
- Cons:
- Requires advanced network setup.
- Higher cost compared to other options.
- This approach requires Power Apps Premium as a Virtual Network must be set up for a Managed Power Platform environment.
Considerations When Choosing an Alternative:
- Data Sensitivity: Ensure secure handling of sensitive data.
- Real-Time Requirements: Some solutions are better for batch processing rather than real-time communication.
- Scalability: Evaluate the solution’s ability to handle growing data and user demands.
- Cost: Balance between upfront costs and long-term operational expenses.
- Ease of Maintenance: Choose solutions that are manageable within your team’s technical capabilities.
Question 9: Explain the PowerFx functions: Concurrent, Concatenate, Coalesce.
Answer –
1. Concurrent
Description:
The Concurrent function runs multiple operations simultaneously, helping improve performance by executing tasks in parallel instead of sequentially.
👉 Concurrent(Operation1, Operation2, …, OperationN)
Concurrent(
ClearCollect(Orders, OrdersTable),
ClearCollect(Customers, CustomersTable),
ClearCollect(Products, ProductsTable)
)
2. Concatenate
Description:
The Concatenate function combines multiple strings into a single string.
👉 Concatenate(String1, String2, …, StringN)
3. Coalesce
Description:
The Coalesce function returns the first non-blank value from its arguments. It’s often used to handle nulls or defaults.
👉 Coalesce(Value1, Value2, …, ValueN)
Question 10: What is the difference between IsBlank and IsEmpty?
Answer – The difference between IsBlank
and IsEmpty
lies in what they evaluate and how they handle different types of data.
1. IsBlank
- Purpose: Checks if a value is blank (null or undefined).
- Applicable To: Text, variables, controls, or any single value.
- Returns:
true
if the value isnull
or contains no value.false
if the value exists or is not null.
2. IsEmpty
- Purpose: Checks if a table (or collection) has no records (i.e., it’s empty).
- Applicable To: Tables, collections, or data sources.
- Returns:
true
if the table has no records.false
if the table contains one or more records.
Comparison
Feature | IsBlank | IsEmpty |
---|---|---|
Checks | Single value (e.g., text, variable). | Tables, collections, or datasets. |
Returns True | If the value is null or not provided. | If the table/collection has no rows. |
Use Case | Validate input fields or variables. | Validate collections or datasets. |
Applicable To | Text, controls, variables, etc. | Tables and collections. |
Question 11: Your team has been building Canvas Apps for multiple departments. You notice repeated UI elements like buttons and headers across apps. How would you ensure reusability and maintainability for these components?
Answer –
- Utilize the Component Library to create reusable components.
- Design components for common UI elements like headers, footers, or buttons.
- Use parameters to make components dynamic (e.g., passing text or style properties).
Question 12: What are the different ways to improve the performance and responsiveness of Power Apps.
Answer – The performance of Microsoft Power Apps can be improved in the following ways:
a) Limit the data connection to the same app. Connecting the same app to more than 30 sources can increase the time it takes to load the program.
b) Reduce the number of controls added to a single app. It creates an HTML document object model to render each control, and the more controls you include, the longer it takes to generate.
c) Using the Concurrent function to load data sources simultaneously can cut the time it takes for an app to load data in half.
d) Using the Set function to avoid continually retrieving data from the source can improve the performance if the data is likely to stay the same.
e) Delegating data processing to the data source can speed up the app’s performance, as retrieving the data from a local device can demand more processing power, memory, etc.
Question 13: As a Technical Architect, what are the different areas which you check during code review of an app. Is there any checklist which you follow?
Answer – Below is the checklist for reviewing Power Apps. This checklist covers multiple aspects, from design to performance, security, and best practices:
Area | Item | Status | Remarks |
---|---|---|---|
1. App Design | Naming Conventions: Screens, Controls, Variables, and Collections | ✅/❌ | Ensure meaningful names (e.g., btnSubmit , lblUsername , colUsers ). |
Screen Layout: Responsive design for mobile, tablet, and desktop | ✅/❌ | App should be responsive to different device sizes. | |
UI/UX: Intuitive user interface and good visual design | ✅/❌ | Consider user flow, UI consistency, and accessibility (contrast, labels). | |
2. Logic & Formulas | Simplified Formulas: Avoid deeply nested or complex formulas | ✅/❌ | Break large formulas into smaller reusable functions. |
Consistency: Consistent use of formulas and logic | ✅/❌ | Ensure a standardized approach across the app. | |
Error Handling: Use IfError , App.OnError for global error handling | ✅/❌ | Ensure that error handling is implemented where needed. | |
3. Variables & Collections | Context Variables: Scoped properly within screens | ✅/❌ | Avoid using global context variables unnecessarily. |
Global Variables: Properly initialized and used for shared data | ✅/❌ | Limit the use of global variables and set them in the OnStart event. | |
Collections: Minimize memory usage and clear unnecessary collections | ✅/❌ | Avoid storing large datasets unnecessarily in memory. | |
4. Data Sources & Performance | Delegation: Avoid delegation warnings with large data sets | ✅/❌ | Use delegable queries (filtering, sorting) with SharePoint/Dataverse. |
Efficient Data Retrieval: Load data dynamically (lazy loading) | ✅/❌ | Avoid loading all data at once. | |
Data Source Optimization: Use proper queries and filters | ✅/❌ | Ensure data is filtered at the source level (e.g., SharePoint, SQL). | |
Batch Operations: Use ForAll and batch processes for large updates | ✅/❌ | Ensure batch operations are used when handling large numbers of records. | |
5. Security | Role-Based Access Control (RBAC): Secure sensitive data appropriately | ✅/❌ | Ensure that data access is controlled via user roles and permissions. |
Sensitive Data Protection: Avoid hardcoding credentials in formulas | ✅/❌ | Use environment variables for sensitive credentials. | |
Data Masking/Encryption: Mask or encrypt sensitive data as needed | ✅/❌ | Sensitive user data must be protected. | |
6. Reusability & Maintainability | Component Usage: Reusable components for shared UI elements | ✅/❌ | Ensure the use of reusable components to maintain consistency. |
Component Library: Implemented for easy reuse of standard components | ✅/❌ | Components should be reusable across multiple apps. | |
Documentation: Proper comments for complex formulas and logic | ✅/❌ | Ensure that the code is well-documented for future maintainability. | |
7. Performance | App Initialization: Minimal logic in OnStart property | ✅/❌ | Avoid heavy processing during app startup. |
Optimized Image Sizes: Use compressed or dynamic images | ✅/❌ | Large images should be compressed, or dynamic loading should be used. | |
Data Refreshing: Use asynchronous techniques to refresh data | ✅/❌ | Avoid blocking the UI during data refresh. | |
8. Testing & Debugging | Test Cases: Defined test cases for critical user flows | ✅/❌ | Include test scenarios for all user interactions. |
Edge Cases: Handled edge cases and exceptions in logic | ✅/❌ | Verify how the app behaves in edge cases (e.g., no data, network failure). | |
Debugging Tools: Use Power Apps Monitor, tracing, or Azure Monitor | ✅/❌ | Monitor performance and log any issues using Power Apps’ debugging tools. | |
9. App Distribution | App Sharing: App shared with the correct users/groups | ✅/❌ | Ensure app permissions are set correctly. |
Environment Variables: Proper use for configuration and environment-specific settings | ✅/❌ | Environment variables should be used instead of hardcoding values. | |
10. App Updates & Version Control | Versioning: Use solutions and version control for app updates | ✅/❌ | Ensure app updates are tracked with version control. |
Patch Notes: Documentation of changes made in each version | ✅/❌ | Maintain patch notes for better visibility into updates. | |
11. Integration | Third-Party APIs: Integrated APIs used correctly and efficiently | ✅/❌ | Ensure that external API calls are made efficiently (e.g., throttling, retries). |
Power Automate Integration: Flow integrations tested and optimized | ✅/❌ | Ensure that Power Automate flows are optimized for performance and reliability. | |
12. Compliance & Accessibility | Compliance: Meets required regulations and standards (GDPR, etc.) | ✅/❌ | Ensure compliance with applicable laws, such as GDPR or HIPAA. |
Accessibility: Screen readers, keyboard navigation, and color contrast standards met | ✅/❌ | Ensure accessibility best practices are followed. |
Explanation of Key Areas
- App Design: Focuses on the UI/UX, naming conventions, and layout. A good design is key for both usability and maintainability.
- Logic & Formulas: Ensures that app logic is efficient, readable, and error-free. Overcomplicated formulas can lead to performance issues.
- Variables & Collections: Emphasizes the use of variables and collections for efficient data management. Unused or redundant variables should be cleared.
- Data Sources & Performance: Optimizes app performance by ensuring that data is efficiently fetched and managed, avoiding large in-memory datasets.
- Security: Covers security best practices, such as role-based access control and avoiding hardcoding sensitive data.
- Reusability & Maintainability: Ensures that components and logic are reusable and maintainable, reducing duplication of code and improving long-term maintainability.
- Performance: Focuses on optimizing the app for fast load times and smooth user experiences. Includes optimizing images, data retrieval, and initialization logic.
- Testing & Debugging: Ensures proper testing practices are followed and debugging tools are used to diagnose performance issues or bugs.
- App Distribution: Ensures that the app is shared correctly with the right users and that environment-specific settings are used.
- App Updates & Version Control: Ensures proper version control and tracking of changes, which is critical when maintaining multiple versions of the app.
- Integration: Ensures that any third-party integrations or Power Automate flows are optimized for performance and reliability.
- Compliance & Accessibility: Ensures that the app meets compliance standards and is accessible to all users, including those with disabilities.
Question 14: What is the use of IsMatch function in Power Apps?
Answer – The IsMatch function in Power Apps is used to validate whether a text string matches a specific pattern defined by a regular expression. It’s particularly useful for input validation in forms, ensuring that data entered by users adheres to specific formats such as email addresses, phone numbers, postal codes, or custom patterns.
Syntax: IsMatch(Text, Pattern [, MatchOptions])
Text: The text string you want to validate.
Pattern: A regular expression defining the pattern to match.
MatchOptions(optional): An option to specify how the matching is performed, such as case sensitivity or multiline matching.
Question 14: Explain the PowerFx functions: With, Sequence, AddColumns and ShowColumns.
Answer – Below is the explanation:
1. With function
The With function allows you to store a value in a variable-like scope for reuse in a formula, improving readability and performance.
Syntax: With( { Name1: Value1 [, Name2: Value2, …] }, Formula )
2. Sequence function
The Sequence function generates a table of numbers in a sequence.
Syntax: Sequence( Count [, Start [, Step ]] )
3. AddColumns function
The AddColumns function adds new columns to a table, calculating their values based on a formula.
Syntax: AddColumns( Table, ColumnName, Formula [, ColumnName2, Formula2, …] )
4. ShowColumns function
The ShowColumns function creates a new table with only the specified columns from an existing table.
Syntax: ShowColumns( Table, ColumnName1 [, ColumnName2, …] )