Connect to on-premises file systems from workflows in Azure Logic Apps

Applies to: Azure Logic Apps (Consumption + Standard)

This how-to guide shows how to access an on-premises file share from a workflow in Azure Logic Apps by using the File System connector. You can then create automated workflows that run when triggered by events in your file share or in other systems and run actions to manage your files. The connector provides the following capabilities:

  • Create, get, append, update, and delete files.
  • List files in folders or root folders.
  • Get file content and metadata.

In this how-to guide, the example scenarios demonstrate the following tasks:

  • Trigger a workflow when a file is created or added to a file share, and then send an email.
  • Trigger a workflow when copying a file from a Dropbox account to a file share, and then send an email.

Limitations and known issues

  • The File System connector currently supports only Windows file systems on Windows operating systems.
  • Mapped network drives aren't supported.

Connector technical reference

The File System connector has different versions, based on logic app type and host environment.

Logic app Environment Connector version
Consumption Multitenant Azure Logic Apps Managed connector, which appears in the connector gallery under Runtime > Shared. For more information, review the following documentation:

- File System managed connector reference
- Managed connectors in Azure Logic Apps
Standard Single-tenant Azure Logic Apps and App Service Environment v3 (Windows plans only) Managed connector, which appears in the connector gallery under Runtime > Shared, and built-in connector, which appears in the connector gallery under Runtime > In-App and is service provider-based. The built-in connector differs in the following ways:

- The built-in connector supports only Standard logic apps that run in an App Service Environment v3 with Windows plans only.

- The built-in version can connect directly to a file share and access Azure virtual networks by using a connection string without an on-premises data gateway.

For more information, review the following documentation:

- File System managed connector reference
- File System built-in connector reference
- Built-in connectors in Azure Logic Apps

Prerequisites

  • An Azure account and subscription. If you don't have an Azure subscription, sign up for a free Azure account.

  • To connect to your file share, different requirements apply, based on your logic app and the hosting environment:

    • Consumption logic app workflows

    • Standard logic app workflows

      You can use the File System built-in connector or managed connector.

      • To use the File System managed connector, follow the same requirements as a Consumption logic app workflow in multi-tenant Azure Logic Apps.

      • To use the File System built-in connector, your Standard logic app workflow must run in App Service Environment v3, but doesn't require the data gateway resource.

  • Access to the computer that has the file system you want to use. For example, if you install the data gateway on the same computer as your file system, you need the account credentials for that computer.

  • To follow the example scenario in this how-to guide, you need an email account from a provider that's supported by Azure Logic Apps, such as Office 365 Outlook, Outlook.com, or Gmail. For other providers, review other supported email connectors. This example uses the Office 365 Outlook connector with a work or school account. If you use another email account, the overall steps are the same, but your UI might slightly differ.

    Important

    If you want to use the Gmail connector, only G-Suite business accounts can use this connector without restriction in logic apps. If you have a Gmail consumer account, you can use this connector with only specific Google-approved services, or you can create a Google client app to use for authentication with your Gmail connector. For more information, see Data security and privacy policies for Google connectors in Azure Logic Apps.

  • For the example File System action scenario, you need a Dropbox account, which you can sign up for free.

  • The logic app workflow where you want to access your file share. To start your workflow with a File System trigger, you have to start with a blank workflow. To add a File System action, start your workflow with any trigger.

