Skip to content

Commit 417fb34

Browse files
update upload team_config scripts
update documentation for team configuration and sample data processing Added new scripts `Team-Config-And-Data.ps1` and `team_config_and_data.sh` to upload team configurations and process sample data.
1 parent d042fd8 commit 417fb34

14 files changed

+300
-360
lines changed

azure.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ hooks:
1313
Write-Host ""
1414
Write-Host "To index Sample Data into Azure Search. Run the following command in PowerShell:"
1515
Write-Host "infra\scripts\Process-Sample-Data.ps1" -ForegroundColor Cyan
16+
Write-Host ""
17+
Write-Host "To upload team configurations and index sample data both in one command, you can use the following command in PowerShell:"
18+
Write-Host "infra\scripts\Team-Config-And-Data.ps1" -ForegroundColor Cyan
19+
Write-Host ""
20+
Write-Host "You can access the deployed Frontend application at the following URL:"
21+
Write-Host "https://$env:webSiteDefaultHostname" -ForegroundColor Cyan
1622
shell: pwsh
1723
interactive: true
1824
posix:
@@ -22,5 +28,11 @@ hooks:
2228
echo ""
2329
echo "To index Sample Data into Azure Search. Run the following command in Bash:"
2430
echo "bash infra/scripts/process_sample_data.sh"
31+
echo ""
32+
echo "To upload team configurations and index sample data both in one command, you can use the following command in Bash:"
33+
echo "bash infra/scripts/team_config_and_data.sh"
34+
echo ""
35+
echo "You can access the deployed Frontend application at the following URL:"
36+
echo "https://$webSiteDefaultHostname"
2537
shell: sh
2638
interactive: true

azure_custom.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ hooks:
4949
Write-Host ""
5050
Write-Host "To index Sample Data into Azure Search. Run the following command in PowerShell:"
5151
Write-Host "infra\scripts\Process-Sample-Data.ps1" -ForegroundColor Cyan
52+
Write-Host ""
53+
Write-Host "If you want to run both scripts as single command, you can use the following command in PowerShell:"
54+
Write-Host "infra\scripts\Team-Config-And-Data.ps1" -ForegroundColor Cyan
55+
Write-Host ""
56+
Write-Host "You can access the deployed Frontend application at the following URL:"
57+
Write-Host "https://$env:webSiteDefaultHostname" -ForegroundColor Cyan
5258
shell: pwsh
5359
interactive: true
5460
posix:
@@ -58,5 +64,11 @@ hooks:
5864
echo ""
5965
echo "To index Sample Data into Azure Search. Run the following command in Bash:"
6066
echo "bash infra/scripts/process_sample_data.sh"
67+
echo ""
68+
echo "If you want to run both scripts as single command, you can use the following command in Bash:"
69+
echo "bash infra/scripts/team_config_and_data.sh"
70+
echo ""
71+
echo "You can access the deployed Frontend application at the following URL:"
72+
echo "https://$webSiteDefaultHostname"
6173
shell: sh
6274
interactive: true

docs/DeploymentGuide.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,47 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
239239
- This deployment will take _4-6 minutes_ to provision the resources in your account and set up the solution with sample data.
240240
- If you encounter an error or timeout during deployment, changing the location may help, as there could be availability constraints for the resources.
241241

242-
5. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
242+
5. After deployment completes, you can upload Team Configurations using command printed in the terminal. The command will look like one of the following. Run the appropriate command for your shell from the project root:
243243

