Update deploy-storage-account.yml #25
This file contains hidden or 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 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 | |
| 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: Deploy Log Analytics Workspace | |
| run: | | |
| az deployment group create \ | |
| --resource-group rrblobtest \ | |
| --template-file bicep/log-analytics.bicep \ | |
| --parameters location="UK South" \ | |
| logAnalyticsWorkspaceName="rrlogtest" | |
| - name: Associate Log Analytics Workspace with Storage Account | |
| run: | | |
| az monitor diagnostic-settings create \ | |
| --resource "/subscriptions/${{ secrets.SUBSCRIPTION_ID }}/resourceGroups/rrblobtest/providers/Microsoft.Storage/storageAccounts/teststorage20241229" \ | |
| --name "storageAccountDiagnostics" \ | |
| --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}]' |