In our previous blog of this series, we discussed about creating function app on Azure. In this blog, we will explore how to create a C# function and deploy it to an Azure Function App.
We will develop two separate C# functions: one for adding files and another for reading files on an SFTP server.
We’ll be using Visual Studio for coding, so make sure all required Azure Functions tools are installed.
- Firstly, Open Visual Studio and click on “Create a new project”.
- Select “Azure Functions” from the project templates and click on Next.
- Next, Add Project Name, then click on Next.
-
Functions worker: Select .NET 6.0.
In Function option, we will select HTTP trigger to access our function using API. Click on Create.
Check “Use Azurite for runtime storage account” option as we want to publish this project to Azure Function App. - The Visual Studio project will be created as below.
- Now, create two C# functions in Visual Studio: one to Add file in SFTP server using Business Central data and another to Read/Access data of the file available from SFTP server in Business Central.Please note that, C# functions are created with “.cs” file extension.A. Create HTTP-triggered C# function to Add file on SFTP Server:
B. Create function to Read/Access data from file which is available on SFTP server.
- Next, To publish the C# function which we have created on Azure Function App, Right Click on SFTP-1 project, and click on Publish.
- Select Azure and click Next.
- Click on “Azure Function App (Windows)” and click Next.
- Now, select Functions Instance which we have created on Azure portal and click on Finish.
- Lastly, to publish the function on Azure Portal click on PUBLISH. By clicking on Publish, the function will be adding on Azure Portal which we have created in Visual Studio.
To be continued…
Thank you for following along! In next part of the blog series, we’ll explore how to add an XML file to an SFTP server using your Azure Function App. Click here to continue to the next part. If you haven’t read Part 1 yet, you can start from the beginning by Clicking here.
If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way. Let’s turn your vision into reality together!