-
-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (35 loc) · 1.59 KB
/
psrule-monitor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Run on manual trigger and every day at 6:00 AM UTC
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
name: Run module with log analytics
jobs:
run-psrule-monitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Install PSRule
run: |
# Install-Module -Name PSRule -Force -Scope CurrentUser -SkipPublisherCheck
Install-Module -Name PSRule.Monitor -Force -Scope CurrentUser -SkipPublisherCheck
shell: pwsh
- name: Run PSRule
run: |
Import-Module PSRule
Import-Module PSRule.Monitor
Import-Module ./src/PSRule.Rules.AzureDevOps/PSRule.Rules.AzureDevOps.psd1 -Force
Connect-AzDevOps -Organization ${{ secrets.ADO_ORGANIZATION }} -PAT ${{ secrets.ADO_PAT }}
New-Item -Path ./data -ItemType Directory -Force
Export-AzDevOpsOrganizationRuleData -OutputPath ./data
$result = Invoke-PSRule -InputPath ./data/ `
-Module "PSRule.Rules.AzureDevOps","PSRule.Monitor" `
-Format Detect -Culture en
$result | Send-PSRuleMonitorRecord -WorkspaceId $Env:PSRULE_CONFIGURATION_MONITOR_WORKSPACE_ID `
-SharedKey $Env:PSRULE_CONFIGURATION_MONITOR_WORKSPACE_KEY -LogName RjbTest
shell: pwsh
env:
PSRULE_CONFIGURATION_MONITOR_WORKSPACE_ID: ${{ secrets.PSRULE_CONFIGURATION_MONITOR_WORKSPACE_ID }}
PSRULE_CONFIGURATION_MONITOR_WORKSPACE_KEY: ${{ secrets.PSRULE_CONFIGURATION_MONITOR_WORKSPACE_KEY }}
PSRULE_CONVENTION_INCLUDE: "Monitor.LogAnalytics.Import"