Azure functions - Just the CLI, hold the GUI, add some git

When sitting down to get started on a project, the start and stops of setting this and that up can be a non-starter. Sometimes, ok almost always, I just want check in code and have the build and deploy just happen.

I'm a very big fan of CLI tooling. If I can fire up a bash prompt and get started, you've won me over. The .NET Core team continues to improve the command line tooling experience for all platforms with dotnet new and if you're pushing your apps to the cloud; the Azure 2.0 CLI is on point for getting stuff done.

Azure CLI - The Azure CLI 2.0 is Azure's new command line experience for managing Azure resources. It runs on Windows, macOS and Linux. Get the installer for your OS here.

Using the portal is good way to get a visual understanding of the architecture or composure of Azure and setting up your first serverless function.

See - Create your first Azure Function -

For repetitive instances, you may want to use ARM template deployments to speed up these infrastructure deployments to get started on your future serverless projects.

ARM template

The following ARM template defines an infrastructure for a Storage Account, Hosting Plan, and Azure Function setup with Continuous Integration tied to a GitHub repo. These are the minimum components for a CI/CD based serverless function in Azure.

The hosting plan in the template is set to be the "Consumption Plan" by default.


Using the Azure CLI we can use this template to create a deployment and parameters in the way of a file or command line arguments to create the infrastructure ready for development.

Log in

az login  

Create Resource Group

A Resource Group is a logical grouping of resources in Azure. Best practice is to create/name this resource in a manner that is related to your application. This also allows for ease of locating resources and cleaning up (if you're testing a lot).

The command requires a name and location.

az group create --name "spboyerappgroup" --location "East US"  


The ARM template (azuredeploy.json see above lines 4-40) defines the following parameters:

  • appName
  • location
  • storageAccountName
  • storageAccountType
  • repoURL
  • branch

Create a new file called parameters.json with the contents.

   "$schema": "",
   "contentVersion": "",
   "parameters": {
      "appName": {
          "value": "spboyerappname"
      "storageAccountName": {
          "value": "spboyerstorage"
      "storageAccountType": {
          "value": "Standard_LRS"
      "repoURL": {
          "value": ""
      "branch": {
          "value": "master"
      "location": {
          "value": "East US"

One important note is storageAccountName is limited to 3-24 characters, letters and numbers only.

Deploying the template

Use the CLI to deploy the template using a combination of the following options.

  • inline parameters --parameters {}
  • local parameters file --parameters @<filename>, the @ is required notating the parameters are a file.
  • external template --template-uri <uri>
  • local template --template-file <filename>

Deployment using file

az group deployment create --name MyDeployment --resource-group MyResourceGroup --template-file azuredeploy.json --parameters @parameters.json  

Deployment using remote template and local parameters file

az group deployment create --name MyDeployment --resource-group MyResourceGroup --template-uri --parameters @parameters.json  

Deployment using command-line parameters

az group deployment create --name MyDeployment --resource-group spboyergroup --template-file azuredeploy.json \  
     --parameters '{"appName":{"value":"spboyerappname"},"storageAccountName":{"value":"spboyerstorage"},"storageAccountType":{"value":"Standard_LRS"},"repoURL":{"value":""},"branch":{"value":"master"},"location":{"value":"East US"}}'


Tweet Post Share Update Email RSS

Hi, I'm Shayne Boyer, I write this site, work on ASP.NET Core content and Open Source, speak at national and community events while helping teams architect web and cloud applications.

azure azure-functions azure-cli azuredev