From 36aeead257ca7fe59efdd86a70746d85e1587857 Mon Sep 17 00:00:00 2001 From: rrichley <94038906+rrichley@users.noreply.github.com> Date: Mon, 30 Dec 2024 09:58:42 +0000 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 45 ++++++++++-------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 898f03d..759e128 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy Azure Resources +name: Deploy Azure Storage Account with Log Analytics Integration on: push: @@ -18,42 +18,21 @@ jobs: with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: Create Resource Group + - name: Ensure Resource Group Exists run: | - az group create --name rrblobtest --location "UK South" + if ! az group show --name rrblobtest &>/dev/null; then + az group create --name rrblobtest --location "UK West" + else + echo "Resource group rrblobtest already exists." + fi - - name: Deploy Storage Account + - name: Deploy Storage Account and Log Analytics Association run: | az deployment group create \ --resource-group rrblobtest \ - --template-file bicep/storage-account.bicep \ - --parameters location="UK South" \ + --template-file bicep/main.bicep \ + --parameters location="UK West" \ storageAccountName="test123434" \ containerName="images" \ - allowedIP="92.16.42.251" - - - name: Ensure Resource Group Exists - run: | - if ! az group show --name rrblobtest &>/dev/null; then - az group create --name rrblobtest --location "UK West" - else - echo "Resource group rrblobtest already exists." - fi - - - - name: Fetch Log Analytics Workspace ID - id: fetch_workspace_id - run: | - LOG_ANALYTICS_WORKSPACE_ID=$(az monitor log-analytics workspace show \ - --resource-group \ - --workspace-name rrlogtest \ - --query id -o tsv) - echo "LOG_ANALYTICS_WORKSPACE_ID=${LOG_ANALYTICS_WORKSPACE_ID}" >> $GITHUB_ENV - - - name: Deploy Log Analytics Integration - run: | - az deployment group create \ - --resource-group rrblobtest \ - --template-file bicep/log-analytics-integration.bicep \ - --parameters storageAccountId="/subscriptions//resourceGroups/rrblobtest/providers/Microsoft.Storage/storageAccounts/test123434" \ - logAnalyticsWorkspaceId="$LOG_ANALYTICS_WORKSPACE_ID" + allowedIP="92.16.42.251" \ + logAnalyticsWorkspaceName="rrlogtest"