This repository shows how to construct a storage account with an associated web application with a trust granted to the web application using Azure's managed identity capabilities. It also demonstrates how to use Compositional IT's Farmer technology to rapidly construct application topologies via Azure Resource Manager (ARM) templates.
- .NET 3.1 SDK or higher
- Visual Studio 2019, Rider or Visual Studio Code with the Ionide F# extension
- Azure CLI
- Web Application: An ASP .NET Core web application running in F# using the Saturn and Giraffe libraries.
- Farmer Template: An F# console application that creates and configures all Azure resources and deploys the application into them in a ready-to-run state.
dotnet publish webapp -c Release -o publish
Open the infrastructure/Program.fs
file and update the baseName
value to something that is unique to you. The resource group, storage account, and web app names will be generated from this value.
dotnet run -p infrastructure
The Infrastructure application uses Farmer to do the following:
- Provisions Storage and Web Application resources
- Turns on the System Identity of the Web Application
- Grants Reader permissions of the identity to the storage account
- Deploys them to Azure
- Uploads a set of files into the created storage account
You will be prompted to log into Azure the first time you execute the script. After a short delay, Farmer will generate and deploy both the ARM template and the deployed web application into the provisioned App Service.
Finally, the application opens a browser to show the data served back by ASP .NET.