Skip to content

Commit f14b0ee

Browse files
Merge branch 'main' into hadwa/add_azd_copilot_chat_mode
2 parents 334a97d + 2dc4446 commit f14b0ee

File tree

81 files changed

+1888
-908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1888
-908
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
"ghcr.io/devcontainers/features/python:1" : {},
88
"ghcr.io/devcontainers/features/powershell:1": {},
99
"ghcr.io/devcontainers/features/azure-cli:1": {},
10+
"ghcr.io/devcontainers/features/github-cli:1": {},
1011
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
1112
"ghcr.io/devcontainers/features/terraform:1": {
1213
"installTFsec": true
1314
},
1415
"ghcr.io/devcontainers/features/dotnet:2": {
15-
"version": "8.0"
16+
"version": "9.0"
1617
},
1718
"ghcr.io/azure/azure-dev/azd:latest": {
18-
"version": "1.18.1"
19+
"version": "1.20.0"
1920
},
2021
"./features/dev-tools": {}
2122
},
@@ -31,16 +32,15 @@
3132
"ms-vscode.makefile-tools",
3233
"DavidAnson.vscode-markdownlint",
3334
"golang.go",
34-
"azapi-vscode.azapi",
3535
"ms-azuretools.vscode-azureterraform",
3636
"terraform-linters.tflint-vscode",
37-
"microsoft-IsvExpTools.powerplatform-vscode",
3837
"ms-vscode.azurecli",
3938
"bierner.markdown-mermaid",
4039
"ms-dotnettools.csharp",
4140
"ms-dotnettools.vscode-dotnet-runtime"
42-
// Include other VSCode extensions if needed
43-
// Right click on an extension inside VSCode to add directly to devcontainer.json, or copy the extension ID
41+
42+
// Include other VSCode extensions if needed. Right click on an extension inside VSCode
43+
// to add directly to devcontainer.json, or copy the extension ID
4444
],
4545
"settings": {
4646
"terraform.languageServer.enable":true,

.devcontainer/features/dev-tools/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT license.
4+
25
set -eux
36

47
echo "Installing development tools for Copilot Studio with Azure AI Search..."

.devcontainer/postCreate.sh

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT license.
4+
25
set -eux
36

47
echo "Running post-create setup for interactive operations..."
@@ -10,21 +13,15 @@ tflint --init
1013

1114
# Install PowerApps CLI (Microsoft.PowerApps.CLI.Tool)
1215
echo "Installing PowerApps CLI..."
13-
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.43.6
16+
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.49.3
1417

1518
# Restore .NET packages including Microsoft.Agents.CopilotStudio.Client
1619
echo "Restoring .NET packages..."
17-
if [ -f "Directory.Build.props" ]; then
18-
dotnet restore
19-
echo ".NET packages restored successfully!"
20+
if [ -f "tests/Copilot/CopilotTests.csproj" ]; then
21+
dotnet restore tests/Copilot/CopilotTests.csproj
22+
echo "Copilot project packages restored successfully!"
2023
else
21-
# Fallback to individual project restore
22-
if [ -f "tests/Copilot/CopilotTests.csproj" ]; then
23-
dotnet restore tests/Copilot/CopilotTests.csproj
24-
echo "Copilot project packages restored successfully!"
25-
else
26-
echo "No .NET projects found, skipping package restore"
27-
fi
24+
echo "No .NET projects found, skipping package restore"
2825
fi
2926

3027
echo "Post-create setup completed successfully!"

.github/workflows/azure-dev-down.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
default: "eastus"
1515

1616
permissions:
17-
id-token: write
17+
id-token: write # Needed for OIDC Authentication
1818
contents: read
1919

2020
jobs:
@@ -26,19 +26,24 @@ jobs:
2626

2727
steps:
2828
- name: Checkout the branch ${{ github.ref_name }}
29-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3030
with:
3131
ref: ${{ github.ref_name }}
3232

3333
- name: Install azd
34-
uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0
34+
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
3535
with:
36-
version: '1.18.1' # Specify your desired azd version here
36+
version: '1.20.0' # Specify your desired azd version here
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
40+
with:
41+
node-version: '18.x'
3742

3843
- name: Install Terraform
3944
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
4045
with:
41-
terraform_version: 1.12.2
46+
terraform_version: 1.13.3
4247

4348
- name: Login to Azure with Federated Identity
4449
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
@@ -65,6 +70,7 @@ jobs:
6570
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
6671
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
6772
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
73+
RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }}
6874

