From 74aac6a6b0ad7a4f89311ea05766283f38fccc9f Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Tue, 17 Oct 2023 13:32:27 -0700 Subject: [PATCH] Address comments --- scripts/deploy/README.md | 2 +- scripts/deploy/deploy-azure.ps1 | 2 +- scripts/deploy/deploy-azure.sh | 2 +- scripts/deploy/main.bicep | 24 ++++++++++-------------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/scripts/deploy/README.md b/scripts/deploy/README.md index deb031c44..5b93a17e6 100644 --- a/scripts/deploy/README.md +++ b/scripts/deploy/README.md @@ -152,7 +152,7 @@ chmod +x ./deploy-webapi.sh # Deploy Hosted Plugins -> **_NOTE:_** This step can be skipped if the required resources for the web searcher plugin are not deployed. The required resources include a Bing resource that may require an elevated permission, and an Azure Function. The required resources are NOT deployed by default. To deploy the required resources, use the `-DeployWebSearcherPlugin` or `--deploy-web-searcher-plugin` flag when running the **deploy-azure.ps1/deploy-azure.sh** script. +> **_NOTE:_** This step can be skipped if the required resources for the web searcher plugin are not deployed. The required resources include a Bing resource and an Azure Function. The required resources are NOT deployed by default. To deploy the required resources, use the `-DeployWebSearcherPlugin` or `--deploy-web-searcher-plugin` flag when running the **deploy-azure.ps1/deploy-azure.sh** script. > **_NOTE:_** This step can be skipped if the previous Azure Resources creation step, including the resources required by the Web Search plugin, succeeded without errors. The `deployPackages = true` setting in main.bicep ensures that the WebSearcher is deployed. diff --git a/scripts/deploy/deploy-azure.ps1 b/scripts/deploy/deploy-azure.ps1 index b95207fcf..c82787f6a 100644 --- a/scripts/deploy/deploy-azure.ps1 +++ b/scripts/deploy/deploy-azure.ps1 @@ -123,7 +123,7 @@ $jsonConfig = " `\`"memoryStore`\`": { `\`"value`\`": `\`"$MemoryStore`\`" }, `\`"deployCosmosDB`\`": { `\`"value`\`": $(If (!($NoCosmosDb)) {"true"} Else {"false"}) }, `\`"deploySpeechServices`\`": { `\`"value`\`": $(If (!($NoSpeechServices)) {"true"} Else {"false"}) }, - `\`"deployWebSearcher`\`": { `\`"value`\`": $(If ($DeployWebSearcherPlugin) {"true"} Else {"false"}) } + `\`"deployWebSearcherPlugin`\`": { `\`"value`\`": $(If ($DeployWebSearcherPlugin) {"true"} Else {"false"}) } } " diff --git a/scripts/deploy/deploy-azure.sh b/scripts/deploy/deploy-azure.sh index 2f860d936..81f89d522 100755 --- a/scripts/deploy/deploy-azure.sh +++ b/scripts/deploy/deploy-azure.sh @@ -206,7 +206,7 @@ JSON_CONFIG=$( "memoryStore": { "value": "$MEMORY_STORE" }, "deployCosmosDB": { "value": $([ "$NO_COSMOS_DB" = true ] && echo "false" || echo "true") }, "deploySpeechServices": { "value": $([ "$NO_SPEECH_SERVICES" = true ] && echo "false" || echo "true") }, - "deployWebSearcher": { "value": $([ "$DEPLOY_WEB_SEARCHER_PLUGIN" = true ] && echo "true" || echo "false") } + "deployWebSearcherPlugin": { "value": $([ "$DEPLOY_WEB_SEARCHER_PLUGIN" = true ] && echo "true" || echo "false") } } EOF ) diff --git a/scripts/deploy/main.bicep b/scripts/deploy/main.bicep index 7c4523b94..a3d2d66b1 100644 --- a/scripts/deploy/main.bicep +++ b/scripts/deploy/main.bicep @@ -75,12 +75,8 @@ param memoryStore string = 'AzureCognitiveSearch' @description('Whether to deploy Azure Speech Services to enable input by voice') param deploySpeechServices bool = true -/* -The web searcher plugin requires a Bing resource. -A Bing resource may require an elevated permission, which will block the deployment. -*/ -@description('Whether to the web searcher plugin, which requires a Bing resource') -param deployWebSearcher bool = false +@description('Whether to deploy the web searcher plugin, which requires a Bing resource') +param deployWebSearcherPlugin bool = false @description('Whether to deploy binary packages to the cloud') param deployPackages bool = true @@ -398,7 +394,7 @@ resource appServiceWebConfig 'Microsoft.Web/sites/config@2022-09-01' = { value: 'https://www.klarna.com' } ], - (deployWebSearcher) ? [ + (deployWebSearcherPlugin) ? [ { name: 'Plugins:1:Name' value: 'WebSearcher' @@ -604,7 +600,7 @@ resource appServiceMemoryPipelineDeploy 'Microsoft.Web/sites/extensions@2022-09- ] } -resource functionAppWebSearcherPlugin 'Microsoft.Web/sites@2022-09-01' = if (deployWebSearcher) { +resource functionAppWebSearcherPlugin 'Microsoft.Web/sites@2022-09-01' = if (deployWebSearcherPlugin) { name: 'function-${uniqueName}-websearcher-plugin' location: location kind: 'functionapp' @@ -620,7 +616,7 @@ resource functionAppWebSearcherPlugin 'Microsoft.Web/sites@2022-09-01' = if (dep } } -resource functionAppWebSearcherPluginConfig 'Microsoft.Web/sites/config@2022-09-01' = if (deployWebSearcher) { +resource functionAppWebSearcherPluginConfig 'Microsoft.Web/sites/config@2022-09-01' = if (deployWebSearcherPlugin) { parent: functionAppWebSearcherPlugin name: 'web' properties: { @@ -644,13 +640,13 @@ resource functionAppWebSearcherPluginConfig 'Microsoft.Web/sites/config@2022-09- } { name: 'PluginConfig:BingApiKey' - value: (deployWebSearcher) ? bingSearchService.listKeys().key1 : '' + value: (deployWebSearcherPlugin) ? bingSearchService.listKeys().key1 : '' } ] } } -resource functionAppWebSearcherDeploy 'Microsoft.Web/sites/extensions@2022-09-01' = if (deployPackages && deployWebSearcher) { +resource functionAppWebSearcherDeploy 'Microsoft.Web/sites/extensions@2022-09-01' = if (deployPackages && deployWebSearcherPlugin) { name: 'MSDeploy' kind: 'string' parent: functionAppWebSearcherPlugin @@ -687,7 +683,7 @@ resource appInsightExtensionMemory 'Microsoft.Web/sites/siteextensions@2022-09-0 dependsOn: [ appServiceMemoryPipelineDeploy ] } -resource appInsightExtensionWebSearchPlugin 'Microsoft.Web/sites/siteextensions@2022-09-01' = if (deployWebSearcher) { +resource appInsightExtensionWebSearchPlugin 'Microsoft.Web/sites/siteextensions@2022-09-01' = if (deployWebSearcherPlugin) { parent: functionAppWebSearcherPlugin name: 'Microsoft.ApplicationInsights.AzureWebSites' dependsOn: [ functionAppWebSearcherDeploy ] @@ -1111,7 +1107,7 @@ resource ocrAccount 'Microsoft.CognitiveServices/accounts@2022-12-01' = { } } -resource bingSearchService 'Microsoft.Bing/accounts@2020-06-10' = if (deployWebSearcher) { +resource bingSearchService 'Microsoft.Bing/accounts@2020-06-10' = if (deployWebSearcherPlugin) { name: 'bing-search-${uniqueName}' location: 'global' sku: { @@ -1125,5 +1121,5 @@ output webapiName string = appServiceWeb.name output memoryPipelineName string = appServiceMemoryPipeline.name output pluginNames array = concat( [], - (deployWebSearcher) ? [ functionAppWebSearcherPlugin.name ] : [] + (deployWebSearcherPlugin) ? [ functionAppWebSearcherPlugin.name ] : [] )