Cloud Flows and Desktop Flows

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 10 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Mastering Automation: Cloud Flows and Desktop Flows in Power Automate

In the modern digital workplace, efficiency is often stifled by repetitive, manual tasks. Whether it is moving data between two web-based applications or extracting information from a legacy desktop program that lacks an API, these mundane processes consume valuable human time. Power Automate provides a comprehensive platform to bridge these gaps through two primary components: Cloud Flows and Desktop Flows. Understanding the distinction between these two, and more importantly, how to integrate them, is the foundation for building meaningful automation solutions that save time and reduce error rates.

This lesson explores the mechanics of Cloud Flows and Desktop Flows, their specific use cases, and the architectural patterns required to orchestrate them effectively. By the end of this module, you will be able to distinguish when to use an API-based approach versus a user-interface simulation, and how to build resilient workflows that handle the complexities of both modern and legacy environments.


Not read yet

Understanding Cloud Flows: The Orchestrators of Modern APIs

Cloud Flows are the backbone of Power Automate. They operate entirely in the cloud, utilizing connectors to interact with web services, databases, and SaaS platforms like Office 365, Salesforce, or Twitter. Because they rely on APIs (Application Programming Interfaces), Cloud Flows are generally faster, more reliable, and easier to maintain than processes that interact with screens.

When you trigger a Cloud Flow, you are essentially telling the platform to listen for an event—such as a new email arriving, a file being uploaded to SharePoint, or a button press in a Power App—and then execute a series of actions based on that event.

Key Characteristics of Cloud Flows

  • Trigger-Based Execution: They can be automated (running on an event), scheduled (running at a specific time), or instant (running when a user triggers them).
  • Connector-Centric: They rely on pre-built connectors that handle the authentication and data exchange protocols for hundreds of popular services.
  • Scalability: Because they run on Microsoft’s managed infrastructure, they can scale to handle thousands of requests without requiring local hardware maintenance.

Callout: The API vs. UI Approach The fundamental difference between Cloud Flows and Desktop Flows lies in the "how." Cloud Flows use APIs to talk directly to the backend of an application, meaning they don't care how the application looks; they only care about the data. Desktop Flows use UI automation, meaning they "see" the screen just like a human does, clicking buttons and typing into fields. Always prefer the API approach (Cloud Flow) whenever an API is available, as it is significantly less prone to breaking when a visual layout changes.

Practical Example: Automated Email Processing

Imagine a scenario where a customer support team receives dozens of emails daily with attached invoices. You can create a Cloud Flow that triggers whenever a new email arrives in a specific Outlook folder. The flow then parses the email, extracts the attachment, saves it to a SharePoint document library, and sends a notification to a Microsoft Teams channel. This process requires zero interaction with a desktop interface, making it an ideal candidate for a Cloud Flow.


Not read yet

Understanding Desktop Flows: Bridging the Legacy Gap

While Cloud Flows are powerful, they are limited to applications that expose their functionality via APIs. Many organizations still rely on legacy desktop applications, mainframes, or web portals that do not offer modern integration capabilities. This is where Desktop Flows—often referred to as Robotic Process Automation (RPA)—come into play.

Desktop Flows allow you to record and automate mouse clicks, keyboard inputs, and data entry within local applications. They interact with the operating system directly, allowing you to bridge the gap between modern cloud services and aging software that would otherwise require manual data entry.

The Role of Power Automate for Desktop (PAD)

To create Desktop Flows, you use the Power Automate for Desktop application. This tool provides a visual designer where you can drag and drop actions such as "Press button," "Populate text field," or "Extract table from window."

When to Choose Desktop Flows

  • Legacy Systems: When the software is installed locally and has no web API.
  • Data Migration: When moving large amounts of data from a desktop spreadsheet or legacy database into a new web interface.
  • Complex Interactions: When a process requires interacting with multiple desktop windows, dialog boxes, or OS-level file management tasks.

Note: Desktop Flows require a "gateway" or a local machine to execute. Unlike Cloud Flows, which exist entirely in the cloud, a Desktop Flow needs a physical or virtual machine to be running so it can simulate the user's presence.


Not read yet

The Hybrid Architecture: Combining Cloud and Desktop Flows

The most sophisticated automation patterns involve a hybrid approach. In this model, a Cloud Flow acts as the "manager" or "orchestrator," while the Desktop Flow acts as the "worker" or "performer."

