I'm trying to upload a Dotnet core Azure Function to an app service hosted on Windows and I'm struggling to prove that it works or ensure the settings are correct.
I also have the aspiration that the deployment should be fully automated without having to go via the Azure Portal and tweak settings etc.
Build process: currently it looks like this...
- The c# function compiles and all unit tests pass locally and on the Azure DevOps build agents
- Build completes and generates the zip file
- I wrap the zip file within a versioned Nuget package
- Nuget package is hosted in Azure DevOps Artifacts repo
So all looks good at this point.
Release Process
- I restore and unpack the nuget package on the Azure DevOps build agent.
- I confirm the zip file exists with a Powershell task - all good.
- I then use the Azure DevOps Release pipeline task; "Azure Functions"
- I think I've configured this task correctly
- Package or Folder: "The path I validated in step 2 above"
- Deployment Method: Zip Deploy (I've alternated between this and Package deployment in different releases)
App Settings (see screenshot below)
- name value pairs like -Name "value" -Name2 "value2" etc
- I've also included -WEBSITE_RUN_FROM_PACKAGE "1" in the list of app settings (I've tried releases with and without this setting present)
The Results
The release passes, it says in the logs that its uploaded the package and the app settings.
However, when I go to the Azure Portal:
- I don't see my app settings that I thought I'd uploaded in the release.
- It retains dummy app settings that I added via the Azure Portal directly
Questions
- Should I create an empty Azure Function within the AppServive using the Azure Portal before I start the Release with this task?
- The very first time I ran the release it failed because it said it couldn't find the slot I'd specified. I was under the impression that the Azure Function pipeline task would create everything but it appears that it expects there to be an empty function with slots predefined and maybe app settings predefined. Any thoughts please?
- Do I have to create app settings in the Portal before the release? In other words does the Pipeline task only allow updates to existing Portal created app settings.
- Is there a better Pipeline task to use - that can create an new Azure Function if it doesn't exist already?
As is often the case with help documentation, the info I've seen follows a happy path, or sometimes too much with lots of ifs, buts and maybe advice.
Any guidance would be truly appreciated as I feel I'm going round in circles here and it should be simple.
Thankyou.