Skip to content
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1a8347f
model deployment when reusing existing foundry
Priyanka-Microsoft Jul 25, 2025
383706b
change model deployment name
Priyanka-Microsoft Jul 25, 2025
5ccc7c1
removed system managed identity code
Priyanka-Microsoft Jul 28, 2025
99ad169
seggregated the files
Priyanka-Microsoft Jul 30, 2025
e0747b2
fix: Updated file names
Prajwal-Microsoft Aug 1, 2025
d604cea
Resolved main json commit
Priyanka-Microsoft Aug 1, 2025
d4065d5
Merge pull request #621 from microsoft/model-deployment-resusing-exis…
Prajwal-Microsoft Aug 1, 2025
dc627e4
chore: down merging main into dev (#638)
Rafi-Microsoft Aug 6, 2025
c509549
added for cross-subscription existing AI project resource ID
Kanchan-Microsoft Aug 7, 2025
ad9ba63
update
Kanchan-Microsoft Aug 7, 2025
18f3e78
fix: agent cleanup (#639)
Shreyas-Microsoft Aug 7, 2025
0f8ccc5
TS( 21657) Bicep Standard code changes
Bangarraju-Microsoft Aug 8, 2025
d499936
Merge branch 'dev' of https://github.com/microsoft/Build-your-own-cop…
Bangarraju-Microsoft Aug 8, 2025
e8a113f
Added required env variables for local debugging in .env generated by…
Prasanjeet-Microsoft Aug 8, 2025
12b99bb
Merge pull request #642 from microsoft/PSL-US-21463
Prajwal-Microsoft Aug 8, 2025
2c17025
Added "Required/Optional" and changed aiProjectName suffix.
Bangarraju-Microsoft Aug 8, 2025
51df269
removed location tag
Bangarraju-Microsoft Aug 8, 2025
f9dbf41
Merge branch 'dev' into psl-bug-21342
Kanchan-Microsoft Aug 11, 2025
f202b60
foundry project documentation
Kanchan-Microsoft Aug 11, 2025
313f6e3
Merge branch 'psl-bug-21342' of https://github.com/microsoft/Build-yo…
Kanchan-Microsoft Aug 11, 2025
8b24bca
corrected name
Kanchan-Microsoft Aug 11, 2025
b0e5161
Merge branch 'dev' of https://github.com/microsoft/Build-your-own-cop…
Bangarraju-Microsoft Aug 11, 2025
d455118
updated CAdeploy.yml
Kanchan-Microsoft Aug 11, 2025
a8e25dd
update CAdeploy.yml
Kanchan-Microsoft Aug 11, 2025
2f89864
Merge pull request #640 from microsoft/psl-bug-21342
Prajwal-Microsoft Aug 11, 2025
1df9fc6
changed pipeline variable
Bangarraju-Microsoft Aug 11, 2025
1166aa8
Merge pull request #644 from microsoft/main
Prajwal-Microsoft Aug 12, 2025
d9c999d
Merge branch 'dev' of https://github.com/microsoft/Build-your-own-cop…
Bangarraju-Microsoft Aug 12, 2025
a911f20
updated main.json file
Bangarraju-Microsoft Aug 12, 2025
d3ed0ee
updated yml file
Bangarraju-Microsoft Aug 12, 2025
0742080
test
Kanchan-Microsoft Aug 12, 2025
edd0c97
test
Kanchan-Microsoft Aug 12, 2025
9b812cc
update
Kanchan-Microsoft Aug 12, 2025
a2328c0
update
Kanchan-Microsoft Aug 12, 2025
b84cd26
test
Kanchan-Microsoft Aug 12, 2025
f4b5b14
update CAdeploy.yml
Kanchan-Microsoft Aug 13, 2025
6f083ea
Merge pull request #645 from microsoft/git-actions
Prajwal-Microsoft Aug 13, 2025
fe7c161
CustomizingAzdparamMd
UtkarshMishra-Microsoft Aug 13, 2025
7c5b9d4
Merge pull request #647 from microsoft/customizemd
Prajwal-Microsoft Aug 13, 2025
c317d43
Merge pull request #643 from microsoft/PSLRJ-TS-21657
Prajwal-Microsoft Aug 13, 2025
c38e7a9
deploymentMdUpdate
UtkarshMishra-Microsoft Aug 14, 2025
55aa714
Updated
UtkarshMishra-Microsoft Aug 14, 2025
45fd259
Merge pull request #648 from microsoft/deploymentMd
Prajwal-Microsoft Aug 14, 2025
39e0085
Update infra/main.bicep
Prasanjeet-Microsoft Aug 18, 2025
a1b363d
Update src/App/backend/plugins/chat_with_data_plugin.py
Prasanjeet-Microsoft Aug 18, 2025
4f81d2a
Update infra/main.bicep
Prasanjeet-Microsoft Aug 18, 2025
12ca750
Revert Copilot suggestion: `and project_client` is unnecessary.
Prasanjeet-Microsoft Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 11 additions & 35 deletions .github/workflows/CAdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- dev
- demo
schedule:
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
- cron: "0 6,18 * * *" # Runs at 6:00 AM and 6:00 PM GMT

env:
GPT_MIN_CAPACITY: 200
Expand All @@ -29,7 +29,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install ODBC Driver 18 for SQL Server
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Expand Down Expand Up @@ -81,7 +80,6 @@ jobs:

- name: Install Bicep CLI
run: az bicep install

- name: Set Deployment Region
id: set_region
run: |
Expand All @@ -98,7 +96,6 @@ jobs:
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"

- name: Check and Create Resource Group
id: check_create_rg
run: |
Expand All @@ -114,7 +111,6 @@ jobs:
fi
# Set output for other jobs
echo "RESOURCE_GROUP_NAME=${{ env.RESOURCE_GROUP_NAME }}" >> $GITHUB_OUTPUT

- name: Generate Unique Solution Prefix
id: generate_solution_prefix
run: |
Expand All @@ -137,7 +133,6 @@ jobs:
else TAG="latest"; fi
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
echo "Image Tag: $TAG"

- name: Deploy and extract values from deployment output
id: get_output
run: |
Expand All @@ -149,19 +144,17 @@ jobs:
DEPLOY_OUTPUT=$(az deployment group create \
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
--template-file infra/main.bicep \
--parameters aiDeploymentsLocation=${{ env.AZURE_LOCATION }} environmentName=${{ env.SOLUTION_PREFIX }} cosmosLocation=westus gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} imageTag=${{ env.IMAGE_TAG }} \
--parameters aiDeploymentsLocation=${{ env.AZURE_LOCATION }} solutionName=${{ env.SOLUTION_PREFIX }} cosmosLocation=westus gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} imageTag=${{ env.IMAGE_TAG }} \
--query "properties.outputs" -o json)



