Skip to content

Commit 89eb105

Browse files
authored
Merge pull request #6 from microsoft/pewill/polishing
Refactor code structure for improved readability and maintainability
2 parents cde43a7 + 546209f commit 89eb105

19 files changed

Lines changed: 229 additions & 52 deletions

‎README.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ All paths teach the same Foundry concepts — pick the one that resonates with y
3030

3131
| Scenario | Description | Start Here |
3232
|----------|-------------|------------|
33-
| 🏭 **Factory** | Detect machine anomalies and diagnose faults at TireForge Industries | [Factory Lab](./factory/) |
34-
| 📋 **Claims** | Triage incoming claims and recommend actions at ClaimSight Insurance | [Claims Lab](./claims/) |
35-
| 📞 **Call Center** | Classify call intents and advise resolutions at NovaTel Communications | [Call Center Lab](./callcenter/) |
33+
| 🏭 **Factory** | Detect machine anomalies and diagnose faults at TireForge Industries | [Factory Lab](./factory/README.md) |
34+
| 📋 **Claims** | Triage incoming claims and recommend actions at ClaimSight Insurance | [Claims Lab](./claims/README.md) |
35+
| 📞 **Call Center** | Classify call intents and advise resolutions at NovaTel Communications | [Call Center Lab](./callcenter/README.md) |
3636

3737
All scenarios follow the same 5-challenge structure:
3838

@@ -46,10 +46,10 @@ All scenarios follow the same 5-challenge structure:
4646

4747
## Prerequisites
4848

49-
- **Azure subscription** with Contributor access
50-
- **Python 3.10+** installed locally (not needed for Codespaces)
51-
- **Azure CLI** (`az`) installed and logged in
52-
- ~20 minutes for infrastructure provisioning
49+
- **Azure subscription** with **Contributor** and **Foundry User** access
50+
- A **GitHub account**
51+
- **Python 3.10+** installed locally (pre-installed when using Codespaces)
52+
- **Azure CLI** (`az`) installed (pre-installed when using Codespaces)
5353

5454
## Ready to Expand Your Knowledge?
5555

‎callcenter/challenge-0-setup/README.md‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ By the end of this challenge, you will have:
1515

1616
## Get Started
1717

18+
> [!NOTE]
19+
> Before you begin, make sure you have:
20+
> - An **Azure subscription** where you hold both the **Contributor** role (to deploy the infrastructure) and the **Foundry User** role on the Foundry account (to build, evaluate, and run agents in Challenges 1–4).
21+
> - A **GitHub handle** (account) to fork this repository and run it in GitHub Codespaces.
22+
>
23+
> Subscription **Owner** (or Contributor) rights alone are **not** sufficient. Those grant control-plane access to create and manage resources, but building and running agents are data-plane operations that require the separate **Foundry User** role assigned on the Foundry account. An Owner can self-assign it; a Contributor must ask an admin to assign it after deployment.
24+
1825
There are two ways to get started — pick one:
1926

