Skip to content

Commit f9a52a4

Browse files
committed
Add Skillable v1 setup scripts and customization tools
- Add automated setup scripts for Azure deployment and configuration - Add model customization scripts (2-add-models.sh) - Add product index creation and RBAC configuration - Add environment setup and teardown scripts - Add customization templates for models and products - Update .gitignore to exclude environment files and temp directories - Update lab requirements.txt
1 parent a46e08b commit f9a52a4

16 files changed

+3220
-18
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
*.userosscache
1111
*.sln.docstates
1212
*.env
13+
/.env.*
14+
!/.env.sample
15+
16+
# ForBeginners folder
17+
scripts/ForBeginners/
1318

1419
# User-specific files (MonoDevelop/Xamarin Studio)
1520
*.userprefs

lab/requirements.txt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
# ................ General Python Dependencies
22
ipython
3-
pandas
4-
numpy
5-
python-dotenv
6-
tiktoken
7-
8-
# ................ Azure AI SDK Dependencies
9-
azure-identity
10-
azure-search-documents
11-
azure-ai-evaluation
12-
13-
## Core libraries
143
python-dotenv # Environment variables
154
ipykernel # Jupyter Notebooks
165
uv # MCP Server
@@ -20,15 +9,13 @@ matplotlib==3.10.3 # For creating visualizations
209
numpy==2.3.1 # For numerical computations
2110
pandas # For data manipulation and analysis
2211

23-
## ..... Setup: Product Index
12+
# ................ Azure AI SDK Dependencies
13+
azure-identity # For Azure authentication
2414
azure-search-documents==11.5.3 # For Azure AI Search
15+
azure-ai-evaluation # For model evaluation
16+
azure-mgmt-cognitiveservices # For model deployment
2517

26-
27-
## ..... Demo 1: Basic Fine Tuning
18+
## ............... Azure OpenAI Dependencies
2819
openai
2920
requests
3021
tiktoken
31-
32-
## ..... Demo 2: Distillation
33-
azure-identity # For Azure authentication
34-
azure-mgmt-cognitiveservices # For model deployment

scripts/.env.sample

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .... Azure Environment Variables (from AZD)
2+
AZURE_LOCATION=
3+
AZURE_RESOURCE_GROUP=
4+
AZURE_SUBSCRIPTION_ID=
5+
AZURE_TENANT_ID=
6+
7+
# .... Azure AI Foundry
8+
AZURE_OPENAI_API_KEY=
9+
AZURE_OPENAI_ENDPOINT=
10+
AZURE_OPENAI_API_VERSION="2025-02-01-preview"
11+
AZURE_OPENAI_DEPLOYMENT=
12+
13+
# .... Azure AI Foundry Resources (from Azure portal)
14+
AZURE_AI_FOUNDRY_NAME=
15+
AZURE_AI_PROJECT_NAME=
16+
17+
# .... Azure AI Search
18+
AZURE_SEARCH_ENDPOINT=
19+
AZURE_SEARCH_API_KEY=
20+
AZURE_SEARCH_INDEX_NAME=
21+
AZURE_AI_EMBED_DEPLOYMENT_NAME="embeddings-large"
22+
AZURE_AI_EMBED_MODEL_NAME="text-embedding-3-large"