244-
6. When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](../docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
244+
- **For Bash (Linux/macOS/WSL):**
245+
```bash
246+
bash infra/scripts/upload_team_config.sh
247+
```
245248

246-
7. If you are done trying out the application, you can delete the resources by running `azd down`.
249+
- **For PowerShell (Windows):**
250+
```powershell
251+
infra\scripts\Upload-Team-Config.ps1
252+
```
253+
254+
6. After deployment completes, you can index Sample Data into Search Service using command printed in the terminal. The command will look like one of the following. Run the appropriate command for your shell from the project root:
255+
256+
- **For Bash (Linux/macOS/WSL):**
257+
```bash
258+
bash infra/scripts/process_sample_data.sh
259+
```
260+
261+
- **For PowerShell (Windows):**
262+
```powershell
263+
infra\scripts\Process-Sample-Data.ps1
264+
```
265+
266+
7. To upload team configurations and index sample data in one step. Run the appropriate command for your shell from the project root:
267+
268+
- **For Bash (Linux/macOS/WSL):**
269+
```bash
270+
bash infra/scripts/team_config_and_data.sh
271+
```
272+
273+
- **For PowerShell (Windows):**
274+
```powershell
275+
infra\scripts\Team-Config-And-Data.ps1
276+
```
277+
278+
8. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
279+
280+
9. When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](../docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
281+
282+
10. If you are done trying out the application, you can delete the resources by running `azd down`.
247283

248284

249285
### 🛠️ Troubleshooting

infra/main.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,3 +2046,4 @@ output MCP_SERVER_NAME string = 'MACAE MCP Server'
20462046
output MCP_SERVER_DESCRIPTION string = 'MACAE MCP Server Description'
20472047
output SUPPORTED_MODELS string = '["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]'
20482048
output AZURE_AI_SEARCH_API_KEY string = '<Deployed-Search-ApiKey>'
2049+
output BACKEND_URL string = 'https://${containerApp.outputs.fqdn}'

infra/main_custom.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,3 +2081,4 @@ output MCP_SERVER_NAME string = 'MACAE MCP Server'
20812081
output MCP_SERVER_DESCRIPTION string = 'MACAE MCP Server Description'
20822082
output SUPPORTED_MODELS string = '["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]'
20832083
output AZURE_AI_SEARCH_API_KEY string = '<Deployed-Search-ApiKey>'
2084+
output BACKEND_URL string = 'https://${containerApp.outputs.fqdn}'
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#Requires -Version 7.0
2+
3+
param(
4+
[string]$backendUrl,
5+
[string]$DirectoryPath,
6+
[string]$StorageAccount,
7+
[string]$BlobContainer,
8+
[string]$AiSearch,
9+
[string]$AiSearchIndex,
10+
[string]$ResourceGroup
11+
)
12+
13+
# Get parameters from azd env, if not provided
14+
if (-not $backendUrl) {
15+
$backendUrl = $(azd env get-value BACKEND_URL)
16+
}
17+
if (-not $DirectoryPath) {
18+
$DirectoryPath = "data/agent_teams"
19+
}
20+
if (-not $StorageAccount) {
21+
$StorageAccount = $(azd env get-value AZURE_STORAGE_ACCOUNT_NAME)
22+
}
23+
24+
if (-not $BlobContainer) {
25+
$BlobContainer = $(azd env get-value AZURE_STORAGE_CONTAINER_NAME)
26+
}
27+
28+
if (-not $AiSearch) {
29+
$AiSearch = $(azd env get-value AZURE_AI_SEARCH_NAME)
30+
}
31+
32+
if (-not $AiSearchIndex) {
33+
$AiSearchIndex = $(azd env get-value AZURE_AI_SEARCH_INDEX_NAME)
34+
}
35+
36+
if (-not $ResourceGroup) {
37+
$ResourceGroup = $(azd env get-value AZURE_RESOURCE_GROUP)
38+
}
39+
40+
# Check if all required arguments are provided
41+
if (-not $backendUrl -or -not $DirectoryPath -or -not $StorageAccount -or -not $BlobContainer -or -not $AiSearch -or -not $AiSearchIndex -or -not $ResourceGroup) {
42+
Write-Host "Usage: .\Team-Config-And-Data.ps1 -backendUrl <backendUrl> -DirectoryPath <DirectoryPath> -StorageAccount <StorageAccount> -BlobContainer <BlobContainer> -AiSearch <AiSearch> [-AiSearchIndex <AISearchIndexName>] [-ResourceGroup <ResourceGroupName>]"
43+
exit 1
44+
}
45+
46+
$isTeamConfigFailed = $false
47+
$isSampleDataFailed = $false
48+
# Upload Team Configuration
49+
Write-Host "Uploading Team Configuration..."
50+
try {
51+
.\infra\scripts\Upload-Team-Config.ps1 -backendUrl $backendUrl -DirectoryPath $DirectoryPath
52+
} catch {
53+
Write-Host "Error: Uploading team configuration failed."
54+
$isTeamConfigFailed = $true
55+
}
56+
57+
Write-Host "`n----------------------------------------"
58+
Write-Host "----------------------------------------`n"
59+
60+
# Process Sample Data
61+
Write-Host "Processing Sample Data..."
62+
try {
63+
.\infra\scripts\Process-Sample-Data.ps1 -StorageAccount $StorageAccount -BlobContainer $BlobContainer -AiSearch $AiSearch -AiSearchIndex $AiSearchIndex -ResourceGroup $ResourceGroup
64+
} catch {
65+
Write-Host "Error: Processing sample data failed."
66+
$isSampleDataFailed = $true
67+
}
68+
69+
if ($isTeamConfigFailed -or $isSampleDataFailed) {
70+
Write-Host "`nOne or more tasks failed. Please check the error messages above."
71+
exit 1
72+
} else {
73+
Write-Host "`nBoth team configuration upload and sample data processing completed successfully."
74+
}

infra/scripts/Upload-Team-Config.ps1

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
#Requires -Version 7.0
22

33
param(
4-
[string]$CosmosDbName,
5-
[string]$DatabaseName,
6-
[string]$ContainerName,
7-
[string]$DirectoryPath,
8-
[string]$ResourceGroup
4+
[string]$backendUrl,
5+
[string]$DirectoryPath
96
)
107

118
# Get parameters from azd env, if not provided
12-
if (-not $CosmosDbName) {
13-
$CosmosDbName = $(azd env get-value COSMOSDB_ACCOUNT_NAME)
14-
}
15-
if (-not $DatabaseName) {
16-
$DatabaseName = $(azd env get-value COSMOSDB_DATABASE)
17-
}
18-
if (-not $ContainerName) {
19-
$ContainerName = $(azd env get-value COSMOSDB_CONTAINER)
9+
if (-not $backendUrl) {
10+
$backendUrl = $(azd env get-value BACKEND_URL)
2011
}
2112
if (-not $DirectoryPath) {
2213
$DirectoryPath = "data/agent_teams"
2314
}
24-
if (-not $ResourceGroup) {
25-
$ResourceGroup = $(azd env get-value AZURE_RESOURCE_GROUP)
26-
}
15+
2716
$AzSubscriptionId = $(azd env get-value AZURE_SUBSCRIPTION_ID)
2817

2918
# Check if all required arguments are provided
30-
if (-not $CosmosDbName -or -not $DatabaseName -or -not $ContainerName -or -not $DirectoryPath) {
31-
Write-Host "Usage: .\infra\scripts\Upload-Team-Config.ps1 -CosmosDbName <CosmosDbName> -DatabaseName <DatabaseName> -ContainerName <ContainerName> -DirectoryPath <DirectoryPath> [-ResourceGroup <ResourceGroupName>]"
19+
if (-not $backendUrl -or -not $DirectoryPath) {
20+
Write-Host "Usage: .\infra\scripts\Upload-Team-Config.ps1 -backendUrl <backendUrl> -DirectoryPath <DirectoryPath>"
3221
exit 1
3322
}
3423

@@ -95,23 +84,6 @@ if ($currentSubscriptionId -ne $AzSubscriptionId) {
9584

9685
$userPrincipalId = $(az ad signed-in-user show --query id -o tsv)
9786

98-
$cosmosIsPublicAccessDisabled = $false
99-
if ($ResourceGroup) {
100-
$cosmosPublicAccess = $(az cosmosdb show --name $CosmosDbName --resource-group $ResourceGroup --query "publicNetworkAccess" -o tsv)
101-
if ($cosmosPublicAccess -eq "Disabled") {
102-
$cosmosIsPublicAccessDisabled = $true
103-
Write-Host "Enabling public access for CosmosDB: $CosmosDbName"
104-
az cosmosdb update --name $CosmosDbName --resource-group $ResourceGroup --public-network-access enabled --output none
105-
if ($LASTEXITCODE -ne 0) {
106-
Write-Host "Error: Failed to enable public access for CosmosDB."
107-
exit 1
108-
}
109-
Write-Host "Public access enabled for CosmosDB: $CosmosDbName"
110-
} else {
111-
Write-Host "Public access is already enabled for CosmosDB: $CosmosDbName"
112-
}
113-
}
114-
11587
# Determine the correct Python command
11688
$pythonCmd = $null
11789

@@ -173,21 +145,10 @@ Write-Host "Requirements installed"
173145

174146
# Run the Python script to upload team configuration
175147
Write-Host "Running the python script to upload team configuration"
176-
$process = Start-Process -FilePath $pythonCmd -ArgumentList "infra/scripts/team-config-scripts/upload_team_config.py", $CosmosDbName, $DatabaseName, $ContainerName, $DirectoryPath, $userPrincipalId -Wait -NoNewWindow -PassThru
148+
$process = Start-Process -FilePath $pythonCmd -ArgumentList "infra/scripts/upload_team_config.py", $backendUrl, $DirectoryPath, $userPrincipalId -Wait -NoNewWindow -PassThru
177149
if ($process.ExitCode -ne 0) {
178150
Write-Host "Error: Team configuration upload failed."
179151
exit 1
180152
}
181153

182-
#disable public access for cosmos
183-
if ($cosmosIsPublicAccessDisabled) {
184-
Write-Host "Disabling public access for CosmosDB: $CosmosDbName"
185-
az cosmosdb update --name $CosmosDbName --resource-group $ResourceGroup --public-network-access disabled --output none
186-
if ($LASTEXITCODE -ne 0) {
187-
Write-Host "Error: Failed to disable public access for CosmosDB."
188-
exit 1
189-
}
190-
Write-Host "Public access disabled for CosmosDB: $CosmosDbName"
191-
}
192-
193154
Write-Host "Script executed successfully. Team configuration uploaded."

infra/scripts/requirements.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
azure-search-documents == 11.5.3
2-
azure-identity == 1.24.0
3-
azure-storage-blob == 12.26.0
4-
semantic-kernel==1.35.3
5-
azure-cosmos==4.9.0
1+
azure-search-documents==11.5.3
2+
azure-identity==1.24.0
3+
azure-storage-blob==12.26.0
4+
requests==2.32.5

infra/scripts/team-config-scripts/models.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)