Farmer comes with a .NET template that makes getting started easy.
The easiest way to create a Farmer app is to use the Farmer .NET Template.
dotnet new -i Farmer.Template
dotnet new Farmer
You only have to install the template once on your machine!
This creates a new dotnet application solution and project that looks by default as follows:
open Farmer
open Farmer.Builders
let deployment = arm {
location Location.NorthEurope
}
printf "Generating ARM template..."
deployment |> Writer.quickWrite "output"
printfn "all done! Template written to output.json"
From here, you can add resources in the normal manner.
You can configure the template using the following optional arguments.
The name of the ARM template JSON file e.g. --armTemplate myTemplate
The location to create resources in e.g. --location WestUS
You can also configure the Farmer template to deploy to Azure out of the box using the --ci
option. This has two modes of operation:
This comes with a ready-made devops YAML file designed for simple CI/CD, using Farmer to generate ARM templates and Azdo to deploy using its own ARM Template deployment process. You should supply the following arguments:
If you prefer a deployment process that is not coupled to Azure Devops, you can create a service principal in Azure and use the generated credentials in Farmer. Farmer will use its own wrapper around the Azure REST API to deploy to Azure, reporting progress to the console.