Skip to content

Commit

Permalink
Workflow file for Sentinel-Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-sentinel-dev[bot] authored Nov 2, 2023
1 parent 48e6da3 commit 562430e
Showing 1 changed file with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Deploy Content to TestWkSpace [d8c5ebf1-0027-4963-9a90-14ee7ad076cb]
# 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-d8c5ebf1-0027-4963-9a90-14ee7ad076cb.yml'
# 2. Append the path to the directory environment variable below
# directory: '${{ github.workspace }}/SentinelContent'

on:
push:
branches: [ main_SentinelExport_1676594102 ]
paths:
- '**'
- '!.github/workflows/**' # this filter prevents other workflow changes from triggering this workflow
- '.github/workflows/sentinel-deploy-d8c5ebf1-0027-4963-9a90-14ee7ad076cb.yml'

jobs:
deploy-content:
runs-on: windows-latest
env:
resourceGroupName: 'newecotestrg2'
workspaceName: 'TestWkSpace'
workspaceId: 'd67b16c8-7718-48cc-bb81-6b1d47ccbc3f'
directory: '${{ github.workspace }}'
cloudEnv: 'AzurePPE'
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_d8c5ebf1002749639a9014ee7ad076cb }}
contentTypes: 'AnalyticsRule,Playbook'
branch: 'main_SentinelExport_1676594102'
sourceControlId: 'd8c5ebf1-0027-4963-9a90-14ee7ad076cb'
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_d8c5ebf1002749639a9014ee7ad076cb }}
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_d8c5ebf1002749639a9014ee7ad076cb }}
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_d8c5ebf1002749639a9014ee7ad076cb }}
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-d8c5ebf1-0027-4963-9a90-14ee7ad076cb.ps1

0 comments on commit 562430e

Please sign in to comment.