2027
> **First step for both options:** [Fork this repository](https://github.com/microsoft/FrontierWeekHack/fork) to your own GitHub account.
@@ -27,7 +34,7 @@ No local installs needed. Everything runs in a cloud dev environment.
2734

2835
1. Click the badge above (select your fork if applicable)
2936
2. Wait for the Codespace to build (~2 min)
30-
3. In the terminal, login to Azure and deploy your scenario:
37+
3. In the terminal, log in to Azure:
3138

3239
```bash
3340
az login
@@ -53,7 +60,7 @@ source .venv/bin/activate # On Windows: .venv\Scripts\activate
5360
# 3. Install Python dependencies
5461
pip install -r requirements.txt
5562

56-
# 4. Login to Azure
63+
# 4. Log in to Azure
5764
az login
5865
```
5966

@@ -74,8 +81,27 @@ From the **callcenter** folder, run one of the following depending on your termi
7481
7582
This will provision all resources **and** automatically write your `.env` file to the repository root as `.env`.
7683

84+
## Verify the creation of your resources
85+
86+
Go to the [Azure Portal](https://portal.azure.com/) and find your resource group, which should now contain resources like this (exact names will differ depending on scenario):
87+
88+
![Azure Portal Resources](./images/azure-portal-resources.png)
89+
90+
Go to the [Microsoft Foundry Portal](https://ai.azure.com) and verify that you can access the Foundry project.
91+
92+
![Foundry Project](./images/foundry-project.png)
93+
94+
Select **Build** in the top navigation, then **Models**, and verify that the **gpt-5.4** model is deployed.
95+
96+
![Foundry Model](./images/foundry-model.png)
97+
98+
Select **gpt-5.4**, enter a test message in the model playground, and verify that you get a response.
99+
100+
![Foundry Model Playground](./images/foundry-model-playground.png)
101+
102+
77103
## Success Criteria
78104

79-
- [ ] You can see your AI Foundry project in the Azure Portal
105+
- [ ] You can see your Microsoft Foundry project in the Azure Portal
80106
- [ ] A model deployment for gpt-5.4 shows "Succeeded" status
81-
- [ ] You can send a test message in the Foundry Playground (Portal)
107+
- [ ] You can send a test message in the Foundry Model Playground

‎callcenter/challenge-0-setup/deploy.sh‎

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ MODEL_VERSION="${MODEL_VERSION:-2026-03-05}"
1919
LOG_ANALYTICS_NAME="${LOG_ANALYTICS_NAME:-foundry-hack-logs-$SUFFIX}"
2020
APP_INSIGHTS_NAME="${APP_INSIGHTS_NAME:-foundry-hack-insights-$SUFFIX}"
2121

22+
# --- Argument parsing --------------------------------------------------------
23+
# Resource tags always include the default below. Provide additional tags with:
24+
# deploy.sh --tags 'MyTag=MyValue' 'Owner=Jane'
25+
TAGS=("environment=hack")
26+
while [[ $# -gt 0 ]]; do
27+
case "$1" in
28+
--tags)
29+
shift
30+
while [[ $# -gt 0 && "$1" != --* ]]; do
31+
TAGS+=("$1")
32+
shift
33+
done
34+
;;
35+
*)
36+
echo "Unknown argument: $1" >&2
37+
echo "Usage: deploy.sh [--tags 'Key=Value' ...]" >&2
38+
exit 1
39+
;;
40+
esac
41+
done
42+
2243
echo "=============================================="
2344
echo " Foundry Hackathon — Infrastructure Deploy"
2445
echo "=============================================="
@@ -31,22 +52,24 @@ echo "Project: $PROJECT_NAME"
3152
echo "Model Deployment: $MODEL_DEPLOYMENT_NAME"
3253
echo "Model Name: $MODEL_NAME"
3354
echo "Model Version: $MODEL_VERSION"
55+
echo "Tags: ${TAGS[*]}"
3456
echo ""
3557

3658
# --- Resource Group ----------------------------------------------------------
3759
echo ">>> Creating resource group..."
3860
az group create \
3961
--name "$RESOURCE_GROUP" \
4062
--location "$LOCATION" \
41-
--output none
63+
--output none \
64+
--tags "${TAGS[@]}"
4265

4366
# --- AI Foundry Hub ----------------------------------------------------------
44-
echo ">>> Creating AI Foundry resource (AIServices)..."
67+
echo ">>> Creating Microsoft Foundry Account resource (AIServices)..."
4568
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
4669
az rest \
4770
--method PUT \
4871
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME?api-version=2024-10-01" \
49-
--body "{\"kind\": \"AIServices\", \"sku\": {\"name\": \"S0\"}, \"location\": \"$LOCATION\", \"properties\": {\"customSubDomainName\": \"$FOUNDRY_RESOURCE_NAME\", \"publicNetworkAccess\": \"Enabled\", \"allowProjectManagement\": true}}" \
72+
--body "{\"kind\": \"AIServices\", \"sku\": {\"name\": \"S0\"}, \"location\": \"$LOCATION\", \"identity\": {\"type\": \"SystemAssigned\"}, \"properties\": {\"customSubDomainName\": \"$FOUNDRY_RESOURCE_NAME\", \"publicNetworkAccess\": \"Enabled\", \"allowProjectManagement\": true}}" \
5073
--output none || true
5174

5275
echo ">>> Waiting for AIServices resource to reach Succeeded state..."
@@ -92,7 +115,7 @@ if [ "$DISABLE_LOCAL_AUTH" = "true" ]; then
92115
echo " The deployment will continue — use DefaultAzureCredential (Entra ID) in your code."
93116
fi
94117

95-
echo ">>> Creating AI Foundry project..."
118+
echo ">>> Creating Microsoft Foundry project..."
96119
az cognitiveservices account project create \
97120
--name "$FOUNDRY_RESOURCE_NAME" \
98121
--resource-group "$RESOURCE_GROUP" \
@@ -150,13 +173,23 @@ APP_INSIGHTS_RESOURCE_ID=$(az monitor app-insights component show \
150173
--resource-group "$RESOURCE_GROUP" \
151174
--query id -o tsv)
152175

153-
# --- Connect App Insights to the Foundry project ----------------------------
154-
echo ">>> Connecting Application Insights to Foundry project..."
155-
az rest \
156-
--method PATCH \
157-
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME/projects/$PROJECT_NAME?api-version=2024-10-01" \
158-
--body "{\"properties\": {\"applicationInsights\": \"$APP_INSIGHTS_RESOURCE_ID\"}}" \
159-
--output none || true ------------------------------------------------
176+
# --- Connect App Insights to the Foundry account ----------------------------
177+
# In the new Foundry, monitoring resources surface as "connection" child
178+
# resources (visible under Management center > Connected resources), not as a
179+
# project property. The connection uses ApiKey auth (the App Insights
180+
# connection string); the platform stores that key using the account's
181+
# system-assigned managed identity, which is why the identity is enabled above.
182+
echo ">>> Connecting Application Insights to Foundry account..."
183+
if ! az rest \
184+
--method PUT \
185+
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME/connections/appinsights-conn?api-version=2025-06-01" \
186+
--body "{\"properties\": {\"category\": \"AppInsights\", \"target\": \"$APP_INSIGHTS_RESOURCE_ID\", \"authType\": \"ApiKey\", \"credentials\": {\"key\": \"$APP_INSIGHTS_CONN_STRING\"}, \"isSharedToAll\": true, \"metadata\": {\"ApiType\": \"Azure\", \"ResourceId\": \"$APP_INSIGHTS_RESOURCE_ID\"}}}" \
187+
--output none; then
188+
echo "⚠️ Could not link Application Insights to the account automatically."
189+
echo " Tracing (Challenge 2) can still be configured later from the Foundry portal."
190+
fi
191+
192+
# --- Retrieve endpoint and connection details -------------------------------
160193
echo ">>> Retrieving Foundry endpoint and keys..."
161194
FOUNDRY_ENDPOINT=$(az cognitiveservices account show \
162195
--name "$FOUNDRY_RESOURCE_NAME" \
177 KB
Loading
155 KB
Loading
173 KB
Loading
389 KB
Loading

‎claims/challenge-0-setup/README.md‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ By the end of this challenge, you will have:
1515

1616
## Get Started
1717

18+
> [!NOTE]
19+
> Before you begin, make sure you have:
20+
> - An **Azure subscription** where you hold both the **Contributor** role (to deploy the infrastructure) and the **Foundry User** role on the Foundry account (to build, evaluate, and run agents in Challenges 1–4).
21+
> - A **GitHub handle** (account) to fork this repository and run it in GitHub Codespaces.
22+
>
23+
> Subscription **Owner** (or Contributor) rights alone are **not** sufficient. Those grant control-plane access to create and manage resources, but building and running agents are data-plane operations that require the separate **Foundry User** role assigned on the Foundry account. An Owner can self-assign it; a Contributor must ask an admin to assign it after deployment.
24+
1825
There are two ways to get started — pick one:
1926

2027
> **First step for both options:** [Fork this repository](https://github.com/microsoft/FrontierWeekHack/fork) to your own GitHub account.
@@ -27,7 +34,7 @@ No local installs needed. Everything runs in a cloud dev environment.
2734

2835
1. Click the badge above (select your fork if applicable)
2936
2. Wait for the Codespace to build (~2 min)
30-
3. In the terminal, login to Azure and deploy your scenario:
37+
3. In the terminal, log in to Azure:
3138

3239
```bash
3340
az login
@@ -53,7 +60,7 @@ source .venv/bin/activate # On Windows: .venv\Scripts\activate
5360
# 3. Install Python dependencies
5461
pip install -r requirements.txt
5562

56-
# 4. Login to Azure
63+
# 4. Log in to Azure
5764
az login
5865
```
5966

@@ -69,8 +76,27 @@ bash challenge-0-setup/deploy.sh
6976

7077
This will provision all resources **and** automatically write your `.env` file to the repository root as `.env`.
7178

79+
## Verify the creation of your resources
80+
81+
Go to the [Azure Portal](https://portal.azure.com/) and find your resource group, which should now contain resources like this (exact names will differ depending on scenario):
82+
83+
![Azure Portal Resources](./images/azure-portal-resources.png)
84+
85+
Go to the [Microsoft Foundry Portal](https://ai.azure.com) and verify that you can access the Foundry project.
86+
87+
![Foundry Project](./images/foundry-project.png)
88+
89+
Select **Build** in the top navigation, then **Models**, and verify that the **gpt-5.4** model is deployed.
90+
91+
![Foundry Model](./images/foundry-model.png)
92+
93+
Select **gpt-5.4**, enter a test message in the model playground, and verify that you get a response.
94+
95+
![Foundry Model Playground](./images/foundry-model-playground.png)
96+
97+
7298
## Success Criteria
7399

74-
- [ ] You can see your AI Foundry project in the Azure Portal
100+
- [ ] You can see your Microsoft Foundry project in the Azure Portal
75101
- [ ] A model deployment for gpt-5.4 shows "Succeeded" status
76-
- [ ] You can send a test message in the Foundry Playground (Portal)
102+
- [ ] You can send a test message in the Foundry Model Playground

‎claims/challenge-0-setup/deploy.sh‎

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ MODEL_VERSION="${MODEL_VERSION:-2026-03-05}"
1919
LOG_ANALYTICS_NAME="${LOG_ANALYTICS_NAME:-foundry-hack-logs-$SUFFIX}"
2020
APP_INSIGHTS_NAME="${APP_INSIGHTS_NAME:-foundry-hack-insights-$SUFFIX}"
2121

22+
# --- Argument parsing --------------------------------------------------------
23+
# Resource tags always include the default below. Provide additional tags with:
24+
# deploy.sh --tags 'MyTag=MyValue' 'Owner=Jane'
25+
TAGS=("environment=hack")
26+
while [[ $# -gt 0 ]]; do
27+
case "$1" in
28+
--tags)
29+
shift
30+
while [[ $# -gt 0 && "$1" != --* ]]; do
31+
TAGS+=("$1")
32+
shift
33+
done
34+
;;
35+
*)
36+
echo "Unknown argument: $1" >&2
37+
echo "Usage: deploy.sh [--tags 'Key=Value' ...]" >&2
38+
exit 1
39+
;;
40+
esac
41+
done
42+
2243
echo "=============================================="
2344
echo " Foundry Hackathon — Infrastructure Deploy"
2445
echo "=============================================="
@@ -31,22 +52,24 @@ echo "Project: $PROJECT_NAME"
3152
echo "Model Deployment: $MODEL_DEPLOYMENT_NAME"
3253
echo "Model Name: $MODEL_NAME"
3354
echo "Model Version: $MODEL_VERSION"
55+
echo "Tags: ${TAGS[*]}"
3456
echo ""
3557

3658
# --- Resource Group ----------------------------------------------------------
3759
echo ">>> Creating resource group..."
3860
az group create \
3961
--name "$RESOURCE_GROUP" \
4062
--location "$LOCATION" \
41-
--output none
63+
--output none \
64+
--tags "${TAGS[@]}"
4265

4366
# --- AI Foundry Hub ----------------------------------------------------------
44-
echo ">>> Creating AI Foundry resource (AIServices)..."
67+
echo ">>> Creating Microsoft Foundry Account resource (AIServices)..."
4568
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
4669
az rest \
4770
--method PUT \
4871
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME?api-version=2024-10-01" \
49-
--body "{\"kind\": \"AIServices\", \"sku\": {\"name\": \"S0\"}, \"location\": \"$LOCATION\", \"properties\": {\"customSubDomainName\": \"$FOUNDRY_RESOURCE_NAME\", \"publicNetworkAccess\": \"Enabled\", \"allowProjectManagement\": true}}" \
72+
--body "{\"kind\": \"AIServices\", \"sku\": {\"name\": \"S0\"}, \"location\": \"$LOCATION\", \"identity\": {\"type\": \"SystemAssigned\"}, \"properties\": {\"customSubDomainName\": \"$FOUNDRY_RESOURCE_NAME\", \"publicNetworkAccess\": \"Enabled\", \"allowProjectManagement\": true}}" \
5073
--output none || true
5174

5275
echo ">>> Waiting for AIServices resource to reach Succeeded state..."
@@ -92,7 +115,7 @@ if [ "$DISABLE_LOCAL_AUTH" = "true" ]; then
92115
echo " The deployment will continue — use DefaultAzureCredential (Entra ID) in your code."
93116
fi
94117

95-
echo ">>> Creating AI Foundry project..."
118+
echo ">>> Creating Microsoft Foundry project..."
96119
az cognitiveservices account project create \
97120
--name "$FOUNDRY_RESOURCE_NAME" \
98121
--resource-group "$RESOURCE_GROUP" \
@@ -150,13 +173,23 @@ APP_INSIGHTS_RESOURCE_ID=$(az monitor app-insights component show \
150173
--resource-group "$RESOURCE_GROUP" \
151174
--query id -o tsv)
152175

153-
# --- Connect App Insights to the Foundry project ----------------------------
154-
echo ">>> Connecting Application Insights to Foundry project..."
155-
az rest \
156-
--method PATCH \
157-
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME/projects/$PROJECT_NAME?api-version=2024-10-01" \
158-
--body "{\"properties\": {\"applicationInsights\": \"$APP_INSIGHTS_RESOURCE_ID\"}}" \
159-
--output none || true ------------------------------------------------
176+
# --- Connect App Insights to the Foundry account ----------------------------
177+
# In the new Foundry, monitoring resources surface as "connection" child
178+
# resources (visible under Management center > Connected resources), not as a
179+
# project property. The connection uses ApiKey auth (the App Insights
180+
# connection string); the platform stores that key using the account's
181+
# system-assigned managed identity, which is why the identity is enabled above.
182+
echo ">>> Connecting Application Insights to Foundry account..."
183+
if ! az rest \
184+
--method PUT \
185+
--url "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$FOUNDRY_RESOURCE_NAME/connections/appinsights-conn?api-version=2025-06-01" \
186+
--body "{\"properties\": {\"category\": \"AppInsights\", \"target\": \"$APP_INSIGHTS_RESOURCE_ID\", \"authType\": \"ApiKey\", \"credentials\": {\"key\": \"$APP_INSIGHTS_CONN_STRING\"}, \"isSharedToAll\": true, \"metadata\": {\"ApiType\": \"Azure\", \"ResourceId\": \"$APP_INSIGHTS_RESOURCE_ID\"}}}" \
187+
--output none; then
188+
echo "⚠️ Could not link Application Insights to the account automatically."
189+
echo " Tracing (Challenge 2) can still be configured later from the Foundry portal."
190+
fi
191+
192+
# --- Retrieve endpoint and connection details -------------------------------
160193
echo ">>> Retrieving Foundry endpoint and keys..."
161194
FOUNDRY_ENDPOINT=$(az cognitiveservices account show \
162195
--name "$FOUNDRY_RESOURCE_NAME" \
177 KB
Loading

0 commit comments

Comments
 (0)