Skip to content

Merge pull request #13 from mswantek68/feature/postreleaseupdates #13

Merge pull request #13 from mswantek68/feature/postreleaseupdates

Merge pull request #13 from mswantek68/feature/postreleaseupdates #13

name: DSPM Automation (OIDC)

Check failure on line 1 in .github/workflows/daga-automation-oidc.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/daga-automation-oidc.yml

Invalid workflow file

(Line: 15, Col: 18): Unrecognized named-value: 'runner'. Located at position 1 within expression: runner.temp, (Line: 40, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DAGA_M365_CERT_PFX != '', (Line: 65, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DAGA_M365_CERT_PFX != ''
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
run-automation:
runs-on: ubuntu-latest
env:
SPEC_PATH: ./spec.ci.json
CERT_PATH: ${{ runner.temp }}/daga-exo-cert.pfx
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Azure login (federated)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_FEDERATED_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_FEDERATED_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_FEDERATED_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: Write DSPM spec from secret
shell: pwsh
run: |
$spec = @'
${{ secrets.DAGA_SPEC_JSON }}
'@
if ([string]::IsNullOrWhiteSpace($spec)) {
throw 'DAGA_SPEC_JSON secret is empty or missing.'
}
$spec | Out-File -FilePath $env:SPEC_PATH -Encoding utf8
- name: Materialize Exchange certificate
if: ${{ secrets.DAGA_M365_CERT_PFX != '' }}
shell: pwsh
run: |
$bytes = [Convert]::FromBase64String('${{ secrets.DAGA_M365_CERT_PFX }}')
[System.IO.File]::WriteAllBytes('${{ env.CERT_PATH }}', $bytes)
- name: Install PowerShell modules
shell: pwsh
run: |
Install-Module Az -Scope CurrentUser -Force -AllowClobber
Install-Module Az.Security -Scope CurrentUser -Force -AllowClobber
Install-Module ExchangeOnlineManagement -Scope CurrentUser -Force
- name: Run DSPM accelerator
shell: pwsh
env:
DAGA_SPEC_PATH: ${{ env.SPEC_PATH }}
DAGA_M365_APP_ID: ${{ secrets.DAGA_M365_APP_ID }}
DAGA_M365_ORGANIZATION: ${{ secrets.DAGA_M365_ORGANIZATION }}
DAGA_M365_CERT_PATH: ${{ env.CERT_PATH }}
DAGA_M365_CERT_PASSWORD: ${{ secrets.DAGA_M365_CERT_PASSWORD }}
run: |
./run.ps1 -Tags all -SpecPath $env:DAGA_SPEC_PATH -ConnectM365
- name: Cleanup cert
if: ${{ secrets.DAGA_M365_CERT_PFX != '' }}
shell: pwsh
run: |
if (Test-Path '${{ env.CERT_PATH }}') {
Remove-Item '${{ env.CERT_PATH }}' -Force
}