Skip to content

Commit 4e6affa

Browse files
Workflow file for Sentinel-Deploy
1 parent d045c04 commit 4e6affa

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 logworkspace [b7c98d6c-4bb4-4c94-98fd-2b2fc95222c9]
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-b7c98d6c-4bb4-4c94-98fd-2b2fc95222c9.yml'
9+
# 2. Append the path to the directory environment variable below
10+
# directory: '${{ github.workspace }}/SentinelContent'
11+
12+
on:
13+
push:
14+
branches: [ BugFix ]
15+
paths:
16+
- '**'
17+
- '!.github/workflows/**' # this filter prevents other workflow changes from triggering this workflow
18+
- '.github/workflows/sentinel-deploy-b7c98d6c-4bb4-4c94-98fd-2b2fc95222c9.yml'
19+
20+
jobs:
21+
deploy-content:
22+
runs-on: windows-latest
23+
env:
24+
resourceGroupName: 'sentineldemo'
25+
workspaceName: 'logworkspace'
26+
workspaceId: '6202d0f0-3e8c-44a1-bc49-6f37e1b7fc99'
27+
directory: '${{ github.workspace }}'
28+
cloudEnv: 'AzureCloud'
29+
creds: ${{ secrets.AZURE_SENTINEL_CREDENTIALS_b7c98d6c4bb44c9498fd2b2fc95222c9 }}
30+
contentTypes: 'AnalyticsRule'
31+
branch: 'BugFix'
32+
sourceControlId: 'b7c98d6c-4bb4-4c94-98fd-2b2fc95222c9'
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_b7c98d6c4bb44c9498fd2b2fc95222c9 }}
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_b7c98d6c4bb44c9498fd2b2fc95222c9 }}
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_b7c98d6c4bb44c9498fd2b2fc95222c9 }}
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-b7c98d6c-4bb4-4c94-98fd-2b2fc95222c9.ps1

0 commit comments

Comments
 (0)