echo "Deployment output: $DEPLOY_OUTPUT"
if [[ -z "$DEPLOY_OUTPUT" ]]; then
echo "Error: Deployment output is empty. Please check the deployment logs."
exit 1
fi

export AI_FOUNDARY_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.aI_FOUNDRY_NAME.value')
echo "AI_FOUNDARY_NAME=$AI_FOUNDARY_NAME" >> $GITHUB_ENV
export AI_FOUNDRY_RESOURCE_ID=$(echo "$DEPLOY_OUTPUT" | jq -r '.aI_FOUNDRY_RESOURCE_ID.value')
echo "AI_FOUNDRY_RESOURCE_ID=$AI_FOUNDRY_RESOURCE_ID" >> $GITHUB_ENV
export SEARCH_SERVICE_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.aI_SEARCH_SERVICE_NAME.value')
echo "SEARCH_SERVICE_NAME=$SEARCH_SERVICE_NAME" >> $GITHUB_ENV
export COSMOS_DB_ACCOUNT_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.cosmosdB_ACCOUNT_NAME.value')
Expand All @@ -172,8 +165,8 @@ jobs:
echo "STORAGE_CONTAINER=$STORAGE_CONTAINER" >> $GITHUB_ENV
export KEYVAULT_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.keY_VAULT_NAME.value')
echo "KEYVAULT_NAME=$KEYVAULT_NAME" >> $GITHUB_ENV
export SQL_SERVER=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_SERVER.value')
echo "SQL_SERVER=$SQL_SERVER" >> $GITHUB_ENV
export SQL_SERVER_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_SERVER_NAME.value')
echo "SQL_SERVER_NAME=$SQL_SERVER_NAME" >> $GITHUB_ENV
export SQL_DATABASE=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_DATABASE.value')
echo "SQL_DATABASE=$SQL_DATABASE" >> $GITHUB_ENV
export CLIENT_ID=$(echo "$DEPLOY_OUTPUT" | jq -r '.managedidentitY_WEBAPP_CLIENTID.value')
Expand All @@ -182,8 +175,6 @@ jobs:
echo "CLIENT_NAME=$CLIENT_NAME" >> $GITHUB_ENV
export RG_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.resourcE_GROUP_NAME.value')
echo "RG_NAME=$RG_NAME" >> $GITHUB_ENV
export RESOURCE_GROUP_NAME_FOUNDRY=$(echo "$DEPLOY_OUTPUT" | jq -r '.resourcE_GROUP_NAME_FOUNDRY.value')
echo "RESOURCE_GROUP_NAME_FOUNDRY=$RESOURCE_GROUP_NAME_FOUNDRY" >> $GITHUB_ENV
WEBAPP_URL=$(echo $DEPLOY_OUTPUT | jq -r '.weB_APP_URL.value')
echo "WEBAPP_URL=$WEBAPP_URL" >> $GITHUB_OUTPUT
WEB_APP_NAME=$(echo $DEPLOY_OUTPUT | jq -r '.weB_APP_NAME.value')
Expand All @@ -195,9 +186,7 @@ jobs:

