Skip to content

Commit ceb3425

Browse files
Workflow file for Sentinel-Deploy
1 parent 8875868 commit ceb3425

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Deploy Content to testgithubrepo [e66b44f5-0bd1-458b-9b32-39f9c43e9e2c]
2+
# Note: This workflow will deploy everything in the root directory.
3+
# To deploy content only from a specific path (for example SentinelContent):
4+
# 1. Add the target path to the "paths" property like such
5+
# paths:
6+
# - 'SentinelContent/**'
7+
# - '!.github/workflows/**'
8+
# - '.github/workflows/sentinel-deploy-e66b44f5-0bd1-458b-9b32-39f9c43e9e2c.yml'
9+
# 2. Append the path to the directory environment variable below
10+
# directory: '${{ github.workspace }}/SentinelContent'
11+
12+
on:
13+
push:
14+
branches: [ Testbranch ]
15+
paths:
16+
- '**'
17+
- '!.github/workflows/**' # this filter prevents other workflow changes from triggering this workflow
18+
- '.github/workflows/sentinel-deploy-e66b44f5-0bd1-458b-9b32-39f9c43e9e2c.yml'
19+
20+
jobs:
21+
deploy-content:
22+
runs-on: windows-latest
23+
env:
24+
resourceGroupName: 'sentineldemo'
25+
workspaceName: 'testgithubrepo'
26+
workspaceId: '2bfb904e-111d-4728-90e3-7f83b9e9f0a3'
27+
directory: '${{ github.workspace }}'
28+
cloudEnv: 'AzureCloud'
29+
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_e66b44f50bd1458b9b3239f9c43e9e2c }}
30+
contentTypes: 'AnalyticsRule,Playbook,Workbook'
31+
branch: 'Testbranch'
32+
sourceControlId: 'e66b44f5-0bd1-458b-9b32-39f9c43e9e2c'
33+
rootDirectory: '${{ github.workspace }}'
34+
githubAuthToken: ${{ secrets.GITHUB_TOKEN }}
35+
smartDeployment: 'true'
36+
permissions:
37+
contents: write
38+
39+
steps:
40+
- name: Login to Azure (Attempt 1)
41+
continue-on-error: true
42+
id: login1
43+
uses: azure/login@v2
44+
if: ${{ env.cloudEnv == 'AzureCloud' }}
45+
with:
46+
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_e66b44f50bd1458b9b3239f9c43e9e2c }}
47+
enable-AzPSSession: true
48+
49+
- name: Wait 30 seconds if login attempt 1 failed
50+
if: ${{ env.cloudEnv == 'AzureCloud' && steps.login1.outcome=='failure' }}
51+
run: powershell Start-Sleep -s 30
52+
53+
- name: Login to Azure (Attempt 2)
54+
continue-on-error: true
55+
id: login2
56+
uses: azure/login@v2
57+
if: ${{ env.cloudEnv == 'AzureCloud' && steps.login1.outcome=='failure' }}
58+
with:
59+
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_e66b44f50bd1458b9b3239f9c43e9e2c }}
60+
enable-AzPSSession: true
61+
62+
- name: Wait 30 seconds if login attempt 2 failed
63+
if: ${{ env.cloudEnv == 'AzureCloud' && steps.login2.outcome=='failure' }}
64+
run: powershell Start-Sleep -s 30
65+
66+
- name: Login to Azure (Attempt 3)
67+
continue-on-error: false
68+
id: login3
69+
uses: azure/login@v2
70+
if: ${{ env.cloudEnv == 'AzureCloud' && steps.login2.outcome=='failure' }}
71+
with:
72+
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_e66b44f50bd1458b9b3239f9c43e9e2c }}
73+
enable-AzPSSession: true
74+
75+
- name: Checkout
76+
uses: actions/checkout@v3
77+
78+
- name: Deploy Content to Microsoft Sentinel
79+
uses: azure/powershell@v1
80+
with:
81+
azPSVersion: 'latest'
82+
inlineScript: |
83+
${{ github.workspace }}//.github/workflows/azure-sentinel-deploy-e66b44f5-0bd1-458b-9b32-39f9c43e9e2c.ps1

0 commit comments

Comments
 (0)