6975
shell: bash
7076
run: |
@@ -74,7 +80,30 @@ jobs:
7480
azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME"
7581
azd env set RS_RESOURCE_GROUP "$RS_RESOURCE_GROUP"
7682
azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER"
83+
azd env set RESOURCE_TAGS "$RESOURCE_TAGS"
7784
7885
azd package # trigger prepackage hook to setup terraform provider
7986
azd provision --preview # https://github.com/Azure/azure-dev/issues/4317
8087
azd down --no-prompt --force --purge
88+
89+
- name: Purge Soft-Deleted Azure OpenAI Resources
90+
shell: bash
91+
run: |
92+
# Get the OpenAI resource name and location from environment outputs
93+
OPENAI_RESOURCE_NAME=$(azd env get-values --output json | jq -r '.openai_resource_name // empty')
94+
AZURE_REGION=$(azd env get-values --output json | jq -r '.primary_azure_region // empty')
95+
RESOURCE_GROUP=$(azd env get-values --output json | jq -r '.resource_group_name // empty')
96+
97+
# Only attempt to purge if we have the required information
98+
if [[ -n "$OPENAI_RESOURCE_NAME" && -n "$AZURE_REGION" ]]; then
99+
echo "Attempting to purge soft-deleted Azure OpenAI resource: $OPENAI_RESOURCE_NAME in $AZURE_REGION"
100+
101+
# Purge the soft-deleted Cognitive Services account (continue on error if resource not found)
102+
az cognitiveservices account purge \
103+
--location "$AZURE_REGION" \
104+
--resource-group "$RESOURCE_GROUP" \
105+
--name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged"
106+
else
107+
echo "OpenAI resource information not found in environment outputs. Skipping purge."
108+
fi
109+

.github/workflows/azure-dev.yml

Lines changed: 72 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,54 @@ on:
2020
# Set this to the mainline branch you are using
2121
branches:
2222
- main
23+
pull_request:
24+
# Run when pull requests are opened or updated
25+
branches:
26+
- main
27+
2328
# GitHub Actions workflow to deploy to Azure using azd
29+
# Ensure only one deployment runs at a time to prevent conflicts
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: false
2433

2534
permissions:
2635
actions: read # Needed for uploading SARIF reports
2736
security-events: write # Needed for uploading SARIF reports
28-
id-token: write
37+
id-token: write # Needed for OIDC Authentication
2938
contents: read
3039

3140

3241
jobs:
3342
build:
3443
runs-on: ${{ fromJson(vars.ACTIONS_RUNNER_NAME || '["ubuntu-latest"]') }}
3544
env:
36-
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || 'CICD' }}
45+
AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || (github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number)) || 'CICD' }}
3746
AZURE_LOCATION: ${{ github.event.inputs.azure_location || 'eastus' }}
3847

3948
steps:
40-
- name: Checkout the branch ${{ github.ref_name }}
41-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
- name: Checkout code
50+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4251
with:
43-
ref: ${{ github.ref_name }}
52+
persist-credentials: false
4453

4554
- name: Install azd
46-
uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0
55+
uses: Azure/setup-azd@cf638ffd167fc81e1851241a478a723c05fa9cb3 # v2.2.0
56+
with:
57+
version: '1.20.0' # Specify your desired azd version here
58+
59+
- name: Setup Node.js
60+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
61+
with:
62+
node-version: '18.x'
63+
64+
- name: Install Terraform
65+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
4766
with:
48-
version: '1.18.1' # Specify your desired azd version here
67+
terraform_version: 1.13.3
4968