sleep 30



- name: Deploy Infra and Import Sample Data
- name: Deploy Infra and Import Sample Data
run: |
set -e
az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
Expand All @@ -220,10 +209,9 @@ jobs:
"" \
"${{ secrets.AZURE_CLIENT_ID }}" \
"${{ env.RG_NAME }}" \
"${{ env.SQL_SERVER }}" \
"${{ env.AI_FOUNDARY_NAME }}" \
"${{ env.SQL_SERVER_NAME }}" \
"${{ env.SEARCH_SERVICE_NAME }}" \
"${{ env.RESOURCE_GROUP_NAME_FOUNDRY }}"
"${{ env.AI_FOUNDRY_RESOURCE_ID}}"


user_roles_json='[
Expand All @@ -232,13 +220,11 @@ jobs:
]'

bash ./infra/scripts/add_user_scripts/create_sql_user_and_role.sh \
"${{ env.SQL_SERVER }}.database.windows.net" \
"${{ env.SQL_SERVER_NAME }}.database.windows.net" \
"${{ env.SQL_DATABASE }}" \
"$user_roles_json" \
"${{ secrets.AZURE_CLIENT_ID }}"

echo "=== Post-Deployment Script Completed Successfully ==="


- name: Get AI Services name and store in variable
if: always() && steps.check_create_rg.outcome == 'success'
Expand All @@ -262,7 +248,6 @@ jobs:
run: |
set -e
echo "Listing all KeyVaults in the resource group ${{ env.RESOURCE_GROUP_NAME }}..."

# Get the list of KeyVaults in the specified resource group
keyvaults=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --query "[?type=='Microsoft.KeyVault/vaults'].name" -o tsv)

Expand All @@ -288,7 +273,6 @@ jobs:
# Output the formatted array and save it to the job output
echo "KEYVAULTS=$keyvault_array" >> $GITHUB_OUTPUT
fi

- name: Set Deployment Status
id: deployment_status
if: always()
Expand All @@ -312,7 +296,7 @@ jobs:
secrets: inherit

cleanup:
if: always()
if: always()
needs: [deploy, e2e-test]
runs-on: ubuntu-latest
env:
Expand All @@ -336,12 +320,10 @@ jobs:
set -e
echo "Checking if resource group exists..."
echo "Resource group name: ${{ env.RESOURCE_GROUP_NAME }}"

if [ -z "${{ env.RESOURCE_GROUP_NAME }}" ]; then
echo "Resource group name is empty. Skipping deletion."
exit 0
fi

rg_exists=$(az group exists --name "${{ env.RESOURCE_GROUP_NAME }}")
if [ "$rg_exists" = "true" ]; then
echo "Resource group exists. Cleaning..."
Expand All @@ -368,12 +350,9 @@ jobs:

