Skip to content

Commit c6cc350

Browse files
Removed deployment script and added post deployment script for client key creation and postgres table
1 parent f3dcdbf commit c6cc350

11 files changed

Lines changed: 1174 additions & 1746 deletions

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,18 @@ Select either "PostgreSQL" or "Cosmos DB":
199199
![Solution Architecture - DB Selection](/docs/images/db_selection.png)
200200

201201

202-
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
202+
When Deployment is complete:
203+
204+
1. Run the post-deployment setup script to configure the Function App client key and create PostgreSQL tables (if applicable). Open [Azure Cloud Shell](https://shell.azure.com) (Bash) and run:
205+
206+
```bash
207+
git clone https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator.git
208+
cd chat-with-your-data-solution-accelerator
209+
pip install -r scripts/data_scripts/requirements.txt
210+
bash scripts/post_deployment_setup.sh "<your-resource-group-name>"
211+
```
212+
213+
2. 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
203214

204215
**Note**: The default configuration deploys an OpenAI Model "gpt-4.1" with version 2025-04-14. However, not all
205216
locations support this version. If you're deploying to a location that doesn't support version 2024-05-13, you'll need to
@@ -264,7 +275,7 @@ Check out similar solution accelerators
264275
| [AI&nbsp;playbook](https://learn.microsoft.com/en-us/ai/playbook/) | The Artificial Intelligence (AI) Playbook provides enterprise software engineers with solutions, capabilities, and code developed to solve real-world AI problems. |
265276
| [Data&nbsp;playbook](https://learn.microsoft.com/en-us/data-engineering/playbook/understanding-data-playbook) | The data playbook provides enterprise software engineers with solutions which contain code developed to solve real-world problems. Everything in the playbook is developed with, and validated by, some of Microsoft's largest and most influential customers and partners. |
266277
267-
<br/>
278+
<br/>
268279
269280
### Resource links
270281

docs/AVMPostDeploymentGuide.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,26 @@ Ensure you have a **Deployed Infrastructure** - A successful Chat with your data
1212

1313
## Post Deployment Steps
1414

15-
### Step 1: Configure App Authentication
15+
### Step 1: Run Post-Deployment Setup Script
16+
17+
Run the post-deployment script to configure the Function App client key and create PostgreSQL tables (if applicable). Open [Azure Cloud Shell](https://shell.azure.com) (Bash) and run:
18+
19+
```bash
20+
git clone https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator.git
21+
cd chat-with-your-data-solution-accelerator
22+
pip install -r scripts/data_scripts/requirements.txt
23+
bash scripts/post_deployment_setup.sh "<your-resource-group-name>"
24+
```
25+
26+
> **Note:** The script auto-discovers all resources in the resource group. It handles private networking (WAF) deployments by temporarily enabling public access, performing the setup, then restoring the original state.
27+
28+
### Step 2: Configure App Authentication
1629

1730
1. After deployment is complete, navigate to your Azure App Service in the Azure portal
1831
2. Follow the detailed instructions in [Set Up Authentication in Azure App Service](./azure_app_service_auth_setup.md) to add authentication to your web app
1932
3. This will ensure only authorized users can access your application
2033

21-
### Step 2: Access and Configure the Admin Site
34+
### Step 3: Access and Configure the Admin Site
2235

2336
1. **Navigate to the admin site** using the following URL pattern:
2437
```
@@ -36,7 +49,7 @@ Ensure you have a **Deployed Infrastructure** - A successful Chat with your data
3649
- Wait for the documents to be processed and indexed
3750
- Verify successful ingestion through the admin interface
3851

39-
### Step 3: Access the Chat Application
52+
### Step 4: Access the Chat Application
4053

4154
1. **Navigate to the main chat application** using this URL pattern:
4255
```

docs/LOCAL_DEPLOYMENT.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ azd auth login --tenant-id <tenant-id>
251251
252252
### 4.2 Start Deployment
253253
254-
**NOTE:** If you are running the latest azd version (version 1.23.9), please run the following command.
255-
```bash
254+
**NOTE:** If you are running the latest azd version (version 1.23.9), please run the following command.
255+
```bash
256256
azd config set provision.preflight off
257257
```
258258
@@ -289,20 +289,36 @@ After successful deployment, locate your application URLs:
289289
290290
## Step 5: Post-Deployment Configuration
291291
292-
### 5.1 Configure Authentication (Required for Chat Application)
292+
### 5.1 Run Post-Deployment Setup Script (Required)
293+
294+
After deployment completes, run the post-deployment script to configure the Function App client key and create PostgreSQL tables (if applicable):
295+
296+
**PowerShell:**
297+
```powershell
298+
./scripts/post_deployment_setup.ps1 -ResourceGroupName "<your-resource-group-name>"
299+
```
300+
301+
**Bash:**
302+
```bash
303+
bash scripts/post_deployment_setup.sh "<your-resource-group-name>"
304+
```
305+
306+
> **Note:** The script auto-discovers all resources in the resource group. It handles private networking (WAF) deployments by temporarily enabling public access, performing the setup, then restoring the original state.
307+
308+
### 5.2 Configure Authentication (Required for Chat Application)
293309
294310
**This step is mandatory for Chat Application access:**
295311
296312
1. Follow [App Authentication Configuration](./azure_app_service_auth_setup.md)
297313
2. Wait up to 10 minutes for authentication changes to take effect
298314
299-
### 5.2 Verify Deployment
315+
### 5.3 Verify Deployment
300316
301317
1. Access your application using the URL from Step 4.3
302318
2. Confirm the application loads successfully
303319
3. Verify you can sign in with your authenticated account
304320
305-
### 5.3 Test the Application
321+
### 5.4 Test the Application
306322
307323
**Quick Test Steps:**
308324
1. Navigate to the admin site, where you can upload documents. Then select Ingest Data and add your data. You can find sample data in the [data](../data) directory.

docs/NON_DEVCONTAINER_SETUP.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,21 @@ The Azure Developer CLI (`azd`) is a developer-centric command-line interface (C
5353
```
5454
> **Note:** This solution accelerator requires **Azure Developer CLI (azd) version 1.18.0 or higher**. Please ensure you have the latest version installed before proceeding with deployment. [Download azd here](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd).
5555

56-
> Select your desired `subscription` and `location`. Wait a moment for the resource deployment to complete, click the website endpoint and you will see the web app page.
56+
> Select your desired `subscription` and `location`. Wait a moment for the resource deployment to complete.
57+
58+
1. Run the post-deployment setup script:
59+
60+
**PowerShell:**
61+
```powershell
62+
./scripts/post_deployment_setup.ps1 -ResourceGroupName "<your-resource-group-name>"
63+
```
64+
65+
**Bash:**
66+
```bash
67+
bash scripts/post_deployment_setup.sh "<your-resource-group-name>"
68+
```
69+
70+
1. Click the website endpoint and you will see the web app page.
5771

5872
## 🛠️ Troubleshooting
5973
If you encounter any issues during the deployment process, please refer to the [TroubleShootingSteps](TroubleShootingSteps.md) document for detailed steps and solutions.

infra/main.bicep

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ var blobContainerName = 'documents'
339339
var queueName = 'doc-processing'
340340
var clientKey = '${uniqueString(guid(subscription().id, deployment().name))}${newGuidString}'
341341
var eventGridSystemTopicName = 'evgt-${solutionSuffix}'
342-
var baseUrl = 'https://raw.githubusercontent.com/Azure-Samples/chat-with-your-data-solution-accelerator/main/'
343342

344343
@description('Optional. Image version tag to use.')
345344
param appversion string = 'latest_waf' // Update GIT deployment branch
@@ -381,14 +380,10 @@ param createdBy string = contains(deployer(), 'userPrincipalName')
381380
resource resourceGroupTags 'Microsoft.Resources/tags@2025-04-01' = {
382381
name: 'default'
383382
properties: {
384-
tags: union(
385-
existingTags,
386-
allTags,
387-
{
388-
TemplateName: 'CWYD'
389-
CreatedBy: createdBy
390-
}
391-
)
383+
tags: union(existingTags, allTags, {
384+
TemplateName: 'CWYD'
385+
CreatedBy: createdBy
386+
})
392387
}
393388
}
394389

@@ -845,25 +840,6 @@ module postgresDBModule 'br/public:avm/res/db-for-postgre-sql/flexible-server:0.
845840
}
846841
}
847842

848-
module pgSqlDelayScript 'br/public:avm/res/resources/deployment-script:0.5.1' = if (databaseType == 'PostgreSQL') {
849-
name: take('avm.res.deployment-script.delay.${postgresResourceName}', 64)
850-
params: {
851-
name: 'delay-for-postgres-${solutionSuffix}'
852-
location: resourceGroup().location
853-
tags: tags
854-
kind: 'AzurePowerShell'
855-
enableTelemetry: enableTelemetry
856-
scriptContent: 'start-sleep -Seconds 600'
857-
azPowerShellVersion: '11.0'
858-
timeout: 'PT15M'
859-
cleanupPreference: 'Always'
860-
retentionInterval: 'PT1H'
861-
}
862-
dependsOn: [
863-
postgresDBModule
864-
]
865-
}
866-
867843
// Store secrets in a keyvault
868844
var keyVaultName = 'kv-${solutionSuffix}'
869845
module keyvault './modules/key-vault/vault/vault.bicep' = {
@@ -1450,7 +1426,6 @@ module function 'modules/app/function.bicep' = {
14501426
serverFarmResourceId: webServerFarm.outputs.resourceId
14511427
applicationInsightsName: enableMonitoring ? monitoring!.outputs.applicationInsightsName : ''
14521428
storageAccountName: storage.outputs.name
1453-
clientKey: clientKey
14541429
userAssignedIdentityResourceId: managedIdentityModule.outputs.resourceId
14551430
userAssignedIdentityClientId: managedIdentityModule.outputs.clientId
14561431
// WAF aligned configurations
@@ -1856,37 +1831,6 @@ module systemAssignedIdentityRoleAssignments './modules/app/roleassignments.bice
18561831
}
18571832
}
18581833

1859-
//========== Deployment script to upload data ========== //
1860-
module createIndex 'br/public:avm/res/resources/deployment-script:0.5.1' = if (databaseType == 'PostgreSQL') {
1861-
name: take('avm.res.resources.deployment-script.createIndex', 64)
1862-
params: {
1863-
kind: 'AzureCLI'
1864-
name: 'copy_demo_Data_${solutionSuffix}'
1865-
azCliVersion: '2.52.0'
1866-
cleanupPreference: 'Always'
1867-
location: location
1868-
enableTelemetry: enableTelemetry
1869-
managedIdentities: {
1870-
userAssignedResourceIds: [
1871-
managedIdentityModule.outputs.resourceId
1872-
]
1873-
}
1874-
retentionInterval: 'PT1H'
1875-
runOnce: true
1876-
primaryScriptUri: '${baseUrl}scripts/run_create_table_script.sh'
1877-
arguments: '${baseUrl} ${resourceGroup().name} ${postgresDBModule!.outputs.fqdn} ${managedIdentityModule.outputs.name}'
1878-
storageAccountResourceId: storage.outputs.resourceId
1879-
subnetResourceIds: enablePrivateNetworking
1880-
? [
1881-
virtualNetwork!.outputs.deploymentScriptsSubnetResourceId
1882-
]
1883-
: null
1884-
tags: tags
1885-
timeout: 'PT30M'
1886-
}
1887-
dependsOn: [pgSqlDelayScript]
1888-
}
1889-
18901834
var azureOpenAIModelInfo = string({
18911835
model: azureOpenAIModel
18921836
model_name: azureOpenAIModelName

0 commit comments

Comments
 (0)