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.
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:
After you add a File System managed connector trigger or action to your workflow, select the data gateway resource that you previously created so you can connect to your file system.
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.
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.
For more information, see File System triggers. This example continues with the trigger named When a file is created.
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 (\):
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:
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.
Continue building your workflow.
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.
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.
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.
When you're done, save your workflow.
To test your workflow, upload a file, which triggers the workflow.
If successful, your workflow sends an email about the new file.
Built-in connector trigger
The following steps apply only to Standard logic app workflows in an App Service Environment v3 with Windows plans only.
In the Azure portal, open your blank logic app workflow in the designer.
For more information, see File System triggers. This example continues with the trigger named When a file is added.
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.
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 (\):
The password for the computer where you have your file system
The following example shows the connection information for the File System built-in connector trigger:
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.
Continue building your workflow.
Provide the required information for your trigger.
For this example, select the folder path on your file system server to check for a newly added file. Specify how often you want to check.
To test your workflow, add an Outlook action that sends you an email when a file is added to the file system in specified folder. Enter the email recipients, subject, and body. For testing, you can use your own email address.
Tip
To add outputs from previous steps in the workflow, select inside the trigger's edit boxes.
After the dynamic content list and expression editor options appear, select the dynamic content
list (lightning icon). When the dynamic content list appears, select from the available outputs.
When you're done, save your workflow.
To test your workflow, upload a file, which triggers the workflow.
If successful, your workflow sends an email about the new file.
Managed connector trigger
In the Azure portal, open your blank logic app workflow in the designer.
For more information, see File System triggers. This example continues with the trigger named When a file is created.
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 (\):
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:
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.
Continue building your workflow.
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.
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.
Tip
To add outputs from previous steps in the workflow, select inside the trigger's edit boxes.
After the dynamic content list and expression editor options appear, select the dynamic content
list (lightning icon). When the dynamic content list appears, select from the available outputs.
When you're done, save your workflow.
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.
For more information, see File System triggers. This example continues with the action named Create file.
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 (\):
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:
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.
Continue building your workflow.
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.
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.
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.
When you're done, save your workflow.
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.
Built-in connector action
These steps apply only to Standard logic apps in an App Service Environment v3 with Windows plans only.
In the Azure portal, open your logic app workflow in the designer.
For more information, see File System actions. This example continues with the action named Create file.
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.
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 (\):
The password for the computer where you have your file system
The following example shows the connection information for the File System built-in connector action:
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.
Continue building your workflow.
Provide the required information for your action. For this example, follow these steps:
Enter path and name for the file that you want to create, including the file name extension. Make sure the path is relative to the root folder.
To specify the content from the file created on Dropbox, from the Add a parameter list, select File content.
After the File content parameter appears on the action information pane, select inside the parameter's edit box.
After the dynamic content list and expression editor options appear, select the dynamic content list (lightning icon). From the list that appears, under the When a file is created trigger section, select File Content.
When you're done, the File Content trigger output appears in the File content parameter:
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.
When you're done, save your workflow.
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.
Managed connector action
In the Azure portal, open your logic app workflow in the designer.
For more information, see File System actions. This example continues with the action named Create file.
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 (\):
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:
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.
Continue building your workflow.
Provide the required information for your action. For this example, follow these steps:
Enter path and name for the file that you want to create, including the file name extension. Make sure the path is relative to the root folder.
To specify the content from the file created on Dropbox, from the Add a parameter list, select File content.
After the File content parameter appears on the action information pane, select inside the parameter's edit box.
After the dynamic content list and expression editor options appear, select the dynamic content list (lightning icon). From the list that appears, under the When a file is created trigger section, select File Content.
When you're done, the File Content trigger output appears in the File content parameter:
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.
When you're done, save your workflow.
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.