Azure Functions & App Services Run From Package — Infra-As-Code
Azure Functions and Azure App Service are one of the most used Platform-As-A-Services provided by Microsoft Azure, to remove the complexity of server management and allows developer to focus on application code. There’s a tight integration with IDE, such as Visual Studio Code, and Visual Studio, deployment is simply one click away.
This method is great for small scale application, quick development, or test environment. For organizations with DevOps practises, this manual deployment process will then be replaced by continuous integration and continuous deployment pipelines such as GitHub Actions and Azure Pipelines.
These two are the most straightforward options for deployment. Recently I was creating contents for some documentation, which requires me to create deployment template, and share with public. In Azure context, it would be Azure Resource Manager Template (ARM Template). ARM Template is a fantastic way to accelerate deployment, and it can be used as a mechanism on “Infrastructure-As-Code”.
Because of this exercise, I discovered “WEBSITE_RUN_FROM_PACKAGE” options, which makes the template creation fuss free. In short, instead of deploying to the instances directly, you create a zip package, store it in a location that Azure can access. Azure Functions or Azure App Service will then pull this zip file, extract it and run the code. Azure Functions support multiple languages such as C#, Node, Python etc, and the creation is similar.
Let me walk through the process for compiled programming language (I will use C# as an example), and interpreted language (Python as an example). For ease of reference, I will use Azure Functions, but the steps are identical for Azure App Service 😉
 Azure Functions in C#
C# is a compiled programming language, hence developers need to build the code to generate binary before execution. Azure Functions or…