2

I m developing azure function from VS. I deploy time to time to Azure and test. My app has many settings in local.settings.json

Every time I change on one place have to do manually on every place. Is there a way to automate it or an easy way ?

thanks

hussmom
  • 55
  • 1
  • 9
  • 2
    IIRC you are not supposed to use local.settings.json in Azure since that is for your *local* environment. You should be putting them in App Settings in my opinion. Automation can be done with ARM templates or Azure PowerShell. Usually you would not want to sync the whole local.settings.json file to app settings, as those are usually dev-environment-specific. – juunas May 07 '18 at 02:09

1 Answers1

11

You can sync settings between local and Azure with Func CLI:

  • func azure functionapp fetch-app-settings <name> to copy from Azure to local

  • func azure functionapp publish <name> --publish-settings-only to copy from local to Azure

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • And note that only settings included in `Values` can be published to Azure. – Jerry Liu May 07 '18 at 04:10
  • @hussmom Go to the folder where your app (`host.json`) is. `` above is the app name. No need to use function name, the app is the unit of deployment. – Mikhail Shilkov May 09 '18 at 06:58
  • I ran cli it was showing path "C:\Users\3176\AppData\Local\Azure.Functions.Cli\1.0.12>" wrote command gave error: Unable to find function project root. Expecting to have host.json in function project root. How to give path of function, sorry for this again. – hussmom May 09 '18 at 07:01
  • @hussmom CLI should be in your path, and then, as I said, you just navigation to function folder and run it from there – Mikhail Shilkov May 09 '18 at 07:03
  • If I go to the path of directory where my function is cmd do not recognize func command. error "'func' is not recognized as an internal or external command, operable program or batch file." please help – hussmom May 09 '18 at 07:05
  • sorry I m not getting how to run CLI and also give path to host.json – hussmom May 09 '18 at 07:06