Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoChenOSU committed Oct 17, 2023
1 parent 5fdc753 commit 74aac6a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy-azure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"}) }
}
"

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy-azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
24 changes: 10 additions & 14 deletions scripts/deploy/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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: {
Expand All @@ -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
Expand Down Expand Up @@ -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 ]
Expand Down Expand Up @@ -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: {
Expand All @@ -1125,5 +1121,5 @@ output webapiName string = appServiceWeb.name
output memoryPipelineName string = appServiceMemoryPipeline.name
output pluginNames array = concat(
[],
(deployWebSearcher) ? [ functionAppWebSearcherPlugin.name ] : []
(deployWebSearcherPlugin) ? [ functionAppWebSearcherPlugin.name ] : []
)

0 comments on commit 74aac6a

Please sign in to comment.