Search code examples
azureazure-functionsazure-app-service-envrmntazure-functions-core-tools

What is the best way to move an online Azure Function to a local git repository?


I have written an Azure Function App by using the User Interface of Azure Portal. The code is written in C#.

Now, I want to:

  1. download all of the relevant code and configuration files of this function app
  2. Create an IDE project (e.g. IntelliJ, Visual Studio Code, ...)
  3. store it in a git repository
  4. Deploy the code from IDE or command line to Azure and thereby replacing the previously written Azure function.

So far, I have found only documentation on how to initiate Azure function projects with no previous code. Does somebody know how to do above?


Solution

  • Yes, you could go to your function Overview page, click on Download app content as shown below.

    enter image description here

    And in your situation, you want configuration files, so select the Content and Visual Studio Project and Include app settings in the download. What is app settings? This will include a local.settings.json file which contains your application settings.

    enter image description here

    Also the third party .dlls are included.

    enter image description here

    In the VS, select the folder and it will be working.

    enter image description here

    Update:

    Open the function with vs, then just right click the function and choose Publish, it will show you the publish page. Click start, then you will be able to publish it to a existing Function.

    enter image description here

    enter image description here

    enter image description here