Skip to main content

How to setup the Agent to mount a file share

How to setup the Agent to mount a file share and use it in Processes.

Ossi Galkin avatar
Written by Ossi Galkin
Updated over 2 years ago

Written for Frends version 4.5

Prerequisites

This guide will be expanding on the Installing an Agent How-To so you will need to meet the prerequisites for that in addition to the ones listed below.

  • The drive you wish to map the file share to, for example Y

  • Username to access the file share, e.g., AZURE\myazurefileaccount

  • Password to access the file share, e.g., xxxyyyzzz==

  • The share location, e.g., \myazurefileaccount.file.core.windows.net\myazurefiles

Overview

The Frends Agent mounts file shares on start-up according to its configuration file FrendsAccService.exe.config. 

This setting can be either written by the installer according to a configuration transformation or by editing the configuration file directly. 

Creating a configuration transformation file for the installer

It is recommended to use a transformation file to add the file share setting to the configuration. This is due to the configuration file being overwritten on each install. By reusing the transformation, the configuration file will always have the file share setting set.

  1. Create a directory named AgentInstallerDirectory\additionalFiles next to the installer and config.json file. Create a file named FileShares.agentServiceTransformation in the directory.

  2. Add the following content to the file with the correct values edited in from the prerequisites, remember to escape backslashes (\):

<configuration xmlns:xdt='http://schemas.microsoft.com/XML-Document-Transform'>
  <appSettings>
    <add key='MappedDriveSettingsJson' value='' xdt:Transform='InsertIfMissing' xdt:Locator='Match(key)' />
    <add key="MappedDriveSettingsJson" value='[
    {
        "DriveLetter": "Y",
        "PathToMap": "\\\\myazurefileaccount.file.core.windows.net\\myazurefiles",
        "Password": "xxxyyyzzz==",
        "UserName": "AZURE\\myazurefileaccount"
    }]'
    xdt:Transform='SetAttributes' xdt:Locator='Match(key)' />
    </appSettings>
</configuration>
  1. Run the installer according to the Installing an Agent How-To.

  2. The Frends Agent should now map the drive according to the configuration settings on start-up.

Modifying the Agent configuration manually

If you only want to set up the file share mapping once without reinstalling the Agent, for example to test the mapping, you can make the required changes manually to the configuration file as well. 

Note that any changes to the configuration file will be lost when you install a new version of the Agent, and you would need to make the changes again after the update. It is highly recommended to use the configuration transformation instead.

  1. Backup and then open up the FrendsAccService.exe.config file located in the Frends Agent installation directory.

  2. Add the following setting inside the <appSettings> element with the appropriate settings from the prerequisites

<add key="MappedDriveSettingsJson" value='[
    {
        "DriveLetter": "Y",
        "PathToMap": "\\\\myazurefileaccount.file.core.windows.net\\myazurefiles",
        "Password": "xxxyyyzzz==",
        "UserName": "AZURE\\myazurefileaccount"
    }]' />
  1. Restart the Frends Agent service

  2. The Frends Agent should now map the drive according to the configuration settings on start-up.

Using the file share

Processes should now be able to access the mounted file share normally, e.g. Y:\myFile.xml

    

  

Did this answer your question?