First create an Azure account, you can get free tier services, free trials and free credit (for example when signing up, and through Visual Studio Dev Essentials).
Install the Azure CLI, either via the installer or Chocolatey (from and Administrator PowerShell prompt):
choco install azure-cliThen (after re-opening your command prompt) you should be able to use the Azure CLI
az loginwhich will open a browser window to login.
From the command prompt in the repository
mkdir Deployment
cd DeploymentOptionally, if you're storing data in your (private) repo instead
mkdir .pulumi
pulumi login file://./.pulumiAnd then create the project
pulumi new azure-fsharp --forceBut the default project template doesn't use paket, so edit the fsproj
- <ItemGroup>
- <PackageReference Include="Pulumi.AzureNative" Version="0.*" />
- <PackageReference Include="Pulumi.FSharp" Version="2.*" />
- </ItemGroup>and add the packages
dotnet paket add Pulumi.AzureNative --project Deployment
dotnet paket add Pulumi.FSharp --project DeploymentBy the time the deployment was coded up, there wasn't much left of the templated code. It was built from:
By performing the command-line deployment explained in the Azure guide, you can find the correct settings for the Pulumi objects. For example:
az functionapp create --resource-group functions1234 --consumption-plan-location westeurope --runtime dotnet-isolated --runtime-version 5.0 --functions-version 3 --name wvazureclie --storage-account sa8c6d7Then retrieve the settings from Pulumi code.
let fn = WebApp.Get("wvazurecli", input "/subscriptions/...../resourceGroups/functions1234/providers/Microsoft.Web/sites/wvazureclie")
let webAppKind = fn.Kind
let webAppConfigSettings = fn.SiteConfig |> Outputs.apply (fun c -> c.AppSettings |> Seq.map (fun o -> $"{o.Name}={o.Value}") |> String.concat ",")
let webAppConfigNetVer = fn.SiteConfig |> Outputs.apply (fun c -> c.NetFrameworkVersion)
let serverFarmId = fn.ServerFarmIdand return the values to be shown in the preview of pulumi up
dict [
"fn.Kind", webAppKind :> obj
"fn.SiteConfig.AppSettings", webAppConfigSettings :> obj
"fn.SiteConfig.NetVer", webAppConfigNetVer :> obj
"fn.ServerFarmId", serverFarmId :> obj
]You can also diff the json produced by the Export tab of the Azure Web Portal for the az func-deployed and Pulumi-deployed versions to check that
everything is there.
There are a couple of rough edges, particularly hardcoding part of the function URL for the stack output dictionary at the end. But opening the URL in the web browser shows the "Hello" message from the function running in 'the cloud'.