Update deploy-storage-account.yml #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Azure Storage Account and Associate Log Analytics Workspace | |
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 and Log Analytics Workspace | |
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" \ | |
logAnalyticsWorkspaceName="rrlogtest" | |
- 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}]' |