Skip to content

Commit 4a1e1b5

Browse files
fix: update setup_env.sh to use sudo for script permissions and removed azure function tools; improve user email retrieval in create_sql_user_and_role.sh; clean up requirements (#519)
1 parent 83e8ac4 commit 4a1e1b5

File tree

8 files changed

+22
-13
lines changed

8 files changed

+22
-13
lines changed

.devcontainer/setup_env.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ git fetch
44
git pull
55

66
# provide execute permission to quotacheck script
7-
chmod +x ./infra/scripts/checkquota.sh
7+
sudo chmod +x ./infra/scripts/checkquota.sh
88

99
# Add the path to ~/.bashrc for persistence
1010
if ! grep -q '/opt/mssql-tools18/bin' ~/.bashrc; then
@@ -20,9 +20,3 @@ if ! command -v sqlcmd &> /dev/null; then
2020
exit 1
2121
fi
2222

23-
# Install Azure function core tool
24-
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
25-
sudo dpkg -i packages-microsoft-prod.deb
26-
27-
sudo apt-get update
28-
sudo apt-get install azure-functions-core-tools-4

.github/workflows/CAdeploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
az deployment group create \
116116
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
117117
--template-file infra/main.bicep \
118-
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} cosmosLocation=${{ env.AZURE_LOCATION }}
118+
--parameters AZURE_ENV_OPENAI_LOCATION=${{ env.AZURE_LOCATION }}
119119
120120
- name: List KeyVaults and Store in Array
121121
id: list_keyvaults

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,6 @@ FodyWeavers.xsd
401401

402402
scriptenv
403403
.azure
404+
405+
clientdata
406+
clienttranscripts

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Follow the quick deploy steps on the deployment guide to deploy this solution to
5353
[Click here to launch the deployment guide](./docs/DeploymentGuide.md)
5454

5555

56-
| [![Open in Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=microsoft/Build-your-own-copilot-Solution-Accelerator&ref=dev) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator&ref=dev) |
56+
| [![Open in Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=microsoft/Build-your-own-copilot-Solution-Accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator) |
5757
|---|---|
5858

5959
> ⚠️ **Important: Check Azure OpenAI Quota Availability** <br/>To ensure sufficient quota is available in your subscription, please follow [quota check instructions guide](./docs/quota_check.md) before you deploy the solution.

infra/scripts/add_user_scripts/create_sql_user_and_role.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ OS=$(uname | tr '[:upper:]' '[:lower:]')
9292
if [[ "$OS" == "mingw"* || "$OS" == "cygwin"* || "$OS" == "msys"* ]]; then
9393
echo "Running on Windows OS, will use interactive login"
9494
echo "Getting signed in user email"
95-
UserEmail=$(az ad signed-in-user show --query userPrincipalName -o tsv)
95+
UserEmail=$(az ad signed-in-user show --query mail -o tsv)
96+
# If the email is null or empty, use userPrincipalName
97+
if [[ -z "$UserEmail" ]]; then
98+
UserEmail=$(az ad signed-in-user show --query userPrincipalName -o tsv)
99+
fi
96100
# Execute the SQL query
97101
echo "Executing SQL query..."
98102
sqlcmd -S "$SqlServerName" -d "$SqlDatabaseName" -G -U "$UserEmail" -Q "$SQL_QUERY_FINAL" || {

infra/scripts/index_scripts/create_sql_tables.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
managed_identity_client_id = 'mici_to-be-replaced'
33

44
import pandas as pd
5-
import pymssql
65
import os
76
from datetime import datetime
87

infra/scripts/index_scripts/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ azure-ai-textanalytics
1010
azure-search-documents==11.6.0b9
1111
azure-keyvault-secrets
1212
pandas
13-
pymssql
1413
datetime
1514

1615
pyodbc==5.2.0

infra/scripts/run_create_index_scripts.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,23 @@ if [ -n "$managedIdentityClientId" ]; then
118118
sed -i "s/mici_to-be-replaced/${managedIdentityClientId}/g" ${pythonScriptPath}"create_sql_tables.py"
119119
fi
120120

121+
# Determine the correct Python command
122+
if command -v python3 &> /dev/null; then
123+
PYTHON_CMD="python3"
124+
elif command -v python &> /dev/null; then
125+
PYTHON_CMD="python"
126+
else
127+
echo "Python is not installed on this system. Or it is not added in the PATH."
128+
exit 1
129+
fi
130+
121131
# create virtual environment
122132
# Check if the virtual environment already exists
123133
if [ -d $pythonScriptPath"scriptenv" ]; then
124134
echo "Virtual environment already exists. Skipping creation."
125135
else
126136
echo "Creating virtual environment"
127-
python3 -m venv $pythonScriptPath"scriptenv"
137+
$PYTHON_CMD -m venv $pythonScriptPath"scriptenv"
128138
fi
129139

130140
# Activate the virtual environment

0 commit comments

Comments
 (0)