This repository contains a static web app, which enables users to upload CSV files containing demographic and financial data about individuals to a designated storage blob via an HTTP-triggered Azure Function. Once uploaded to the blob, another, blob-triggered function calculates correlations between various variables, such as experience, state, gender, and income. The computed statistics are then stored in a separate storage blob. These functions are defined in the python script function_app.py - which is the main entrypoint of our Azure Function App instance.
The associated Azure infrastructure is deployed with a script (more on that below).
A branch-triggered pipeline has been set up to deploy our code to the respective Azure resources using a GitHub Actions Workflows script. The two functions are deployed using the Function App's associated publish profile, whereas the static web app is deployed using a service principal configured with a federated credential. Note that the static web app is actually hosted directly on a storage blob, which is configured to serve static websites. Thus, deploying the web app is simply a matter of uploading the files to the designated blob container.
- Platform: x86-64, Linux/WSL
- Programming Languages: React, Python 3
- Cloud Account: Azure
- Resource provisioning: Azure CLI
The shell script allocate_resources creates Azure resources using the Azure CLI and a Bicep template file.
It will create the following hierarchy of resources:
graph TD
A[Subscription]
A --> B[Resource Group]
B --> C[Storage Account]
C --> D[Blob Container]
D -->|Static Website Hosting| H[index.html]
B --> E[App Service Plan]
E -->|Hosts| G[Function App]
G -->|Uses| F[Application Insights]
A -->|Contains| B
B -->|Contains| C
C -->|Contains| D
B -->|Contains| E
B -->|Contains| F
Four secrets are required in order for the GitHub Actions Workflow script to deploy the code to the Azure resources. As may be observed in the script, these are:
- AZURE_CLIENT_ID: Used to authenticate the service principal in order to deploy the static web app
- AZURE_SUBSCRIPTION_ID: Used to authenticate the service principal in order to deploy the static web app
- AZURE_TENANT_ID: Used to authenticate the service principal in order to deploy the static web app
- PUBLISH_PROFILE: Used to deploy our two functions to the Azure Function App