Day 1 Dev Log
For day 1 of the cloud resume challenge I decided to focus on creating a very simple HTML site and getting it up on Azure. Once the basic site was operational as a static site, I wanted to the Github action going so that I can quickly make changes and publish going forward. I believe that this will help things move a bit faster.
Initial Setup
- Created simple HTML page
- Created blob storage account
- enable static website
- set index.html as default
- Push site to $web container of the storage account
- Setup Git repo and sync HTML site with that.
CI/CD Pipeline with GitHub
- Create Service principal
- Run
az connect
- Set the correct subscription by running
az account set --subscription prod
- Create service principal, modify the subscription id and resource group name
az ad sp create-for-rbac --name "myML" --role contributor --scopes /subscriptions/<subscription-id>/resourceGroups/<group-name> --json-auth
- Copy the JSON output and note if somewhere as you will need this later.
- Configure GitHub Secret
- Go to the GitHub repo, then Settings -> Security -> Secrets and Variables -> Actions
- Choose New Repository Secret
- Name it
AZURE_CREDENTIALS
- For the value(secret), paste in the JSON output from the command earlier.
- Name it
- Add GitHub Action Workflow
- Click Actions at the top of your GitHub repo
- Select the option to setup a workflow yourself
- Paste the code below and make sure you update the storage account name to match yours.
- Run
name: Blob storage website CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: upload to blob
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob sync --account-name resumechallengetake2 --container '$web' --source './'
- name: logout
run: |
az logout
if: always()