- Install Azure CLI
- Install Azure Function Core Tools
- Install tfswitch to be able to install and use any Terraform version at anytime
.
├── LICENSE
├── README.md
├── infra <- Code that will setup the infrastructure on Azure
│ ├── main.tf
│ ├── resources.tf
│ └── variables.tf
└── src
└── example-ts-function <- Code of a Typescript Azure Function
├── host.json
├── local.settings.json
├── package.json
├── say-goodbye <- Setting a trigger and input/output bindings for a specific usage of the function
│ └── function.json
├── say-hello <- Another trigger and bindings
│ └── function.json
└── tsconfig.json
Login to Azure with Azure CLI command az login
- Run
terraform validate && terraform fmt
to validate your infra configuration and format the files terraform init
to prepare the working directory so Terraform can run the configurationterraform plan
to preview any changes before you apply themterraform apply
to create or update infrastructure
Inside the function root folder, run:
npm run build && zip -r <name-of-your-choice>.zip .
az functionapp deployment source config-zip -g <resource-group-name> -n <function-app-name> --src ./<package-name>.zip --debug
You can lately save these commands as NPM commands.
- Inside the src folder, execute the command
func init <MyFunctionName>
- Select the worker runtime, in this case Node
- Select the language, so Typescript
- Once the function directory is created, navigate to it with
cd <DirName>
and create a new directory with a standard name, likemkdir http-trigger
- Navigate to your new dir and create a function definition file with
touch function.json