7

I have an Azure Functions app working for development purposes, using a Table Storage account with test data. Now I want to have a separate environment (same Functions app with different storage config/conn-string) for production.

So, how can I "copy" my Azure Functions App in order to avoid manual recreation of it in the Azure portal?

Néstor Sánchez A.
  • 3,848
  • 10
  • 44
  • 68

3 Answers3

6

There are a couple of ways you can move the content from one Function App to another. The simplest is to copy the contents of your wwwroot folder to the other environment, which you can do by using Kudu, FTP, etc.

Another way that is often simpler and less error prone is to setup CI/CD so that different branches will trigger deployments to different environments. You can learn more about the continuous deployment options here.

Fabio Cavalcante
  • 12,328
  • 3
  • 35
  • 43
  • 1
    This doesn't answer the original question. Any tips on how I can (in an automated or scripted way) copy an entire Azure Function App resource, maybe even the entire resource group that contains Application Insights and a Storage Account? – vullnetyy Jul 31 '20 at 19:38
2
  1. Stop Azure Function
  2. Open up the browser, navigate to https://{functionName}.scm.azurewebsites.net/DebugConsole
  3. Navigate to site/wwwroot
  4. Create a new folder (which would represent your new functions) and copy the contents of your function app (which is one of the folder in this directory) into that folder. Folder names = Function Names
  5. Start Azure Function
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • 2
    I was talking about the whole Function App, which is composed of several small functions (those you're talking about). Thanks for the try. – Néstor Sánchez A. Mar 16 '17 at 07:40
  • As I always end up here when I'm doing this, the command to clone the function is `robocopy dir1 dir2 /E` – stuartd Oct 24 '19 at 17:47
  • Also, I don't see why you should have to 'stop' the function. After all, it isn't going to change while you're cloning it... – stuartd Oct 24 '19 at 22:28
0

By using the Azure Functions CLI, you can just copy a directory, then publish using func azure functionapp publish

Source: https://learn.microsoft.com/en-us/answers/questions/123779/azure-clone-a-function.html

juntunen
  • 207
  • 3
  • 10