Add a File System trigger

  1. In the Azure portal, open your blank logic app workflow in the designer.

  2. In the designer, follow these general steps to add the File System trigger that you want to your workflow.

    For more information, see File System triggers. This example continues with the trigger named When a file is created.

  3. In the connection information box, provide the following information as required:

    Property Required Value Description
    Connection name Yes <connection-name> The name to use for your connection
    Root folder Yes <root-folder-name> The root folder for your file system, which is usually the main parent folder and is the folder used for the relative paths with all triggers that work on files.

    For example, if you installed the on-premises data gateway, use the local folder on the computer with the data gateway installation. Or, use the folder for the network share where the computer can access that folder, for example, \\PublicShare\\MyFileSystem.
    Authentication Type No <auth-type> The type of authentication that your file system server uses, which is Windows
    Username Yes <domain-and-username> The domain and username for the computer where you have your file system.

    For the managed File System connector, use one of the following values with the backslash (\):

    - <domain>\<username>
    - <local-computer>\<username>

    For example, if your file system folder is on the same computer as the on-premises data gateway installation, you can use <local-computer>\<username>.
    Password Yes <password> The password for the computer where you have your file system
    gateway No - <Azure-subscription>
    - <gateway-resource-name>
    This section applies only to the managed File System connector:

    - Subscription: The Azure subscription associated with the data gateway resource
    - Connection Gateway: The data gateway resource

    The following example shows the connection information for the File System managed connector trigger:

    Screenshot showing Consumption workflow designer and connection information for File System managed connector trigger.

  4. When you're done, select Create.

    Azure Logic Apps creates and tests your connection, making sure that the connection works properly. If the connection is set up correctly, the setup options appear for your selected trigger.

  5. Continue building your workflow.

    1. Provide the required information for your trigger.

      For this example, select the folder path on your file system server to check for a newly created file. Specify the number of files to return and how often you want to check.

      Screenshot showing Consumption workflow designer and the trigger named When a file is created.

    2. To test your workflow, add an Outlook action that sends you an email when a file is created on the file system in specified folder. Enter the email recipients, subject, and body. For testing, you can use your own email address.

      Screenshot showing Consumption workflow designer, managed connector trigger named When a file is created, and action named Send an email.

      Tip

      To add outputs from previous steps in the workflow, select inside the trigger's edit boxes. When the dynamic content list appears, select from the available outputs.

  6. When you're done, save your workflow.

  7. To test your workflow, upload a file, which triggers the workflow.

If successful, your workflow sends an email about the new file.

Add a File System action

The example logic app workflow starts with the Dropbox trigger, but you can use any trigger that you want.

  1. In the Azure portal, open your logic app workflow in the designer.

  2. In the designer, follow these general steps to add the File System action that you want to your workflow.

    For more information, see File System triggers. This example continues with the action named Create file.

  3. In the connection information box, provide the following information as required:

    Property Required Value Description
    Connection name Yes <connection-name> The name to use for your connection
    Root folder Yes <root-folder-name> The root folder for your file system, which is usually the main parent folder and is the folder used for the relative paths with all triggers that work on files.

    For example, if you installed the on-premises data gateway, use the local folder on the computer with the data gateway installation. Or, use the folder for the network share where the computer can access that folder, for example, \\PublicShare\\MyFileSystem.
    Authentication Type No <auth-type> The type of authentication that your file system server uses, which is Windows
    Username Yes <domain-and-username> The domain and username for the computer where you have your file system.

    For the managed File System connector, use one of the following values with the backslash (\):

    - <domain>\<username>
    - <local-computer>\<username>

    For example, if your file system folder is on the same computer as the on-premises data gateway installation, you can use <local-computer>\<username>.
    Password Yes <password> The password for the computer where you have your file system
    gateway No - <Azure-subscription>
    - <gateway-resource-name>
    This section applies only to the managed File System connector:

    - Subscription: The Azure subscription associated with the data gateway resource
    - Connection Gateway: The data gateway resource

    The following example shows the connection information for the File System managed connector action:

    Screenshot showing connection information for File System managed connector action.

  4. When you're done, select Create.

    Azure Logic Apps creates and tests your connection, making sure that the connection works properly. If the connection is set up correctly, the setup options appear for your selected action.

  5. Continue building your workflow.

    1. Provide the required information for your action.

      For this example, select the folder path on your file system server to use, which is the root folder here. Enter the file name and content, based on the file uploaded to Dropbox.

      Screenshot showing Consumption workflow designer and the File System managed connector action named Create file.

      Tip

      To add outputs from previous steps in the workflow, select inside the action's edit boxes. When the dynamic content list appears, select from the available outputs.

    2. To test your workflow, add an Outlook action that sends you an email when the File System action creates a file. Enter the email recipients, subject, and body. For testing, you can use your own email address.

      Screenshot showing Consumption workflow designer, managed connector "Create file" action, and "Send an email" action.

  6. When you're done, save your workflow.

  7. To test your workflow, upload a file, which triggers the workflow.

If successful, your workflow creates a file on your file system server, based on the uploaded file in DropBox, and sends an email about the created file.

Next steps