Skip to content

Commit

Permalink
Merge pull request #392 from microsoft/ryonsteele/6288-remove-dup-cog…
Browse files Browse the repository at this point in the history
…service

Remove unused cogservices account
  • Loading branch information
ryonsteele committed Dec 12, 2023
2 parents e32ea64 + 1590e4c commit 6641eed
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 39 deletions.
2 changes: 1 addition & 1 deletion docs/deployment/worbook_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Azure Workbook template `infoasst-lw-xxxx` is designed for log analysis, pro
- Default Query:
```kql
AppServiceConsoleLogs
| project TimeGenerated, Level, ResultDescription, _ResourceId
| project TimeGenerated, ResultDescription, _ResourceId
| where TimeGenerated > ago(6h)
| order by TimeGenerated desc
```
Expand Down
1 change: 1 addition & 0 deletions functions/FileLayoutParsingOther/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def PartitionFile(file_extension: str, file_url: str):
bytes_io = BytesIO(response.content)
response.close()
metadata = []
elements = None
try:
if file_extension == '.csv':
from unstructured.partition.csv import partition_csv
Expand Down
2 changes: 1 addition & 1 deletion infra/core/logging/monitor.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource logworkbook 'Microsoft.Insights/workbooktemplates@2020-11-20' = {
type: 3
content: {
version: 'KqlItem/1.0'
query: 'AppServiceConsoleLogs | project TimeGenerated, Level, ResultDescription, _ResourceId | where TimeGenerated > ago(6h) | order by TimeGenerated desc'
query: 'AppServiceConsoleLogs | project TimeGenerated, ResultDescription, _ResourceId | where TimeGenerated > ago(6h) | order by TimeGenerated desc'
size: 0
timeContext: {
durationMs: 86400000
Expand Down
18 changes: 0 additions & 18 deletions infra/core/search/search-services.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
param name string
param cogServicesName string
param location string = resourceGroup().location
param tags object = {}

Expand All @@ -9,12 +8,7 @@ param sku object = {

param authOptions object = {}
param semanticSearch string = 'disabled'
param kind string = 'CognitiveServices'
param publicNetworkAccess string = 'Enabled'
param isGovCloudDeployment bool
param cogServicesSku object = {
name: 'S0'
}

resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = {
name: name
Expand Down Expand Up @@ -43,21 +37,9 @@ resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = {
sku: sku
}

resource cogService 'Microsoft.CognitiveServices/accounts@2022-10-01' = {
name: cogServicesName
location: location
tags: tags
kind: kind
properties: {
publicNetworkAccess: publicNetworkAccess
}
sku: cogServicesSku
}

output id string = search.id
output endpoint string = (isGovCloudDeployment) ? 'https://${name}.search.azure.us/' : 'https://${name}.search.windows.net/'
output name string = search.name
#disable-next-line outputs-should-not-contain-secrets
output searchServiceKey string = search.listAdminKeys().primaryKey
#disable-next-line outputs-should-not-contain-secrets
output cogServiceKey string = cogService.listKeys().key1
10 changes: 0 additions & 10 deletions infra/core/security/keyvault.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ param searchServiceKey string
@secure()
param openaiServiceKey string
@secure()
param cogServicesSearchKey string
@secure()
param cosmosdbKey string
@secure()
param formRecognizerKey string
Expand Down Expand Up @@ -66,14 +64,6 @@ resource openaiServiceKeySecret 'Microsoft.KeyVault/vaults/secrets@2019-09-01' =
}
}

resource cogServicesSearchKeySecret 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = {
parent: kv
name: 'COGNITIVE-SERVICES-KEY'
properties: {
value: cogServicesSearchKey
}
}

resource cosmosdbKeySecret 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = {
parent: kv
name: 'COSMOSDB-KEY'
Expand Down
7 changes: 0 additions & 7 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ param azureOpenAIResourceGroup string
param azureOpenAIServiceKey string
param openAiServiceName string = ''
param openAiSkuName string = 'S0'
param cognitiveServiesForSearchName string = ''
param cosmosdbName string = ''
param formRecognizerName string = ''
param enrichmentName string = ''
param formRecognizerSkuName string = 'S0'
param enrichmentSkuName string = 'S0'
param cognitiveServiesForSearchSku string = 'S0'
param appServicePlanName string = ''
param enrichmentAppServicePlanName string = ''
param resourceGroupName string = ''
Expand Down Expand Up @@ -378,10 +376,6 @@ module searchServices 'core/search/search-services.bicep' = {
name: searchServicesSkuName
}
semanticSearch: 'free'
cogServicesName: !empty(cognitiveServiesForSearchName) ? cognitiveServiesForSearchName : '${prefix}-${abbrs.cognitiveServicesAccounts}${randomString}'
cogServicesSku: {
name: cognitiveServiesForSearchSku
}
isGovCloudDeployment: isGovCloudDeployment
}
}
Expand Down Expand Up @@ -713,7 +707,6 @@ module kvModule 'core/security/keyvault.bicep' = {
kvAccessObjectId: kvAccessObjectId
searchServiceKey: searchServices.outputs.searchServiceKey
openaiServiceKey: azureOpenAIServiceKey
cogServicesSearchKey: searchServices.outputs.cogServiceKey
cosmosdbKey: cosmosdb.outputs.CosmosDBKey
formRecognizerKey: formrecognizer.outputs.formRecognizerAccountKey
blobConnectionString: storage.outputs.connectionString
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 @@ -153,7 +153,7 @@ fi
# Name of your Key Vault
keyVaultName=$(cat infra_output.json | jq -r .properties.outputs.deploymenT_KEYVAULT_NAME.value)
# Names of your secrets
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "COGNITIVE-SERVICES-KEY" "AZURE-OPENAI-SERVICE-KEY")
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "AZURE-OPENAI-SERVICE-KEY")

# 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 @@ -177,7 +177,7 @@ fi
keyVaultName=$(cat infra_output.json | jq -r .properties.outputs.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" "COGNITIVE-SERVICES-KEY" "AZURE-CLIENT-SECRET")
secretNames=("AZURE-SEARCH-SERVICE-KEY" "AZURE-BLOB-STORAGE-KEY" "BLOB-CONNECTION-STRING" "COSMOSDB-KEY" "AZURE-OPENAI-SERVICE-KEY" "AZURE-CLIENT-SECRET")

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

0 comments on commit 6641eed

Please sign in to comment.