Step-by-Step: Building a Hybrid Flow

  1. The Trigger (Cloud Flow): You set up a Cloud Flow that monitors a trigger, such as a new row in a Dataverse table or a specific time of day.
  2. The Call (Cloud Flow to Desktop): Inside the Cloud Flow, you add the "Run a flow built with Power Automate for Desktop" action. This sends data from the cloud to the local machine.
  3. The Execution (Desktop Flow): The Desktop Flow receives the input variables, launches the legacy application, performs the required clicks and typing, and then closes the application.
  4. The Feedback (Desktop Flow to Cloud): The Desktop Flow returns an output (such as a status code or a success message) back to the Cloud Flow, which then sends an email or updates a record to confirm completion.

Example Code Snippet: Passing Data to a Desktop Flow

When you define a Desktop Flow, you can set input and output variables. Here is a conceptual representation of how you define inputs in the Desktop Flow designer:

# Input Variables
- InvoiceNumber (String)
- CustomerName (String)

# Steps
1. Launch Excel -> Open file "Invoices.xlsx"
2. Populate text field (in Excel) -> InvoiceNumber
3. Populate text field (in Excel) -> CustomerName
4. Click button -> "Submit"
5. Set variable "Status" -> "Success"

In the Cloud Flow, you would map these variables:

  • InvoiceNumber = triggerBody()?['InvoiceNumber']
  • CustomerName = triggerBody()?['CustomerName']

Not read yet

Best Practices for Building Reliable Automations

Automation is only as good as its stability. If a flow breaks every time an application updates, it creates more work than it saves. Here are the industry standards for maintaining robust flows.

1. Error Handling and Resiliency

Never assume that a process will run perfectly every time. Applications crash, internet connections drop, and data formats change.

  • Use Try-Catch logic: In both Cloud and Desktop flows, implement "Run After" settings. If a step fails, trigger a notification email or a logging step.
  • Timeouts: Always configure reasonable timeouts for desktop operations. If the application takes 10 seconds to load, set your wait time to 15 seconds, not 2.

2. Modularization

Do not build a single, massive flow that does everything. Instead, break your logic into smaller, reusable sub-flows. This makes troubleshooting significantly easier, as you can test each component in isolation.

3. Use Selectors Wisely (Desktop Flows)

Desktop Flows rely on "Selectors" to identify UI elements (like buttons or fields). By default, these can be brittle. If a button's position changes by a few pixels, a coordinate-based automation will fail.

  • Tip: Always use CSS selectors or UI element paths that are based on unique IDs or labels rather than static coordinates. This ensures that even if you resize the window, the flow will still find the "Submit" button.

4. Secure Credential Management

Never hardcode passwords or sensitive API keys directly into your flow logic. Use the "Azure Key Vault" or the built-in "Connection References" in Power Automate to handle authentication securely.

Warning: Avoid using "Send Keys" actions in Desktop Flows whenever possible. Sending keystrokes is a "blind" operation; if the focus shifts to another window, the flow will start typing into the wrong place. Always prefer "Populate text field" actions, which target the element directly regardless of whether it is in the foreground.


Not read yet

Comparison: Cloud Flows vs. Desktop Flows

Feature Cloud Flows Desktop Flows
Execution Location Microsoft Cloud Local Machine or Server
Primary Interaction APIs and Webhooks UI/UX Simulation (Mouse/Keyboard)
Maintenance Low (API-based) Moderate (UI-based)
Concurrency High (Handles many items) Low (Usually one process per machine)
Best For Data movement, SaaS integration Legacy apps, complex UI workflows

Common Pitfalls and How to Avoid Them

Pitfall 1: Over-automating Fragile Processes

A common mistake is trying to automate a process that is poorly defined or constantly changing. If the business process itself is unstable, the automation will be unstable. Before you build a flow, document the process and ensure it is standardized.

Pitfall 2: Ignoring Data Security

When you move data between a cloud service and a desktop machine, you are creating a data bridge. Ensure that the machine running the Desktop Flow has the appropriate security permissions and that you are not exposing sensitive data in logs.

Pitfall 3: Failing to Monitor

Automation is not a "set it and forget it" task. You must review the "Run History" in the Power Automate portal regularly. Look for trends in failures—if a flow fails every Monday morning, it might be due to a system backup running at the same time.

Pitfall 4: Hardcoding File Paths

When building Desktop Flows, avoid hardcoding paths like C:\Users\JohnDoe\Desktop\File.xlsx. If the flow is moved to a server or another user's machine, it will break immediately. Use relative paths or environment variables that can be updated centrally.


Not read yet

Implementation Steps: A Mini-Project

