Author Michael Megel discusses the art of building microservices for Microsoft Power Platform instead of using a monolithic system. He indicates this approach is ideal because of the flexibility it provides for various applications and flows. Instead of solving every problem with one technology, you could build a microservice for Power Platform (more info here).
This is especially beneficial if your PowerApps or Power Automated Flows need more power in terms of speed or functionality for certain data processing. It involves building a microservice as an API for the Power platform, which not only provides more scalability, flexibility, and efficiency, but also increases the maintainability of the system.
Michael provides a detailed walkthrough of how he built such a microservice. He begins by wanting to render a dependency diagram in his canvas app based on his input. He guides us through the experience of creating an API in Python, containerizing the service in a Docker container, and hosting this container as an API in Azure. He then shows how to use a Power Automate flow to access the microservice in his canvas app.
Graphviz is a powerful open-source graph visualization software, which is used by Michael in his PowerApps Helper extension for creating diagrams of abstract graphs and networks. The software must be downloaded and installed before using its rendering engine through any libraries.
To render graphs in various formats such as PNG, SVG, and PDF, Michael uses Graphviz's Python integration along with installing few libraries - "graphviz" and "pydot". He then provides the Python code used for rendering a simple graph and exporting it as a PNG image.
Michael goes on to introduce Python Flask, a popular micro web framework that allows building web applications using Python. It allows wrapping the Graphviz engine and its functionality into a small API, which can display graph remotely in microservice and returning the created diagram to the consumer in Power Platform. The API was containerized using Docker and tested successfully.
For hosting the web service efficiently, an Azure Web App based on Docker container was used. The service is tested from VS Code using RESTClient, demonstrating that it returns graph images successfully. Now running on Azure, the microservice is ready to be called with the right parameters. A Power Automate Flow is used for this job, which is then used in building a canvas app for user interface.
The post thoroughly covers different aspects of creating microservices for Power Platform, from initial Python coding and using Flask framework to hosting on Azure. For those interested in detailed code instructions and examples, the author's Github repository can be found here.
Deep Dive:Building microservices, especially for platforms such as Power Platform, allows for increased flexibility, scalability, and significantly improved maintainability of the overall system. It gives the option to solve technology problems specifically instead of universally applying a solution, thus enhancing efficiency. These microservices can be conveniently built via Python and Flask, with hosting possibilities on platforms like Azure, making it a modern solution to classic monolithic systems.
Read the full article Build a Microservice for Power Platform
Understanding microsoft's Power Platform and how it relates to microservices significantly impacts your apps and automated flows. It particularly makes a difference when these require an additional boost in speed or functionality for data processing. It's clear that not every problem requires the same solution, hence the need to sometimes develop a microservice tailored to your needs. A microservice, in this case, is seen to provide increased scalability, efficiency, flexibility, and maintenance potential to the overall system.
To accomplish the process of creating a microservice for the Power Platform, we utilize Graphviz. It is a robust open-source graph visualization software used to produce diagrams of abstract graphs and networks. However, before using it, one must download and install the software. It easily integrates with Python which makes the creation and rendering of graphs a breeze. It can then output in various formats: PNG, SVG, PDF, or launch it in an interactive graph browser.
Python Flask comes in handy when creating a microservice. It is a widely-used micro web development framework that allows the use of Python in building web applications. It is lightweight and easy to begin with, and can be adjusted to your requirements. Its features include handling HTTP responses and requests, routing, template rendering, among others. Python Flask needs its library which can be accessed using pip install technique.
Now, to run your API with Graphviz, you will require a suitable Docker image. For this example, we started with a lightweight image, "python:3.8-alpine", from which we installed Graphviz. Then installed the Python dependencies from "requirements.txt". Lastly, we added the Python Flask with all the installed software to the container image. As a result, you had ease deploying and running the microservice on different machines without the worry of compatibility issues.
Then, Azure Web App is employed to host the web service using simple settings. Upon successful deployment, this service can be tested with an HTTP request from anywhere.
Accessing the microservice is simply done by calling it with the correct parameters using Power automate flow. Finally, Dataverse and canvas app are used for the tasks of solution creation and the graphical user interface, respectively. This API is then consumed by the Canvas app to execute and return the desired output. The Canvas app UI can be as simple as a button, a text input, and an image. The whole rendering process is encapsulated by an event connected to the button, which triggers the Power Automate Flow with the input data. The result is stored in variable storage and displayed on the user interface.
In conclusion, creating a microservice is a complex but rewarding process. The series of processes involved include developing diagrams in Python using Graphviz, creating a micro web application with Python Flask, and constructing a microservice with docker. All these pronouncedly streamline the functions of the Power Platform and enhance its performance. You can find all the code examples and further instructions in the provided Github repository: https://github.com/megel/mme2k-graphviz.
Training resources that may enhance your understanding and practical skills on this subject matter include Microsoft's official courses on Power Platform, practical Python coding courses, and Docker's own resource hub. Moreover, Graphviz's official website provides in-depth documentation on using the software, and Flask's website has interactive tutorials for beginners.
By investing an appropriate amount of time in these resources, professionals can familiarize themselves with these applications and enhance their ability to tailor the Power Platform to their needs optimally. This piece of writing has demonstrated that Power Platform, Graphviz, Python Flask, and Docker are prerequisite tools and resources for building a microservice. Having an understanding of Docker's containerisation approach is also a key factor in grasping this implementation.
Microservice Power Platform, Build Microservice, Power Platform Service, Microservice Development, Microsoft Power Platform, Power Platform Programming, Microservice Power Architecture, Power Platform Integration, Custom Microservice Build, Power Platform Microservice.