diff --git a/.github/workflows/sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.yml b/.github/workflows/sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.yml new file mode 100644 index 0000000..cdadcc8 --- /dev/null +++ b/.github/workflows/sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.yml @@ -0,0 +1,81 @@ +name: Deploy Content to luna-canary-ws-0 [1f22d4f2-7f8b-436c-8ac8-83af8f733e0f] +# Note: This workflow will deploy everything in the root directory. +# To deploy content only from a specific path (for example SentinelContent): +# 1. Add the target path to the "paths" property like such +# paths: +# - 'SentinelContent/**' +# - '!.github/workflows/**' +# - '.github/workflows/sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.yml' +# 2. Append the path to the directory environment variable below +# directory: '${{ github.workspace }}/SentinelContent' + +on: + push: + branches: [ demo ] + paths: + - '**' + - '!.github/workflows/**' # this filter prevents other workflow changes from triggering this workflow + - '.github/workflows/sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.yml' + +jobs: + deploy-content: + runs-on: windows-latest + env: + resourceGroupName: 'luna-canary-rg-0' + workspaceName: 'luna-canary-ws-0' + workspaceId: '4b23cac5-78d5-4d0b-adab-632075079bef' + directory: '${{ github.workspace }}' + cloudEnv: 'AzureCloud' + creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_1f22d4f27f8b436c8ac883af8f733e0f }} + contentTypes: 'AnalyticsRule,Workbook' + branch: 'demo' + sourceControlId: '1f22d4f2-7f8b-436c-8ac8-83af8f733e0f' + rootDirectory: '${{ github.workspace }}' + githubAuthToken: ${{ secrets.GITHUB_TOKEN }} + smartDeployment: 'true' + + steps: + - name: Login to Azure (Attempt 1) + continue-on-error: true + id: login1 + uses: azure/login@v1 + if: ${{ env.cloudEnv == 'AzureCloud' }} + with: + creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_1f22d4f27f8b436c8ac883af8f733e0f }} + enable-AzPSSession: true + + - name: Wait 30 seconds if login attempt 1 failed + if: ${{ env.cloudEnv == 'AzureCloud' && steps.login1.outcome=='failure' }} + run: powershell Start-Sleep -s 30 + + - name: Login to Azure (Attempt 2) + continue-on-error: true + id: login2 + uses: azure/login@v1 + if: ${{ env.cloudEnv == 'AzureCloud' && steps.login1.outcome=='failure' }} + with: + creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_1f22d4f27f8b436c8ac883af8f733e0f }} + enable-AzPSSession: true + + - name: Wait 30 seconds if login attempt 2 failed + if: ${{ env.cloudEnv == 'AzureCloud' && steps.login2.outcome=='failure' }} + run: powershell Start-Sleep -s 30 + + - name: Login to Azure (Attempt 3) + continue-on-error: false + id: login3 + uses: azure/login@v1 + if: ${{ env.cloudEnv == 'AzureCloud' && steps.login2.outcome=='failure' }} + with: + creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_1f22d4f27f8b436c8ac883af8f733e0f }} + enable-AzPSSession: true + + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy Content to Azure Sentinel + uses: azure/powershell@v1 + with: + azPSVersion: 'latest' + inlineScript: | + ${{ github.workspace }}//.github/workflows/azure-sentinel-deploy-1f22d4f2-7f8b-436c-8ac8-83af8f733e0f.ps1 \ No newline at end of file