5069
- name: Install TFLint
51-
uses: terraform-linters/setup-tflint@90f302c255ef959cbfb4bd10581afecdb7ece3e6 # v4.1.1
70+
uses: terraform-linters/setup-tflint@acd1575d3c037258ce5b2dd01379dc49ce24c6b7 # v6.2.0
5271
with:
5372
tflint_version: v0.58.1
5473
github_token: ${{ secrets.GITHUB_TOKEN }} # Used to avoid rate
@@ -76,9 +95,21 @@ jobs:
7695
echo "GitLeaks scan completed"
7796
7897
- name: Setup .NET SDK
79-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
80-
with:
81-
dotnet-version: '8.0.x'
98+
shell: bash
99+
run: |
100+
# Install .NET SDK to temp directory for self-hosted runners to avoid permission issues
101+
DOTNET_INSTALL_DIR="${{ runner.temp }}/dotnet"
102+
mkdir -p "$DOTNET_INSTALL_DIR"
103+
104+
# Download and run the dotnet-install script
105+
curl -sSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
106+
chmod +x dotnet-install.sh
107+
./dotnet-install.sh --channel 9.0 --install-dir "$DOTNET_INSTALL_DIR"
108+
rm dotnet-install.sh
109+
110+
# Add to PATH for subsequent steps
111+
echo "$DOTNET_INSTALL_DIR" >> $GITHUB_PATH
112+
echo "DOTNET_ROOT=$DOTNET_INSTALL_DIR" >> $GITHUB_ENV
82113
83114
- name: Install Power Platform Tools
84115
uses: microsoft/powerplatform-actions/actions-install@6c7b538671a040d11afd8ab94d77bfe3b3ed87e6 # v1.9.1
@@ -90,7 +121,7 @@ jobs:
90121
pac help
91122
92123
- name: Set Up Python
93-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # 5.6.0
124+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
94125
with:
95126
python-version: "3.x"
96127

@@ -123,6 +154,7 @@ jobs:
123154
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
124155

125156
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
157+
RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }}
126158

127159
GITHUB_PAT: ${{ secrets.MCS_RUNNER }}
128160
GITHUB_REPO_OWNER: ${{ github.repository_owner }}
@@ -135,6 +167,7 @@ jobs:
135167
azd config set auth.useAzCliAuth "true"
136168
azd env new "$AZURE_ENV_NAME" --location "$AZURE_LOCATION" --no-prompt
137169
azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER"
170+
azd env set RESOURCE_TAGS "$RESOURCE_TAGS"
138171
139172
azd env set RS_STORAGE_ACCOUNT "$RS_STORAGE_ACCOUNT"
140173
azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME"
@@ -168,8 +201,8 @@ jobs:
168201
with:
169202
sarif_file: ./checkov-results.sarif/results_sarif.sarif
170203

171-
- name: Azd down
172-
if: ${{ github.event.inputs.run_azd_down == 'true' }}
204+
- name: Destroy Infrastructure
205+
if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }}
173206
env:
174207
POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
175208
POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
@@ -187,13 +220,37 @@ jobs:
187220
RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }}
188221
RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }}
189222
RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }}
223+
RESOURCE_TAGS: ${{ vars.RESOURCE_TAGS }}
190224

191225
shell: bash
192226
run: |
193227
azd env set RS_STORAGE_ACCOUNT "$RS_STORAGE_ACCOUNT"
194228
azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME"
195229
azd env set RS_RESOURCE_GROUP "$RS_RESOURCE_GROUP"
196230
azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER"
231+
azd env set RESOURCE_TAGS "$RESOURCE_TAGS"
197232
198233
azd env select "$AZURE_ENV_NAME"
199-
azd down --no-prompt --force --purge
234+
azd down --no-prompt --force --purge
235+
236+
- name: Purge Soft-Deleted Azure OpenAI Resources
237+
if: ${{ github.event.inputs.run_azd_down == 'true' || github.event_name == 'pull_request' }}
238+
shell: bash
239+
run: |
240+
# Get the OpenAI resource name and location from environment outputs
241+
OPENAI_RESOURCE_NAME=$(azd env get-values --output json | jq -r '.openai_resource_name // empty')
242+
AZURE_REGION=$(azd env get-values --output json | jq -r '.primary_azure_region // empty')
243+
RESOURCE_GROUP=$(azd env get-values --output json | jq -r '.resource_group_name // empty')
244+
245+
# Only attempt to purge if we have the required information
246+
if [[ -n "$OPENAI_RESOURCE_NAME" && -n "$AZURE_REGION" ]]; then
247+
echo "Attempting to purge soft-deleted Azure OpenAI resource: $OPENAI_RESOURCE_NAME in $AZURE_REGION"
248+
249+
# Purge the soft-deleted Cognitive Services account (continue on error if resource not found)
250+
az cognitiveservices account purge \
251+
--location "$AZURE_REGION" \
252+
--resource-group "$RESOURCE_GROUP" \
253+
--name "$OPENAI_RESOURCE_NAME" || echo "Resource may not be in soft-delete state or already purged"
254+
else
255+
echo "OpenAI resource information not found in environment outputs. Skipping purge."
256+
fi

0 commit comments

Comments
 (0)