Skip to content

Commit 26298b8

Browse files
Abdul-MicrosoftRoopan-MicrosoftAjitPadhi-MicrosoftPavan-Microsoftross-p-smith
authored
fix: Replace Bicep DeploymentScripts with post-deployment setup scripts (#2153)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Co-authored-by: Ajit Padhi <v-padhiajit@microsoft.com> Co-authored-by: Pavan-Microsoft <v-kupavan@microsoft.com> Co-authored-by: Ross Smith <ross-p-smith@users.noreply.github.com> Co-authored-by: gpickett <122489228+gpickett@users.noreply.github.com> Co-authored-by: Francia Riesco <friesco@microsoft.com> Co-authored-by: Francia Riesco <Fr4nc3@users.noreply.github.com> Co-authored-by: Prajwal D C <v-dcprajwal@microsoft.com> Co-authored-by: Harmanpreet-Microsoft <v-harmanprka@microsoft.com> Co-authored-by: UtkarshMishra-Microsoft <v-utkamishra@microsoft.com> Co-authored-by: Priyanka-Microsoft <v-prisinghal@microsoft.com> Co-authored-by: Prasanjeet-Microsoft <v-singhprasa@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <v-ksiluveru@microsoft.com> Co-authored-by: Prashant-Microsoft <v-pmalusare@microsoft.com> Co-authored-by: Rohini-Microsoft <v-rwalunj@microsoft.com> Co-authored-by: Avijit-Microsoft <v-aghorui@microsoft.com> Co-authored-by: RaviKiran-Microsoft <v-ravikirans@microsoft.com> Co-authored-by: Somesh Joshi <v-somejoshi@microsoft.com> Co-authored-by: Himanshi Agrawal <v-himagrawal@microsoft.com> Co-authored-by: pradeepjha-microsoft <v-pradeepjha@microsoft.com> Co-authored-by: Harmanpreet Kaur <v-harmanpkau@microsoft.com> Co-authored-by: Bangarraju-Microsoft <v-golib@microsoft.com> Co-authored-by: Harsh-Microsoft <v-hbangera@microsoft.com> Co-authored-by: Kanchan-Microsoft <v-knagshetti@microsoft.com> Co-authored-by: Cristopher Coronado <cristofima@hotmail.com> Co-authored-by: Cristopher Coronado Moreira <crcorona@pichincha.com> Co-authored-by: Vamshi-Microsoft <v-vamolla@microsoft.com> Co-authored-by: Thanusree-Microsoft <168087422+Thanusree-Microsoft@users.noreply.github.com> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <v-nirajcha@microsoft.com> Co-authored-by: Rohini-Microsoft <168007985+Rohini-Microsoft@users.noreply.github.com> Co-authored-by: Kingshuk-Microsoft <v-kidatta@microsoft.com> Co-authored-by: Ayaz-Microsoft <v-ayazkhan@microsoft.com> Co-authored-by: Prekshith-Microsoft <v-pdj@microsoft.com> Co-authored-by: Rafi-Microsoft <v-rafmd@microsoft.com> Co-authored-by: Ragini-Microsoft <v-raginich@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Atulku-Microsoft <v-atulku@microsoft.com> Co-authored-by: Akhileswara-Microsoft <v-golnaidu@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 518fb9e commit 26298b8

File tree

10 files changed

+1181
-1737
lines changed

10 files changed

+1181
-1737
lines changed

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+
az login
208+
git clone https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator.git
209+
cd chat-with-your-data-solution-accelerator
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/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 (Windows):**
297+
```powershell
298+
./scripts/post_deployment_setup.ps1 -ResourceGroupName "<your-resource-group-name>"
299+
```
300+
301+
**Bash (Linux/macOS/WSL):**
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 (Windows):**
61+
```powershell
62+
./scripts/post_deployment_setup.ps1 -ResourceGroupName "<your-resource-group-name>"
63+
```
64+
65+
**Bash (Linux/macOS/WSL):**
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: 0 additions & 52 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
@@ -841,25 +840,6 @@ module postgresDBModule 'br/public:avm/res/db-for-postgre-sql/flexible-server:0.
841840
}
842841
}
843842

844-
module pgSqlDelayScript 'br/public:avm/res/resources/deployment-script:0.5.1' = if (databaseType == 'PostgreSQL') {
845-
name: take('avm.res.deployment-script.delay.${postgresResourceName}', 64)
846-
params: {
847-
name: 'delay-for-postgres-${solutionSuffix}'
848-
location: resourceGroup().location
849-
tags: tags
850-
kind: 'AzurePowerShell'
851-
enableTelemetry: enableTelemetry
852-
scriptContent: 'start-sleep -Seconds 600'
853-
azPowerShellVersion: '11.0'
854-
timeout: 'PT15M'
855-
cleanupPreference: 'Always'
856-
retentionInterval: 'PT1H'
857-
}
858-
dependsOn: [
859-
postgresDBModule
860-
]
861-
}
862-
863843
// Store secrets in a keyvault
864844
var keyVaultName = 'kv-${solutionSuffix}'
865845
module keyvault './modules/key-vault/vault/vault.bicep' = {
@@ -1446,7 +1426,6 @@ module function 'modules/app/function.bicep' = {
14461426
serverFarmResourceId: webServerFarm.outputs.resourceId
14471427
applicationInsightsName: enableMonitoring ? monitoring!.outputs.applicationInsightsName : ''
14481428
storageAccountName: storage.outputs.name
1449-
clientKey: clientKey
14501429
userAssignedIdentityResourceId: managedIdentityModule.outputs.resourceId
14511430
userAssignedIdentityClientId: managedIdentityModule.outputs.clientId
14521431
// WAF aligned configurations
@@ -1852,37 +1831,6 @@ module systemAssignedIdentityRoleAssignments './modules/app/roleassignments.bice
18521831
}
18531832
}
18541833

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

0 commit comments

Comments
 (0)