Skip to content

Commit

Permalink
fix: Fix computer vision for deployments (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecheta authored May 15, 2024
1 parent 4150955 commit 548a767
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion infra/app/function.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module function '../core/host/functions.bicep' = {
AZURE_FORM_RECOGNIZER_KEY: useKeyVault ? formRecognizerKeyName : listKeys(resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', formRecognizerName), '2023-05-01').key1
AZURE_CONTENT_SAFETY_KEY: useKeyVault ? contentSafetyKeyName : listKeys(resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', contentSafetyName), '2023-05-01').key1
AZURE_SPEECH_SERVICE_KEY: useKeyVault ? speechKeyName : listKeys(resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', speechServiceName), '2023-05-01').key1
AZURE_COMPUTER_VISION_KEY: useKeyVault ? computerVisionKeyName : listKeys(resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', computerVisionName), '2023-05-01').key1
AZURE_COMPUTER_VISION_KEY: (useKeyVault || computerVisionName == '') ? computerVisionKeyName : listKeys(resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', computerVisionName), '2023-05-01').key1
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions infra/app/storekeys.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ resource speechKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
}
}

resource computerVisionKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
resource computerVisionKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = if (computerVisionName != '') {
parent: keyVault
name: computerVisionKeyName
properties: {
value: listKeys(resourceId(subscription().subscriptionId, rgName, 'Microsoft.CognitiveServices/accounts', computerVisionName), '2023-05-01').key1
value: computerVisionName != '' ? listKeys(resourceId(subscription().subscriptionId, rgName, 'Microsoft.CognitiveServices/accounts', computerVisionName), '2023-05-01').key1 : ''
}
}

Expand All @@ -81,4 +81,4 @@ output SEARCH_KEY_NAME string = searchKeySecret.name
output OPENAI_KEY_NAME string = openAIKeySecret.name
output STORAGE_ACCOUNT_KEY_NAME string = storageAccountKeySecret.name
output SPEECH_KEY_NAME string = speechKeySecret.name
output COMPUTER_VISION_KEY_NAME string = computerVisionKeySecret.name
output COMPUTER_VISION_KEY_NAME string = computerVisionName != '' ? computerVisionKeySecret.name : ''
14 changes: 8 additions & 6 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ module storekeys './app/storekeys.bicep' = if (useKeyVault) {
formRecognizerName: formrecognizer.outputs.name
contentSafetyName: contentsafety.outputs.name
speechServiceName: speechServiceName
computerVisionName: computerVision.outputs.name
computerVisionName: useAdvancedImageProcessing ? computerVision.outputs.name : ''
rgName: rgName
}
}
Expand Down Expand Up @@ -783,7 +783,7 @@ module function './app/function.bicep' = if (hostingModel == 'code') {
formRecognizerName: formrecognizer.outputs.name
contentSafetyName: contentsafety.outputs.name
speechServiceName: speechService.outputs.name
computerVisionName: computerVision.outputs.name
computerVisionName: useAdvancedImageProcessing ? computerVision.outputs.name : ''
clientKey: clientKey
openAIKeyName: useKeyVault ? storekeys.outputs.OPENAI_KEY_NAME : ''
storageAccountKeyName: useKeyVault ? storekeys.outputs.STORAGE_ACCOUNT_KEY_NAME : ''
Expand Down Expand Up @@ -812,7 +812,7 @@ module function './app/function.bicep' = if (hostingModel == 'code') {
AZURE_SEARCH_INDEXER_NAME: azureSearchIndexer
AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION: azureSearchUseIntegratedVectorization
USE_ADVANCED_IMAGE_PROCESSING: useAdvancedImageProcessing
AZURE_COMPUTER_VISION_ENDPOINT: computerVision.outputs.endpoint
AZURE_COMPUTER_VISION_ENDPOINT: useAdvancedImageProcessing ? computerVision.outputs.endpoint : ''
DOCUMENT_PROCESSING_QUEUE_NAME: queueName
ORCHESTRATION_STRATEGY: orchestrationStrategy
LOGLEVEL: logLevel
Expand All @@ -836,14 +836,15 @@ module function_docker './app/function.bicep' = if (hostingModel == 'container')
formRecognizerName: formrecognizer.outputs.name
contentSafetyName: contentsafety.outputs.name
speechServiceName: speechService.outputs.name
computerVisionName: useAdvancedImageProcessing ? computerVision.outputs.name : ''
clientKey: clientKey
openAIKeyName: useKeyVault ? storekeys.outputs.OPENAI_KEY_NAME : ''
storageAccountKeyName: useKeyVault ? storekeys.outputs.STORAGE_ACCOUNT_KEY_NAME : ''
formRecognizerKeyName: useKeyVault ? storekeys.outputs.FORM_RECOGNIZER_KEY_NAME : ''
searchKeyName: useKeyVault ? storekeys.outputs.SEARCH_KEY_NAME : ''
contentSafetyKeyName: useKeyVault ? storekeys.outputs.CONTENT_SAFETY_KEY_NAME : ''
speechKeyName: useKeyVault ? storekeys.outputs.SPEECH_KEY_NAME : ''
computerVisionName: useKeyVault ? storekeys.outputs.COMPUTER_VISION_KEY_NAME : ''
computerVisionKeyName: useKeyVault ? storekeys.outputs.COMPUTER_VISION_KEY_NAME : ''
useKeyVault: useKeyVault
keyVaultName: useKeyVault || authType == 'rbac' ? keyvault.outputs.name : ''
authType: authType
Expand All @@ -864,7 +865,7 @@ module function_docker './app/function.bicep' = if (hostingModel == 'container')
AZURE_SEARCH_INDEXER_NAME: azureSearchIndexer
AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION: azureSearchUseIntegratedVectorization
USE_ADVANCED_IMAGE_PROCESSING: useAdvancedImageProcessing
AZURE_COMPUTER_VISION_ENDPOINT: computerVision.outputs.endpoint
AZURE_COMPUTER_VISION_ENDPOINT: useAdvancedImageProcessing ? computerVision.outputs.endpoint : ''
DOCUMENT_PROCESSING_QUEUE_NAME: queueName
ORCHESTRATION_STRATEGY: orchestrationStrategy
LOGLEVEL: logLevel
Expand Down Expand Up @@ -990,6 +991,8 @@ output AZURE_APP_SERVICE_HOSTING_MODEL string = hostingModel
output AZURE_BLOB_CONTAINER_NAME string = blobContainerName
output AZURE_BLOB_ACCOUNT_NAME string = storageAccountName
output AZURE_BLOB_ACCOUNT_KEY string = useKeyVault ? storekeys.outputs.STORAGE_ACCOUNT_KEY_NAME : ''
output AZURE_COMPUTER_VISION_ENDPOINT string = useAdvancedImageProcessing ? computerVision.outputs.endpoint : ''
output AZURE_COMPUTER_VISION_KEY string = useKeyVault ? storekeys.outputs.COMPUTER_VISION_KEY_NAME : ''
output AZURE_COMPUTER_VISION_VECTORIZE_IMAGE_API_VERSION string = computerVisionVectorizeImageApiVersion
output AZURE_COMPUTER_VISION_VECTORIZE_IMAGE_MODEL_VERSION string = computerVisionVectorizeImageModelVersion
output AZURE_CONTENT_SAFETY_ENDPOINT string = contentsafety.outputs.endpoint
Expand All @@ -1011,7 +1014,6 @@ output AZURE_OPENAI_RESOURCE string = azureOpenAIResourceName
output AZURE_OPENAI_EMBEDDING_MODEL string = azureOpenAIEmbeddingModel
output AZURE_OPENAI_MODEL string = azureOpenAIModel
output AZURE_OPENAI_API_KEY string = useKeyVault ? storekeys.outputs.OPENAI_KEY_NAME : ''
output AZURE_COMPUTER_VISION_ENDPOINT string = computerVision.outputs.endpoint
output AZURE_RESOURCE_GROUP string = rgName
output AZURE_SEARCH_KEY string = useKeyVault ? storekeys.outputs.SEARCH_KEY_NAME : ''
output AZURE_SEARCH_SERVICE string = search.outputs.endpoint
Expand Down
Loading

0 comments on commit 548a767

Please sign in to comment.