-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (43 loc) · 1.68 KB
/
ci.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
40
41
42
43
44
45
46
47
48
49
50
51
52
name: gh-secrets-ci
on:
pull_request:
paths-ignore:
- '**/README.md'
- '**/LICENSE'
- 'visuals/**'
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
id-token: write
jobs:
ci:
defaults:
run:
working-directory: scripts
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Print environment variables
run: |
Get-ChildItem -Path Env: -Recurse -Include AZURE_*,GITHUB_* | Sort-Object -Property Name | Format-Table -AutoSize | Out-String -Width 512
shell: pwsh
- name: Use Azure CLI
uses: azure/login@v1
with:
# Using OpenID Connect / Workload Identity
# Create credential with create_ci_service_principal.ps1
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Run Azure CLI commands to demonstrate we're logged in
run: |
echo "Service Principal object of AZURE_CLIENT_ID '${{ secrets.AZURE_CLIENT_ID }}':"
az ad sp list --filter "appId eq '${{ secrets.AZURE_CLIENT_ID }}'" --query "[0]" -o json
echo "These are subscriptions that AZURE_CLIENT_ID '${{ secrets.AZURE_CLIENT_ID }}' has access to:"
az account list --query "sort_by([].{Name:name, SubscriptionId:id}, &Name)" -o table
echo "These are resource groups that AZURE_CLIENT_ID '${{ secrets.AZURE_CLIENT_ID }}' has access to in '$(az account show --query name -o tsv)':"
az group list --query "sort_by([].{Name:name, ResourceId:id}, &Name)" -o table