Deploy one function in an Azure function app


Deploy one function in an Azure function app


Issue:

·       Is it possible to deploy just one function in an Azure function app?

·       Can I deploy single function when there are multiple functions?

·       Azure functions deploy single function?


Solution:

There are various ways to deploy your function app e.g.
·       Visual Studio,
·       Visual Source Code,
·       Dev Ops
·       MSDEPLOY
·       Zip Deploy
·       ARM Template
·       GIT

but all these allow us to deploy whole function app as a single unit but not the single or one function while there are multiple functions available in your function app.

Ideally you should be deploying the entire function app as a single unit which is the best practice but sometime if you want to deploy a single function (which is not recommended) then you can use the REST API which support deploying individual functions in a limited way.

You need to send a PUT request to update your function. Please note, in this case your function app should have been created already.

PUT

/subscriptions/{subscription ID}/resourceGroups/{resource group name}/providers/Microsoft.Web/sites/{function app name}/functions/MyFunction?api-version=2015-08-01


Again, the use of this API is highly not recommended. You should instead deploy your entire Function App as a single unit

References,





1 comment:

  1. This answer speaks to the reason I hate the phrase, "best practice."

    "Ideally you should be deploying the entire function app as a single unit which is the best practice..."
    Wouldn't it be better to say "Microsoft recommends..." blah blah blah? Saying best practice implies there is not and will not be a better way. I disagree wholesale with the above practice and actually consider it a really crappy practice - I wish there was a better way!

    Says who? Being able to deploy individual microservices would be much better than having to deploy 40 microservices that are all part of the same project. Wouldn't you prefer to quickly develop a new microservice (azure function) and deploy it to production a few minutes later without needing to deploy all the other functions in the app along with it? Even if you are using Azure Deployment Slots properly the deployment process is more lengthy, among other negative factors.

    ReplyDelete