# Remove the surrounding square brackets and quotes, if they exist
stripped_keyvaults=$(echo "$KEYVAULTS" | sed 's/\[\|\]//g' | sed 's/"//g')

# Convert the comma-separated string into an array
IFS=',' read -r -a resources_to_check <<< "$stripped_keyvaults"

echo "List of resources to check: ${resources_to_check[@]}"

# Check if resource group still exists before listing resources
rg_exists=$(az group exists --name "${{ env.RESOURCE_GROUP_NAME }}")
if [ "$rg_exists" = "false" ]; then
Expand Down Expand Up @@ -472,7 +451,6 @@ jobs:

# Remove the surrounding square brackets and quotes, if they exist
stripped_keyvaults=$(echo "$KEYVAULTS" | sed 's/\[\|\]//g' | sed 's/"//g')

# Convert the comma-separated string into an array
IFS=',' read -r -a keyvault_array <<< "$stripped_keyvaults"

Expand Down Expand Up @@ -506,15 +484,13 @@ jobs:
if: failure() || needs.deploy.result == 'failure' || needs.e2e-test.result == 'failure'
run: |
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

# Construct the email body
EMAIL_BODY=$(cat <<EOF
{
"body": "<p>Dear Team,</p><p>We would like to inform you that the Build-your-own-copilot-Solution-Accelerator(Client Advisior) Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
}
EOF
)

# Send the notification
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
-H "Content-Type: application/json" \
Expand Down
2 changes: 1 addition & 1 deletion docs/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ By default this template will use the environment name as the prefix to prevent
| `AZURE_ENV_EMBEDDING_MODEL_NAME` | string | `text-embedding-ada-002` | Set the model name used for embeddings. |
| `AZURE_ENV_EMBEDDING_MODEL_CAPACITY` | integer | `80` | Set the capacity for embedding model deployment. |
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the image tag (allowed values: `latest`, `dev`, `hotfix`). |
| `AZURE_LOCATION` | string | `japaneast` | Sets the Azure region for resource deployment. |
| `AZURE_LOCATION` | string | `<User selects during deployment>` | Sets the Azure region for resource deployment. |
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | Guide to get your [Existing Workspace ID](/docs/re-use-log-analytics.md) | Reuses an existing Log Analytics Workspace instead of provisioning a new one. |
| `AZURE_EXISTING_AI_PROJECT_RESOURCE_ID` | string | `<Existing AI Foundry Project Resource Id>` | Reuses an existing AI Foundry Project Resource Id instead of provisioning a new one. |

Expand Down
9 changes: 8 additions & 1 deletion docs/DeploymentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ When you start the deployment, most parameters will have **default values**, but
| **Embedding Model Capacity** | Set the capacity for **embedding models**. Choose based on usage and quota. | `80` |
| **Image Tag** | The version of the Docker image to use (e.g., `latest`, `dev`, `hotfix`). | `latest` |
| **Azure OpenAI API Version** | Set the API version for OpenAI model deployments. | `2025-04-01-preview` |
| **AZURE\_LOCATION** | Sets the Azure region for resource deployment. | `japaneast` |
| **AZURE_LOCATION** | Sets the Azure region for resource deployment. | `<User selects during deployment>` |
| **Existing Log Analytics Workspace** | To reuse an existing Log Analytics Workspace ID instead of creating a new one. | *(empty)* |
| **Existing AI Foundry Project Resource ID** | To reuse an existing AI Foundry Project Resource ID instead of creating a new one. | *(empty)* |

Expand All @@ -143,6 +143,13 @@ To adjust quota settings, follow these [steps](./AzureGPTQuotaSettings.md).

Guide to get your [Existing Workspace ID](/docs/re-use-log-analytics.md)

</details>
<details>

<summary><b>Reusing an Existing Azure AI Foundry Project</b></summary>

Guide to get your [Existing Project ID](/docs/re-use-foundry-project.md)

</details>

### Deploying with AZD
Expand Down
5 changes: 4 additions & 1 deletion docs/LocalSetupAndDeploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Navigate to the `App` folder located in the `src` directory of the repository us

