I am new to Azure and i would like to deploy a folder with my function azure (python file) and create a function in my function app. Do i need a function.json file and what is it for? I am using GitHub actions as CI / CD. Which method can I use? ZIP deploy, Storage Azure deploy, serverless, other? I tested a lot of things with no results.
The manual:
Which has a section: Source Control.
Which points to: Continuous deployment for Azure Functions
Related
I have Azure Function running Power Shell that built in a cloud itself (no local files).
I need to copy it to another Azure subscription,
I see a lot of example how to deploy, but my question is how to take all the files of function from Azure and put it in Azure Devops repository with some script, without downloading it to my computer.
I don't think there's a direct way to take all the files of function from Azure and put it in Azure DevOps repository without downloading them first.
Basically, we need to download app content to your local machine first, and then push it to Azure DevOps repository.
You can reference the following blogs to do that:
Copying an Azure Function App using the Portal, GitHub and Cloud
Shell
How to… copy Function Apps
I'm building Azure Function (Premium plan) with Private endpoint.
As I'm using private endpoint, function is not available from the public internet / MSFT managed Cloud pipelines.
Now, idea was to use Deployment Center in Function App to enable CI/CD, but I'm failing to find a way how to script configuration of Deployment Center.
Is there even a way to setup Deployment Center configuration outside of Azure Portal? Using Bicep or Powershell? Essentially, something which will map repository/branch/build pipeline with given slot.
It will be weird to have completely automated process for deployment of infrastructure and then to go there and manually update deployment configuration for each subscription/stage.
you can use github actions to deploy the function, but you have to connect the github to the function through the deployment center.
This is simple process where in deployment center just select github under source and connect the github repository by Loging in the github account.
Another solution would be to use visual studio like tool to directly deploy from to development environment.
Also, you can containerize the function and deploy the container.
Refer the following documentation on all the ways of deployment to the azure.
I've got a bicep file that has made the following resources: Function app, storage account, app insights, key vault and app service plan, via a build pipeline in Azure Dev Ops Pipelines. I need to populate these resources with artifacts built from source code e.g. adding functions to the function app. I'm not sure how to do this though. Does anyone have any advice or links to tutorials? I'm new to Azure and would appreciate any help. Thanks.
Basically, Azure pipelines working with tasks to deploy artifacts to the resources. These resources can be AKS, IIS or Azure functions as you mentioned. If you particularly looking for Azure function deployment task you can use the AzureFunction#1 task for that.
Here is some additional useful links;
https://www.azuredevopslabs.com/labs/vstsextend/azurefunctions/#:~:text=Azure%20Functions%20is%20an%20event,well%20as%20on%2Dpremises%20systems.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=dotnet-core%2Cyaml%2Ccsharp
I am running a custom ARM template to create the infrastructure (Dynamic App Service plan, Storage account etc.) for an Azure function through an Azure DevOps Pipeline.
I am also deploying my function code via Azure DevOps from a different Github repo in a different Azure DevOps pipeline.
After I've successfully deployed the infrastructure and code if the pipeline for the infrastructure runs again it deletes the code, even if the changes I am making to the infrastructure don't effect the function and I run in Incremental mode.
It turns out the issue was a missing setting.
https://learn.microsoft.com/en-ca/azure/azure-functions/run-functions-from-deployment-package
When an ARM template runs it replaces an the app settings for an app service (for Functions too).
I didn't realize that the Azure Dev Ops task for deploying function code is actually using this new run from package deployment method so I should have had the setting in the app settings portion of my ARM template.
When I ran the ARM template a second time after the code had been deployed it was removing the WEBSITE_RUN_FROM_PACKAGE setting so that the function didn't know where the code was.
To fix the issue I simply added { "name": "WEBSITE_RUN_FROM_PACKAGE", "value": "1" } to my ARM template!
Note this is very similar to this question. I wanted to call out that the Azure DevOps task for Functions now uses Run from Package: Azure Functions ARM Template deploy deletes Functions
I want to deploy a Function App including code using an ARM template that is going to be published in the Azure Marketplace as a Managed App.
I've seen in the docs that you can add a sourcecontrols element in the ARM template that you can use to point to e.g. a GitHub repository. However, I don't want to use a repository, I want to code to be uploaded to the Function App.
I also know you can upload the code using the Azure CLI or powershell, however this will not be possible when publishing the app in the marketplace.
Is there a way to have a package that contains everything including the code and have that uploaded to the Function App all using an ARM template in the Azure Marketplace?
You should take a look at Run-From-Zip. Basically, you host the zip package somewhere (typically storage blob), and in ARM template you just set a WEBSITE_RUN_FROM_ZIP App Setting pointing to it.
As an alternative, you could use the ARM msdeploy extension, and point it to the zip package (e.g. something like this).