Skip to content

Update deploy-storage-account.yml #29

Update deploy-storage-account.yml

Update deploy-storage-account.yml #29

name: Deploy Azure Storage Account and Configure Diagnostic Settings
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create Resource Group
run: |
az group create --name rrblobtest --location "UK South"
- name: Deploy Storage Account
run: |
az deployment group create \
--resource-group rrblobtest \
--template-file bicep/storage-account.bicep \
--parameters location="UK South" \
storageAccountName="teststorage20241229" \
containerName="images" \
allowedIP="92.16.42.251"
- name: Create Log Analytics Workspace
run: |
az monitor log-analytics workspace create \
--resource-group rrblobtest \
--workspace-name rrlogtest \
--location "UK South"
- name: Associate Log Analytics Workspace with Storage Account
run: |
az monitor diagnostic-settings create \
--name "storageAccountDiagnostics" \
--resource "/subscriptions/${{ secrets.SUBSCRIPTION_ID }}/resourceGroups/rrblobtest/providers/Microsoft.Storage/storageAccounts/teststorage20241229" \
--workspace "/subscriptions/${{ secrets.SUBSCRIPTION_ID }}/resourceGroups/rrblobtest/providers/Microsoft.OperationalInsights/workspaces/rrlogtest" \
--logs '[{"category": "StorageRead", "enabled": true},{"category": "StorageWrite", "enabled": true},{"category": "StorageDelete", "enabled": true}]' \
--metrics '[{"category": "AllMetrics", "enabled": true}]'