To solidify your understanding, follow these steps to build a basic automation that reads an email and enters data into a local application.

Step 1: Create the Cloud Flow

  1. Navigate to the Power Automate portal.
  2. Select "Create" -> "Automated cloud flow."
  3. Choose the trigger: "When a new email arrives (V3)."
  4. Add an action: "Initialize variable" to store the email subject.
  5. Add the "Run a flow built with Power Automate for Desktop" action.

Step 2: Create the Desktop Flow

  1. Open the Power Automate for Desktop application.
  2. Create a new flow named "DataEntryProcess."
  3. Add an "Input" variable called EmailSubject.
  4. Add the action "Launch application" and point it to your target software.
  5. Add the action "Populate text field" and map it to your input variable.
  6. Save and close.

Step 3: Connect and Test

  1. Go back to your Cloud Flow.
  2. Select the Desktop Flow you just created in the "Run" action.
  3. Map the email subject variable from Step 1 into the EmailSubject input field of the Desktop Flow.
  4. Save and trigger a test email to yourself.
  5. Watch as your local machine automatically opens the application and enters the data.

Not read yet

Deep Dive: Advanced Techniques for Desktop Flows

As you move beyond basic automation, you will encounter scenarios where standard actions are insufficient. Here are two advanced techniques to increase the capability of your Desktop Flows.

Using JavaScript/VBScript in Desktop Flows

Sometimes, you need to manipulate a web page that doesn't have a connector. You can use the "Run JavaScript function on web page" action to execute custom code directly in the browser console. This allows you to bypass complex UI interactions and manipulate the DOM (Document Object Model) directly.

// Example: Extracting text from a specific div
function extractData() {
    var element = document.querySelector('.invoice-total');
    return element.innerText;
}

Working with Excel Automation

Many Desktop Flows involve Excel. Power Automate for Desktop includes a robust "Excel" group of actions. Rather than simulating mouse clicks to copy-paste, always use the "Read from Excel worksheet" action. This pulls the data into a variable (an array of rows), allowing you to process the data in memory before writing it to another system. This is significantly faster and more accurate than screen-scraping a spreadsheet.


Not read yet

Troubleshooting Common Issues

"The element was not found on the page"

This is the most common error in Desktop Flows. It usually happens because the application takes longer to load than the flow expects.

  • The Fix: Use the "Wait for window" action before attempting to click any elements. This ensures the application is fully loaded and ready to accept input.

"Authentication Failed"

If your Cloud Flow cannot talk to your Desktop Flow, check your "Machine" or "Machine Group" settings. Ensure the Power Automate Desktop agent is running on the local machine and that it is registered to the same environment as your Cloud Flow.

"High CPU Usage"

If you have multiple Desktop Flows running on one machine, it can lead to performance degradation.

  • The Fix: Use "Machine Groups" to distribute the load across multiple machines. You can set up a cluster of machines, and Power Automate will automatically assign the task to the next available machine in the group.

Not read yet

Summary and Key Takeaways

Power Automate is a transformative toolset that allows you to automate both modern cloud services and legacy desktop environments. By mastering the synergy between Cloud Flows and Desktop Flows, you can build end-to-end automations that replace tedious manual labor.

Key Takeaways:

  • Cloud Flows are for APIs: Always prioritize Cloud Flows for web-based services, as they are the most stable and efficient way to move data.
  • Desktop Flows are for the "Last Mile": Use Desktop Flows only when an API is unavailable, treating them as a bridge to legacy or local software.
  • The Hybrid Pattern is Powerful: Orchestrate your processes by using a Cloud Flow to handle logic and scheduling, while using a Desktop Flow to handle the physical interaction with software.
  • Prioritize Stability over Speed: Focus on robust selectors and proper error handling (Try-Catch) to ensure your automations do not break when software updates occur.
  • Security is Non-Negotiable: Never store passwords in plain text; utilize secure credential managers and environment-specific configurations to keep your systems safe.
  • Modularize Your Logic: Build smaller, reusable flows rather than one massive, monolithic script. This makes your automation suite easier to debug and scale.
  • Monitoring is Continuous: Automation requires ongoing maintenance. Regularly review your run history and failure logs to proactively address issues before they impact business operations.

By applying these principles, you move from simply "recording tasks" to "engineering automation solutions." Start small, focus on the most time-consuming processes first, and remember that the best automation is one that you don't have to fix every Monday morning. As you gain confidence, you can begin to chain these flows together into complex, multi-stage workflows that handle your most critical business processes with precision and consistency.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.