Skip to content

Commit 14ff5f2

Browse files
authored
chore: update action versions in workflows for consistency and stability (#216)
* chore: update action versions in workflows for consistency and stability * fix: add check for PAC CLI existence in Power Platform CLI test step * fix: add PAC CLI to PATH for proper execution in workflow * fix: change PAC command from version to help for better usage guidance * fix: update environment variables for Power Platform CLI usage in Azure deployment workflow * fix: comment out ARM_USE_OIDC in Azure deployment workflow for clarity * fix: comment out ARM_USE_AZUREAD for clarity in Azure deployment workflow * fix: comment out ARM_USE_AZUREAD and add secret for Azure login * fix: enable ARM_USE_AZUREAD and ARM_USE_OIDC for Azure deployment workflow * feat: add debug step to log environment variables and inputs in CI workflow * refactor: format debug step for environment variables and inputs in CI workflow * fix: escape variables in remote storage configuration for proper parsing * fix: add use_azuread_auth to remote storage configuration for improved authentication * fix: update remote storage configuration to set container access type to private * refactor: replace PowerShell with Bash for shell commands in CI workflow * chore: update CI workflow for improved efficiency and maintainability * fix: improve PAC CLI path detection in CI workflow * refactor: comment out PAC CLI path detection in CI workflow * refactor: comment out Power Platform CLI test step and update installation method * fix: specify version for Power Platform CLI installation * refactor: remove commented-out PAC CLI test and path detection steps * fix: add security-events permission for SARIF report uploads * fix: update environment variable syntax for azd commands * fix: correct condition for AZD down input and add debug echo step * refactor: remove debug echo step for AZD down input
1 parent 2cdfd50 commit 14ff5f2

File tree

7 files changed

+79
-80
lines changed

7 files changed

+79
-80
lines changed

.github/workflows/azure-dev.yml

Lines changed: 59 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ on:
2323
# GitHub Actions workflow to deploy to Azure using azd
2424

2525
permissions:
26+
actions: read # Needed for uploading SARIF reports
27+
security-events: write # Needed for uploading SARIF reports
2628
id-token: write
2729
contents: read
2830

@@ -37,23 +39,23 @@ jobs:
3739

3840
steps:
3941
- name: Checkout the branch ${{ github.ref_name }}
40-
uses: actions/checkout@v4
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4143
with:
4244
ref: ${{ github.ref_name }}
4345

4446
- name: Install azd
45-
uses: Azure/setup-azd@v2
47+
uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0
4648
with:
4749
version: '1.17.2' # Specify your desired azd version here
4850

4951
- name: Install Terraform
50-
uses: hashicorp/setup-terraform@v3
52+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
5153
with:
5254
terraform_version: 1.9.0
5355

5456

5557
- name: Install TFLint
56-
uses: terraform-linters/setup-tflint@v4
58+
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4.1.1
5759
with:
5860
tflint_version: v0.49.0
5961
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate
@@ -68,84 +70,80 @@ jobs:
6870
gitleaks version
6971
7072
- name: Setup .NET SDK
71-
uses: actions/setup-dotnet@v4
73+
uses: actions/setup-dotnet@55ec9447dda3d1cf6bd587150f3262f30ee10815 # v3.4.2
7274
with:
7375
dotnet-version: '8.0.x'
7476

77+
- name: Install Power Platform Tools
78+
uses: microsoft/powerplatform-actions/actions-install@51f663ea104eb227c3712215ceb2f82827d81c27 # v1.9.0
79+
7580
- name: Install Power Platform CLI
7681
run: |
77-
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
82+
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.44.2
7883
pac help
7984
85+
8086
- name: Set Up Python
81-
uses: actions/setup-python@v5
87+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # 5.6.0
8288
with:
8389
python-version: "3.x"
8490

8591
- name: Install Checkov
8692
run: pip install checkov
8793

88-
8994
- name: Login to Azure with Federated Identity
90-
uses: azure/login@v2
95+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
9196
with:
9297
client-id: ${{ vars.AZURE_CLIENT_ID }}
9398
tenant-id: ${{ vars.AZURE_TENANT_ID }}
9499
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
95100

96101
- name: Provision Infrastructure
97102
env:
98-
POWER_PLATFORM_USE_CLI: false
99-
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
100-
RS_STORAGE_ACCOUNT: ${{ vars.RS_STORAGE_ACCOUNT }}
101-
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
102-
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
103-
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
103+
POWER_PLATFORM_USE_OIDC: "true"
104+
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
105+
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
106+
104107
ARM_USE_AZUREAD: "true"
105108
ARM_STORAGE_USE_AZUREAD: "true"
106109
ARM_USE_OIDC: "true"
107110
ARM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
108111
ARM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
109112
ARM_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
110-
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
111-
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
112-
POWER_PLATFORM_USE_OIDC: "true"
113+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
114+
115+
RS_STORAGE_ACCOUNT: ${{ vars.RS_STORAGE_ACCOUNT }}
116+
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
117+
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
118+
119+
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
120+
113121
GITHUB_PAT: ${{ secrets.MCS_RUNNER }}
114122
GITHUB_REPO_OWNER: ${{ github.repository_owner }}
115123
GITHUB_REPO_NAME: ${{ github.event.repository.name }}
116124
GITHUB_RUNNER_IMAGE_NAME: "github-runner"
117125
GITHUB_RUNNER_IMAGE_TAG: "latest"
118126
GITHUB_RUNNER_IMAGE_BRANCH: ${{ github.ref_name }}
119-
shell: pwsh
127+
shell: bash
120128
run: |
121129
azd config set auth.useAzCliAuth "true"
122-
azd env new $env:AZURE_ENV_NAME --location $env:AZURE_LOCATION --no-prompt
123-
azd env set RESOURCE_SHARE_USER "$env:RESOURCE_SHARE_USER"
124-
azd env set POWER_PLATFORM_USE_CLI "false"
125-
126-
azd env set RS_STORAGE_ACCOUNT $env:RS_STORAGE_ACCOUNT
127-
azd env set RS_CONTAINER_NAME $env:RS_CONTAINER_NAME
128-
azd env set RS_RESOURCE_GROUP $env:RS_RESOURCE_GROUP
129-
130-
azd env set GITHUB_PAT $env:GITHUB_PAT
131-
azd env set GITHUB_REPO_OWNER $env:GITHUB_REPO_OWNER
132-
azd env set GITHUB_REPO_NAME $env:GITHUB_REPO_NAME
133-
azd env set GITHUB_RUNNER_IMAGE_NAME $env:GITHUB_RUNNER_IMAGE_NAME
134-
azd env set GITHUB_RUNNER_IMAGE_TAG $env:GITHUB_RUNNER_IMAGE_TAG
135-
azd env set GITHUB_RUNNER_IMAGE_BRANCH $env:GITHUB_RUNNER_IMAGE_BRANCH
130+
azd env new "$AZURE_ENV_NAME" --location "$AZURE_LOCATION" --no-prompt
131+
azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER"
136132
133+
azd env set RS_STORAGE_ACCOUNT "$RS_STORAGE_ACCOUNT"
134+
azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME"
135+
azd env set RS_RESOURCE_GROUP "$RS_RESOURCE_GROUP"
137136
138-
azd env set GITHUB_PAT $env:GITHUB_PAT
139-
azd env set GITHUB_REPO_OWNER $env:GITHUB_REPO_OWNER
140-
azd env set GITHUB_REPO_NAME $env:GITHUB_REPO_NAME
141-
azd env set GITHUB_RUNNER_IMAGE_NAME $env:GITHUB_RUNNER_IMAGE_NAME
142-
azd env set GITHUB_RUNNER_IMAGE_TAG $env:GITHUB_RUNNER_IMAGE_TAG
143-
azd env set GITHUB_RUNNER_IMAGE_BRANCH $env:GITHUB_RUNNER_IMAGE_BRANCH
137+
azd env set GITHUB_PAT "$GITHUB_PAT"
138+
azd env set GITHUB_REPO_OWNER "$GITHUB_REPO_OWNER"
139+
azd env set GITHUB_REPO_NAME "$GITHUB_REPO_NAME"
140+
azd env set GITHUB_RUNNER_IMAGE_NAME "$GITHUB_RUNNER_IMAGE_NAME"
141+
azd env set GITHUB_RUNNER_IMAGE_TAG "$GITHUB_RUNNER_IMAGE_TAG"
142+
azd env set GITHUB_RUNNER_IMAGE_BRANCH "$GITHUB_RUNNER_IMAGE_BRANCH"
144143
145144
azd provision --no-prompt
146145
147-
148-
- uses: actions/upload-artifact@v4
146+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
149147
if: success() || failure()
150148
with:
151149
name: sarif-reports
@@ -154,42 +152,42 @@ jobs:
154152
./checkov-results.sarif/results_sarif.sarif
155153
156154
- name: Upload Gitleaks SARIF report to Github
157-
uses: github/codeql-action/upload-sarif@v3
155+
uses: github/codeql-action/upload-sarif@9b02dc2f60288b463e7a66e39c78829b62780db7 # v2.22.1
158156
with:
159157
sarif_file: ./gitleaks-report.sarif
160158

161159

162160
- name: Upload Checkov SARIF Report to GitHub
163-
uses: github/codeql-action/upload-sarif@v3
161+
uses: github/codeql-action/upload-sarif@9b02dc2f60288b463e7a66e39c78829b62780db7 # v2.22.1
164162
with:
165163
sarif_file: ./checkov-results.sarif/results_sarif.sarif
166164

167-
168165
- name: Azd down
169-
if: ${{ github.event.inputs.run_azd_down == true }}
166+
if: ${{ github.event.inputs.run_azd_down == 'true' }}
170167
env:
171-
POWER_PLATFORM_USE_CLI: false
172-
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
173-
RS_STORAGE_ACCOUNT: ${{ vars.RS_STORAGE_ACCOUNT }}
174-
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
175-
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
176-
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
168+
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
169+
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
170+
POWER_PLATFORM_USE_OIDC: "true"
171+
177172
ARM_USE_AZUREAD: "true"
178173
ARM_STORAGE_USE_AZUREAD: "true"
179174
ARM_USE_OIDC: "true"
180175
ARM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
181176
ARM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
182177
ARM_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
183-
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
184-
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
185-
POWER_PLATFORM_USE_OIDC: "true"
186-
shell: pwsh
187-
run: |
178+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
188179

189-
azd env set RS_STORAGE_ACCOUNT $env:RS_STORAGE_ACCOUNT
190-
azd env set RS_CONTAINER_NAME $env:RS_CONTAINER_NAME
191-
azd env set RS_RESOURCE_GROUP $env:RS_RESOURCE_GROUP
192-
azd env set RESOURCE_SHARE_USER "$env:RESOURCE_SHARE_USER"
180+
RS_STORAGE_ACCOUNT: ${{ vars.RS_STORAGE_ACCOUNT }}
181+
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
182+
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
183+
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
184+
185+
shell: bash
186+
run: |
187+
azd env set RS_STORAGE_ACCOUNT "$RS_STORAGE_ACCOUNT"
188+
azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME"
189+
azd env set RS_RESOURCE_GROUP "$RS_RESOURCE_GROUP"
190+
azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER"
193191
194-
azd env select $env:AZURE_ENV_NAME
192+
azd env select "$AZURE_ENV_NAME"
195193
azd down --no-prompt --force --purge

.github/workflows/terraform-validate.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Setup Terraform
5353
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
5454
with:
55-
terraform_version: "1.12.2" # Pinning specific version is recommended
55+
terraform_version: "1.9.0" # Pinning specific version
5656

5757
- name: Terraform Init
5858
id: tf-init
@@ -89,7 +89,7 @@ jobs:
8989
working-directory: ./infra
9090

9191
- name: Setup TFLint
92-
uses: terraform-linters/setup-tflint@v4
92+
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4.1.1
9393
with:
9494
tflint_version: v0.49.0 # Specify a version (recommended)
9595
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate limiting
@@ -121,7 +121,7 @@ jobs:
121121

122122
- name: GitLeaks Scan
123123
id: gitleaks
124-
uses: gitleaks/gitleaks-action@v2
124+
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
125125
env:
126126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127127
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
@@ -132,7 +132,7 @@ jobs:
132132

133133
- name: Upload GitLeaks SARIF report
134134
if: success() || failure() # Upload even if GitLeaks finds issues
135-
uses: github/codeql-action/upload-sarif@v3
135+
uses: github/codeql-action/upload-sarif@9b02dc2f60288b463e7a66e39c78829b62780db7 # v2.22.1
136136
with:
137137
directory: ./ # Ensure the report path is correct
138138
sarif_file: results.sarif
@@ -151,7 +151,7 @@ jobs:
151151

152152
- name: Upload Checkov SARIF report
153153
if: success() || failure() # Upload even if Checkov finds issues
154-
uses: github/codeql-action/upload-sarif@v3
154+
uses: github/codeql-action/upload-sarif@9b02dc2f60288b463e7a66e39c78829b62780db7 # v2.22.1
155155
env:
156156
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157157
with:

.github/workflows/test-runner.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout the branch ${{ github.ref_name }}
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4343
with:
4444
ref: ${{ github.ref_name }}
4545

@@ -110,7 +110,7 @@ jobs:
110110
continue-on-error: true # Continue even if tests fail to ensure artifacts are uploaded
111111

112112
- name: Upload test results as workflow artifact
113-
uses: actions/upload-artifact@v4
113+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
114114
if: (!cancelled()) # Upload artifacts even if tests fail
115115
with:
116116
name: pytest-test-results
@@ -120,7 +120,7 @@ jobs:
120120
retention-days: 30
121121

122122
- name: Publish pytest test results
123-
uses: dorny/test-reporter@v2
123+
uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3 # v2.1.1
124124
if: (!cancelled()) # Run even if tests fail
125125
with:
126126
name: Azure AI Search E2E Tests

azd-hooks/scripts/hooks/preprovision/run_preconfig.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ function Initialize-RemoteStorage {
8282

8383
$remoteStorageConfig = @"
8484
{
85-
"storage_account_name": "${RS_STORAGE_ACCOUNT}",
86-
"container_name": "${RS_CONTAINER_NAME}",
87-
"key": "azd/${AZURE_ENV_NAME}/terraform.tfstate",
88-
"resource_group_name": "${RS_RESOURCE_GROUP}"
85+
"storage_account_name": "`${RS_STORAGE_ACCOUNT}`",
86+
"container_name": "`${RS_CONTAINER_NAME}`",
87+
"key": "azd/`${AZURE_ENV_NAME}`/terraform.tfstate",
88+
"resource_group_name": "`${RS_RESOURCE_GROUP}`",
89+
"use_azuread_auth": "true"
8990
}
9091
"@
9192
Set-Content -Path $script:providerConfPath -Value $remoteStorageConfig -Encoding UTF8

docs/advanced_scenarios.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ Set the following environment variables for GitHub runner deployment:
7575
# GitHub configuration
7676
### Set the remote state configurations (reusing variables from step 5):
7777

78-
azd env set RS_STORAGE_ACCOUNT $STORAGE_ACCOUNT_NAME
79-
azd env set RS_CONTAINER_NAME $CONTAINER_NAME
80-
azd env set RS_RESOURCE_GROUP $RESOURCE_GROUP_NAME
78+
azd env set RS_STORAGE_ACCOUNT $STORAGE_ACCOUNT_NAME
79+
azd env set RS_CONTAINER_NAME $CONTAINER_NAME
80+
azd env set RS_RESOURCE_GROUP $RESOURCE_GROUP_NAME
8181
azd env set GITHUB_RUNNER_IMAGE_BRANCH "<branch-containing-docker-file>" # optional, defaults to "main"
8282
azd env set GITHUB_RUNNER_GROUP "<github-runner-group>" # optional, defaults to "default"
8383

docs/github_self_hosted_deployment.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ Set the following environment variables for GitHub runner deployment:
7575
# GitHub configuration
7676
### Set the remote state configurations (reusing variables from step 5):
7777

78-
azd env set RS_STORAGE_ACCOUNT $STORAGE_ACCOUNT_NAME
79-
azd env set RS_CONTAINER_NAME $CONTAINER_NAME
80-
azd env set RS_RESOURCE_GROUP $RESOURCE_GROUP_NAME
78+
azd env set RS_STORAGE_ACCOUNT $STORAGE_ACCOUNT_NAME
79+
azd env set RS_CONTAINER_NAME $CONTAINER_NAME
80+
azd env set RS_RESOURCE_GROUP $RESOURCE_GROUP_NAME
8181
azd env set GITHUB_RUNNER_IMAGE_BRANCH "<branch-containing-docker-file>" # optional, defaults to "main"
8282
azd env set GITHUB_RUNNER_GROUP "<github-runner-group>" # optional, defaults to "default"
8383

infra/main.search_configuration.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ resource "azurerm_storage_container" "scripts" {
278278
# checkov:skip=CKV2_AZURE_21: Logging not needed for temporary deployment scripts container
279279
name = "scripts"
280280
storage_account_id = azurerm_storage_account.deployment_container.id
281-
container_access_type = "blob"
281+
container_access_type = "private"
282282

283283
depends_on = [
284284
azurerm_storage_account.deployment_container,

0 commit comments

Comments
 (0)