Azure Functions Core Tools:
This is a continuation of a series of articles on
Azure services from an operational engineering perspective with the most recent
introduction to Azure App Configuration with the link here. This article discusses Azure Functions Core
Tools.
Azure Functions Core Tools help to develop and
test Azure Functions on the local computer from the command prompt or
terminal. The local function can connect
to live Azure Services, and this helps to debug functions on the local computer
using the full Functions runtime. It can even help deploy a function
application to the Azure subscription. The basic steps are as follows:
1.
Install the core tools and dependencies – The prerequisites for these
are Azure CLI or Azure PowerShell. The
core tools version depends on Azure Functions. The version used depends on the
local development environment, choice of language and the level of support
required.
A version of the same runtime that powers Azure Function can also be
run on the local computer.
2. Create a local functions project: The project
directory contains the following files and folders, regardless of language:
host.json, local.settings.json, .gitignore, and .vscode\extensions.json. The command
“func init [projectFileName]” can create the necessary structure and
boilerplate scaffolding.
3. Register extensions: Function triggers and
bindings are implemented as .Net extensions (NuGet) package. These can be
referred for the specific triggers and bindings. HTTP bindings and timer
triggers don’t require extensions.
4. Use Extension bundles. Binding extensions can be installed by
enabling extension bundles. When we enable bundles, a predefined set of
extension packages is automatically installed. The host.json file bears the
additional entry comprising of a version and extensionBundle to enable it.
5. Install extensions one by one – If there is a
non-.Net project, extension bundles cannot be used. Then we need to target a
specific version of an extension not in the bundle. In these cases, Core Tools
can be used to install the extensions one by one locally.
6. Local Settings: Settings required by functions
are stored securely in app settings when the function is run. When the
functions are local, the settings are added to the Values object in the
local.settings.json file. The local.settings.json file also stores settings
used by the local development tools.
7. Get the storage connections strings: With the
help of the Microsoft Azure Storage Emulator for development, it is possible to
run the function locally with an actual storage connection string.
8. Create the function: The creation of a function
in an existing project is done with the help of the “func new” command.
9. Run the functions locally with the help of the func
start command.
With these steps, we can get started with an
application function in the local development environment and test data can be
passed to it.
No comments:
Post a Comment