### 2. Configure Environment Variables
- Copy the `.env.sample` file to a new file named `.env`.
- Update the `.env` file with the required values from your Azure resource group.
- Update the `.env` file with the required values from your Azure resource group in Azure Portal App Service environment variables.
- Alternatively, if resources were
provisioned using `azd provision` or `azd up`, a `.env` file is automatically generated in the `.azure/<env-name>/.env`
file. To get your `<env-name>` run `azd env list` to see which env is default.

### 3. Start the Application
- Run `start.cmd` (Windows) or `start.sh` (Linux/Mac) to:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions docs/re-use-foundry-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[← Back to *DEPLOYMENT* guide](/docs/DeploymentGuide.md#deployment-options--steps)

# Reusing an Existing Azure AI Foundry Project
To configure your environment to use an existing Azure AI Foundry Project, follow these steps:
---
### 1. Go to Azure Portal
Go to https://portal.azure.com

### 2. Search for Azure AI Foundry
In the search bar at the top, type "Azure AI Foundry" and click on it. Then select the Foundry service instance where your project exists.

![alt text](../docs/images/re_use_foundry_project/azure_ai_foundry_list.png)

### 3. Navigate to Projects under Resource Management
On the left sidebar of the Foundry service blade:

- Expand the Resource Management section
- Click on Projects (this refers to the active Foundry project tied to the service)

### 4. Click on the Project
From the Projects view: Click on the project name to open its details

Note: You will see only one project listed here, as each Foundry service maps to a single project in this accelerator

![alt text](../docs/images/re_use_foundry_project/navigate_to_projects.png)

### 5. Copy Resource ID
In the left-hand menu of the project blade:

- Click on Properties under Resource Management
- Locate the Resource ID field
- Click on the copy icon next to the Resource ID value

![alt text](../docs/images/re_use_foundry_project/project_resource_id.png)

### 6. Set the Foundry Project Resource ID in Your Environment
Run the following command in your terminal
```bash
azd env set AZURE_EXISTING_AI_PROJECT_RESOURCE_ID '<Existing AI Project Resource ID>'
```
Replace `<Existing AI Project Resource ID>` with the value obtained from Step 5.

### 7. Continue Deployment
Proceed with the next steps in the [deployment guide](/documents/DeploymentGuide.md#deployment-options--steps).
5 changes: 5 additions & 0 deletions infra/core/database/cosmos/cosmos-role-assign.bicep
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
metadata description = 'Creates a SQL role assignment under an Azure Cosmos DB account.'

@description('Required. Name of the Azure Cosmos DB account.')
param accountName string

@description('Required. ID of the Cosmos DB SQL role definition.')
param roleDefinitionId string

@description('Otional. Principal ID to assign the role to.')
param principalId string = ''

resource role 'Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments@2022-05-15' = {
Expand Down
19 changes: 14 additions & 5 deletions infra/core/database/cosmos/deploy_cosmos_db.bicep
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
@minLength(3)
@maxLength(15)
@description('Solution Name')

@description('Required. Name of the solution.')
param solutionName string

@description('Required. Deployment location for the solution.')
param solutionLocation string

@description('Name')
param accountName string = '${ solutionName }-cosmos'
@description('Otional. Name of the Cosmos DB account.')
param accountName string = '${solutionName}-cosmos'

@description('Otional. Name of the Cosmos DB database.')
param databaseName string = 'db_conversation_history'

@description('Otional. Name of the Cosmos DB container.')
param collectionName string = 'conversations'

@description('Otional. List of Cosmos DB containers to be created.')
param containers array = [
{
name: collectionName
Expand All @@ -17,9 +23,11 @@ param containers array = [
}
]

@description('Otional. API kind of the Cosmos DB account.')
@allowed([ 'GlobalDocumentDB', 'MongoDB', 'Parse' ])
param kind string = 'GlobalDocumentDB'

@description('Otional. Resource tags to apply.')
param tags object = {}

resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2022-08-15' = {
Expand Down Expand Up @@ -68,6 +76,7 @@ resource database 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2022-05-15
]
}

@description('Details of the Cosmos DB account, database, and container.')
output cosmosOutput object = {
cosmosAccountName: cosmos.name
cosmosDatabaseName: databaseName
Expand Down
Loading
Loading