scripts/1-setup.sh

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
#!/bin/bash
2+
3+
# ---------------------------------------------------------------------------------------------------------------------------------
4+
# Setup Script - Provisions infrastructure for the labs
5+
# - Clones the ForBeginners repository (if not already present)
6+
# - Creates and configures AZD environment
7+
# - Deploys Azure infrastructure using azd up
8+
#
9+
# Note: This script is for testing purposes only.
10+
# In-venue labs use pre-provisioned Azure subscriptions with resources already deployed.
11+
# ---------------------------------------------------------------------------------------------------------------------------------
12+
13+
set -e # Exit on error during setup
14+
15+
# Color formatting
16+
RED='\033[0;31m'
17+
GREEN='\033[0;32m'
18+
YELLOW='\033[1;33m'
19+
NC='\033[0m'
20+
21+
# Configuration
22+
REPO_URL="https://github.com/microsoft/ForBeginners"
23+
DEFAULT_BRANCH="msignite25-prel13"
24+
TARGET_DIR="./ForBeginners"
25+
AZD_SETUP_DIR="./ForBeginners/.azd-setup"
26+
27+
#==============================================================================
28+
# Helper Functions
29+
#==============================================================================
30+
31+
clone_forbeginners_repo() {
32+
if [ -d "$TARGET_DIR" ]; then
33+
echo -e "${YELLOW}ForBeginners directory already exists. Skipping clone.${NC}"
34+
return 0
35+
fi
36+
37+
# Prompt for branch name
38+
echo -e "${YELLOW}Cloning ForBeginners repository...${NC}"
39+
read -p "Enter branch name [${DEFAULT_BRANCH}]: " branch_input
40+
local branch=${branch_input:-$DEFAULT_BRANCH}
41+
42+
echo -e "${YELLOW}Cloning branch: ${branch}${NC}"
43+
if git clone -b "$branch" --single-branch "$REPO_URL" "$TARGET_DIR"; then
44+
echo -e "${GREEN}✓ Repository cloned successfully from branch: ${branch}${NC}"
45+
else
46+
echo -e "${RED}✗ Failed to clone repository from branch: ${branch}${NC}"
47+
exit 1
48+
fi
49+
}
50+
51+
setup_azd_environment() {
52+
echo -e "${YELLOW}Setting up AZD environment...${NC}"
53+
54+
# Check if an environment already exists
55+
local existing_env=$(azd env list --output json 2>/dev/null | jq -r '.[0].Name' 2>/dev/null || echo "")
56+
57+
# Validate we have a real environment (not empty and not "null")
58+
if [ -n "$existing_env" ] && [ "$existing_env" != "null" ]; then
59+
echo -e "${YELLOW}Found existing AZD environment: ${existing_env}${NC}"
60+
read -p "Use existing environment? (yes/no): " use_existing
61+
62+
if [ "$use_existing" != "yes" ]; then
63+
create_new_environment
64+
fi
65+
else
66+
echo -e "${YELLOW}No existing AZD environment found. Creating new one...${NC}"
67+
create_new_environment
68+
fi
69+
}
70+
71+
create_new_environment() {
72+
echo -e "${YELLOW}Creating new AZD environment...${NC}"
73+
74+
# Prompt for environment details
75+
read -p "Enter environment name: " env_name
76+
read -p "Enter Azure region [swedencentral]: " region
77+
region=${region:-swedencentral}
78+
read -p "Enter subscription ID (optional): " subscription_id
79+
80+
# Create environment
81+
if [ -n "$subscription_id" ]; then
82+
azd env new "$env_name" --location "$region" --subscription "$subscription_id"
83+
else
84+
azd env new "$env_name" --location "$region"
85+
fi
86+
87+
echo -e "${GREEN}✓ Environment created: ${env_name}${NC}"
88+
}
89+
90+
configure_environment_variables() {
91+
echo -e "${YELLOW}Configuring environment variables...${NC}"
92+
93+
# Set required environment variables for the deployment
94+
azd env set USE_APPLICATION_INSIGHTS true
95+
azd env set ENABLE_AZURE_MONITOR_TRACING true
96+
azd env set AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED true
97+
azd env set AZURE_AI_AGENT_DEPLOYMENT_CAPACITY 50
98+
azd env set AZURE_AI_AGENT_DEPLOYMENT_NAME gpt-4.1
99+
azd env set AZURE_AI_AGENT_MODEL_NAME gpt-4.1
100+
azd env set AZURE_AI_AGENT_MODEL_VERSION 2025-04-14
101+
102+
echo -e "${GREEN}✓ Environment variables configured${NC}"
103+
}
104+
105+
configure_azure_ai_search() {
106+
echo ""
107+
echo -e "${YELLOW}======================================${NC}"
108+
echo -e "${YELLOW} Azure AI Search Configuration${NC}"
109+
echo -e "${YELLOW}======================================${NC}"
110+
echo ""
111+
echo -e "${YELLOW}Azure AI Search enables RAG (Retrieval Augmented Generation) by searching${NC}"
112+
echo -e "${YELLOW}through indexed documents to provide context for better AI responses.${NC}"
113+
echo ""
114+
echo -e "${RED}⚠️ IMPORTANT: Search must be configured BEFORE initial deployment!${NC}"
115+
echo ""
116+
117+
read -p "Do you want to activate Azure AI Search? (yes/no) [no]: " enable_search
118+
enable_search=${enable_search:-no}
119+
120+
if [ "$enable_search" == "yes" ]; then
121+
echo ""
122+
echo -e "${YELLOW}Configuring Azure AI Search with defaults:${NC}"
123+
echo -e " - Index Name: zava-products"
124+
echo -e " - Embedding Model: text-embedding-3-large"
125+
echo -e " - Model Version: 1"
126+
echo -e " - SKU: Standard"
127+
echo -e " - Capacity: 50"
128+
echo ""
129+
130+
read -p "Use these defaults? (yes/no) [yes]: " use_defaults
131+
use_defaults=${use_defaults:-yes}
132+
133+
if [ "$use_defaults" == "yes" ]; then
134+
SEARCH_INDEX_NAME="zava-products"
135+
EMBED_MODEL_NAME="text-embedding-3-large"
136+
EMBED_MODEL_VERSION="1"
137+
EMBED_MODEL_FORMAT="OpenAI"
138+
EMBED_DEPLOYMENT_NAME="text-embedding-3-large"
139+
EMBED_SKU_NAME="Standard"
140+
EMBED_CAPACITY="50"
141+
else
142+
read -p "Enter search index name [zava-products]: " index_input
143+
SEARCH_INDEX_NAME=${index_input:-zava-products}
144+
145+
read -p "Enter embedding model name [text-embedding-3-large]: " model_input
146+
EMBED_MODEL_NAME=${model_input:-text-embedding-3-large}
147+
148+
read -p "Enter model version [1]: " version_input
149+
EMBED_MODEL_VERSION=${version_input:-1}
150+
151+
read -p "Enter model format [OpenAI]: " format_input
152+
EMBED_MODEL_FORMAT=${format_input:-OpenAI}
153+
154+
read -p "Enter deployment name [text-embedding-3-large]: " deploy_input
155+
EMBED_DEPLOYMENT_NAME=${deploy_input:-text-embedding-3-large}
156+
157+
read -p "Enter SKU name [Standard]: " sku_input
158+
EMBED_SKU_NAME=${sku_input:-Standard}
159+
160+
read -p "Enter capacity [50]: " capacity_input
161+
EMBED_CAPACITY=${capacity_input:-50}
162+
fi
163+
164+
# Set environment variables for Azure AI Search
165+
azd env set USE_AZURE_AI_SEARCH_SERVICE true
166+
azd env set AZURE_AI_SEARCH_INDEX_NAME "$SEARCH_INDEX_NAME"
167+
azd env set AZURE_AI_EMBED_DEPLOYMENT_NAME "$EMBED_DEPLOYMENT_NAME"
168+
azd env set AZURE_AI_EMBED_MODEL_NAME "$EMBED_MODEL_NAME"
169+
azd env set AZURE_AI_EMBED_MODEL_VERSION "$EMBED_MODEL_VERSION"
170+
azd env set AZURE_AI_EMBED_MODEL_FORMAT "$EMBED_MODEL_FORMAT"
171+
azd env set AZURE_AI_EMBED_DEPLOYMENT_SKU "$EMBED_SKU_NAME"
172+
azd env set AZURE_AI_EMBED_DEPLOYMENT_CAPACITY "$EMBED_CAPACITY"
173+
174+
echo ""
175+
echo -e "${GREEN}✓ Azure AI Search configured${NC}"
176+
echo -e "${GREEN} - Search Service: Enabled${NC}"
177+
echo -e "${GREEN} - Index Name: $SEARCH_INDEX_NAME${NC}"
178+
echo -e "${GREEN} - Embedding Model: $EMBED_MODEL_NAME (version: $EMBED_MODEL_VERSION)${NC}"
179+
echo ""
180+
else
181+
echo -e "${YELLOW}Azure AI Search will not be enabled${NC}"
182+
azd env set USE_AZURE_AI_SEARCH_SERVICE false
183+
fi
184+
}
185+
186+
deploy_infrastructure() {
187+
echo -e "${YELLOW}======================================${NC}"
188+
echo -e "${YELLOW}Ready to deploy Azure infrastructure${NC}"
189+
echo -e "${YELLOW}======================================${NC}"
190+
191+
read -p "Proceed with deployment? (yes/no): " confirm
192+
193+
if [ "$confirm" != "yes" ]; then
194+
echo -e "${YELLOW}Deployment cancelled${NC}"
195+
exit 0
196+
fi
197+
198+
echo -e "${YELLOW}Running azd up...${NC}"
199+
if azd up --no-prompt; then
200+
echo -e "${GREEN}✓ Infrastructure deployed successfully${NC}"
201+
else
202+
echo -e "${RED}✗ Deployment failed${NC}"
203+
exit 1
204+
fi
205+
}
206+
207+
#==============================================================================
208+
# Main Execution
209+
#==============================================================================
210+
211+
echo -e "${YELLOW}Starting setup process...${NC}"
212+
213+
# Clone the ForBeginners repository
214+
clone_forbeginners_repo
215+
216+
# Navigate to the AZD setup directory
217+
if [ ! -d "$AZD_SETUP_DIR" ]; then
218+
echo -e "${RED}✗ AZD setup directory not found: ${AZD_SETUP_DIR}${NC}"
219+
exit 1
220+
fi
221+
222+
cd "$AZD_SETUP_DIR"
223+
echo -e "${GREEN}Changed to AZD setup directory${NC}"
224+
225+
# Setup AZD environment
226+
setup_azd_environment
227+
228+
# Configure environment variables
229+
configure_environment_variables
230+
231+
# Configure Azure AI Search (optional)
232+
configure_azure_ai_search
233+
234+
# Deploy infrastructure
235+
deploy_infrastructure
236+
237+
# Summary
238+
echo ""
239+
echo -e "${YELLOW}======================================${NC}"
240+
echo -e "${GREEN}Setup Complete!${NC}"
241+
echo -e "${YELLOW}======================================${NC}"
242+
echo -e "${GREEN}✓ Repository cloned${NC}"
243+
echo -e "${GREEN}✓ Environment configured${NC}"
244+
echo -e "${GREEN}✓ Infrastructure deployed${NC}"
245+
246+
# Check if search was enabled
247+
search_enabled=$(azd env get-value USE_AZURE_AI_SEARCH_SERVICE 2>/dev/null || echo "false")
248+
if [ "$search_enabled" == "true" ]; then
249+
search_index=$(azd env get-value AZURE_AI_SEARCH_INDEX_NAME 2>/dev/null || echo "N/A")
250+
echo -e "${GREEN}✓ Azure AI Search enabled (Index: $search_index)${NC}"
251+
else
252+
echo -e "${YELLOW}ℹ️ Azure AI Search not enabled${NC}"
253+
fi
254+
255+
echo -e "${YELLOW}======================================${NC}"

0 commit comments

Comments
 (0)