Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KyleWerts/7279-Bing-Search-KeyVault #599

Merged
merged 15 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions infra/core/ai/bingSearch/bingSearch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ resource "azurerm_resource_group_template_deployment" "bing_search" {
# this ensures the keys are up-to-date
name = "bingsearch-${filemd5(local.arm_file_path)}"
deployment_mode = "Incremental"
}
dayland marked this conversation as resolved.
Show resolved Hide resolved

resource "azurerm_key_vault_secret" "search_service_key" {
dayland marked this conversation as resolved.
Show resolved Hide resolved
name = "BINGSEARCH-KEY"
value = jsondecode(azurerm_resource_group_template_deployment.bing_search.output_content).key1.value
key_vault_id = var.keyVaultId
}
6 changes: 5 additions & 1 deletion infra/core/ai/bingSearch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ variable "sku" {
type = string
}


variable "arm_template_schema_mgmt_api" {
type = string
}

variable "keyVaultId" {
type = string
sensitive = true
}
1 change: 1 addition & 0 deletions infra/core/host/enrichmentapp/enrichmentapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ resource "azurerm_linux_web_app" "app_service" {
"AZURE_SEARCH_SERVICE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-SEARCH-SERVICE-KEY)"
"COSMOSDB_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/COSMOSDB-KEY)"
"ENRICHMENT_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/ENRICHMENT-KEY)"
"BING_SEARCH_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/BINGSEARCH-KEY)"
KyleWerts marked this conversation as resolved.
Show resolved Hide resolved
"AZURE_BLOB_STORAGE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-BLOB-STORAGE-KEY)"
"BLOB_CONNECTION_STRING" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/BLOB-CONNECTION-STRING)"
"AZURE_STORAGE_CONNECTION_STRING" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/BLOB-CONNECTION-STRING)"
Expand Down
1 change: 1 addition & 0 deletions infra/core/host/functions/functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ resource "azurerm_linux_function_app" "function_app" {
EMBEDDINGS_QUEUE = var.EMBEDDINGS_QUEUE
AZURE_SEARCH_SERVICE_KEY = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-SEARCH-SERVICE-KEY)"
COSMOSDB_KEY = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/COSMOSDB-KEY)"
BING_SEARCH_KEY = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/BINGSEARCH-KEY)"
KyleWerts marked this conversation as resolved.
Show resolved Hide resolved
AZURE_SEARCH_SERVICE_ENDPOINT = var.azureSearchServiceEndpoint
AZURE_SEARCH_INDEX = var.azureSearchIndex
AZURE_AI_TRANSLATION_DOMAIN = var.azure_ai_translation_domain
Expand Down
11 changes: 6 additions & 5 deletions infra/core/host/webapp/webapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ resource "azurerm_linux_web_app" "app_service" {
"SCM_DO_BUILD_DURING_DEPLOYMENT" = lower(tostring(var.scmDoBuildDuringDeployment))
"ENABLE_ORYX_BUILD" = lower(tostring(var.enableOryxBuild))
"APPLICATIONINSIGHTS_CONNECTION_STRING" = var.applicationInsightsConnectionString
"AZURE_SEARCH_SERVICE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-SEARCH-SERVICE-KEY)"
"COSMOSDB_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/COSMOSDB-KEY)"
"AZURE_BLOB_STORAGE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-BLOB-STORAGE-KEY)"
"ENRICHMENT_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/ENRICHMENT-KEY)"
"AZURE_OPENAI_SERVICE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-OPENAI-SERVICE-KEY)"
"AZURE_SEARCH_SERVICE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-SEARCH-SERVICE-KEY)"
dayland marked this conversation as resolved.
Show resolved Hide resolved
"COSMOSDB_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/COSMOSDB-KEY)"
"BING_SEARCH_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/BINGSEARCH-KEY)"
"AZURE_BLOB_STORAGE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-BLOB-STORAGE-KEY)"
"ENRICHMENT_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/ENRICHMENT-KEY)"
"AZURE_OPENAI_SERVICE_KEY" = "@Microsoft.KeyVault(SecretUri=${var.keyVaultUri}secrets/AZURE-OPENAI-SERVICE-KEY)"
}
)

Expand Down
2 changes: 1 addition & 1 deletion infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ module "backend" {
AZURE_AI_TRANSLATION_DOMAIN = var.azure_ai_translation_domain
USE_SEMANTIC_RERANKER = var.use_semantic_reranker
BING_SEARCH_ENDPOINT = var.enableWebChat ? module.bingSearch[0].endpoint : ""
BING_SEARCH_KEY = var.enableWebChat ? module.bingSearch[0].key : ""
ENABLE_WEB_CHAT = var.enableWebChat
ENABLE_BING_SAFE_SEARCH = var.enableBingSafeSearch
ENABLE_UNGROUNDED_CHAT = var.enableUngroundedChat
Expand Down Expand Up @@ -482,6 +481,7 @@ module "bingSearch" {
tags = local.tags
sku = "S1" //supported SKUs can be found at https://www.microsoft.com/en-us/bing/apis/pricing
arm_template_schema_mgmt_api = var.arm_template_schema_mgmt_api
keyVaultId = module.kvModule.keyVaultId
}

// DEPLOYMENT OF AZURE CUSTOMER ATTRIBUTION TAG
Expand Down
2 changes: 1 addition & 1 deletion scripts/json-to-env.function.debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ secrets="{"
keyVaultName=$(cat inf_output.json | jq -r .DEPLOYMENT_KEYVAULT_NAME.value)

# Names of your secrets
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "AZURE-FORM-RECOGNIZER-KEY" "ENRICHMENT-KEY")
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "BINGSEARCH-KEY" "AZURE-FORM-RECOGNIZER-KEY" "ENRICHMENT-KEY")
KyleWerts marked this conversation as resolved.
Show resolved Hide resolved
azWebJobSecretName="BLOB-CONNECTION-STRING"
azWebJobVarName="AzureWebJobsStorage"

Expand Down
2 changes: 1 addition & 1 deletion scripts/json-to-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fi
# Name of your Key Vault
keyVaultName=$(cat inf_output.json | jq -r .DEPLOYMENT_KEYVAULT_NAME.value)
# Names of your secrets
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "AZURE-OPENAI-SERVICE-KEY")
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "BINGSEARCH-KEY" "AZURE-OPENAI-SERVICE-KEY")
KyleWerts marked this conversation as resolved.
Show resolved Hide resolved

# Retrieve and export each secret
for secretName in "${secretNames[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion scripts/json-to-env.webapp.debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fi
keyVaultName=$(cat inf_output.json | jq -r .DEPLOYMENT_KEYVAULT_NAME.value)

# Names of your secrets
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "AZURE-OPENAI-SERVICE-KEY" "AZURE-CLIENT-SECRET" "ENRICHMENT-KEY")
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "BINGSEARCH-KEY" "AZURE-OPENAI-SERVICE-KEY" "AZURE-CLIENT-SECRET" "ENRICHMENT-KEY")

# Retrieve and export each secret
for secretName in "${secretNames[@]}"; do
Expand Down
Loading