diff --git a/5.internal-document-search/infra/core/ai/cognitiveservices.bicep b/5.internal-document-search/infra/core/ai/cognitiveservices.bicep index e19dfe03..f23be812 100644 --- a/5.internal-document-search/infra/core/ai/cognitiveservices.bicep +++ b/5.internal-document-search/infra/core/ai/cognitiveservices.bicep @@ -3,7 +3,6 @@ param location string = resourceGroup().location param tags object = {} param customSubDomainName string = name -param deployments array = [] param kind string = 'OpenAI' @allowed(['Enabled', 'Disabled']) param publicNetworkAccess string = 'Enabled' @@ -11,6 +10,74 @@ param sku object = { name: 'S0' } +param useOpenAiGpt4 bool = true +param openAiGpt35TurboDeploymentName string = '' +param openAiGpt35Turbo16kDeploymentName string = '' +param openAiGpt4DeploymentName string = '' +param openAiGpt432kDeploymentName string = '' + +param openAiGpt35TurboDeployObj object = { + name: openAiGpt35TurboDeploymentName + model: { + format: 'OpenAI' + name: 'gpt-35-turbo' + version: '0613' + } + sku: { + name: 'Standard' + capacity: 120 + } +} + +param openAiGpt35Turbo16kDeployObj object = { + name: openAiGpt35Turbo16kDeploymentName + model: { + format: 'OpenAI' + name: 'gpt-35-turbo-16k' + version: '0613' + } + sku: { + name: 'Standard' + capacity: 120 + } +} + +param openAiGpt4DeployObj object = { + name: openAiGpt4DeploymentName + model: { + format: 'OpenAI' + name: 'gpt-4' + version: '0613' + } + sku: { + name: 'Standard' + capacity: 40 + } +} + +param openAiGpt432kDeployObj object = { + name: openAiGpt432kDeploymentName + model: { + format: 'OpenAI' + name: 'gpt-4-32k' + version: '0613' + } + sku: { + name: 'Standard' + capacity: 40 + } +} + +param deployments array = useOpenAiGpt4? [ + openAiGpt35TurboDeployObj + openAiGpt35Turbo16kDeployObj + openAiGpt4DeployObj + openAiGpt432kDeployObj +]: [ + openAiGpt35TurboDeployObj + openAiGpt35Turbo16kDeployObj +] + resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = { name: name location: location diff --git a/5.internal-document-search/infra/core/db/cosmosdb.bicep b/5.internal-document-search/infra/core/db/cosmosdb.bicep index b08f5598..a015ed3e 100644 --- a/5.internal-document-search/infra/core/db/cosmosdb.bicep +++ b/5.internal-document-search/infra/core/db/cosmosdb.bicep @@ -6,7 +6,7 @@ param tags object = {} @allowed(['Enabled', 'Disabled']) param publicNetworkAccess string -resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2021-04-15' = { +resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = { name: name location: location tags: tags diff --git a/5.internal-document-search/infra/core/host/appservice.bicep b/5.internal-document-search/infra/core/host/appservice.bicep index 252e16c8..c167a49b 100644 --- a/5.internal-document-search/infra/core/host/appservice.bicep +++ b/5.internal-document-search/infra/core/host/appservice.bicep @@ -40,7 +40,7 @@ param ftpsState string = 'FtpsOnly' param healthCheckPath string = '' param virtualNetworkSubnetId string -resource appService 'Microsoft.Web/sites@2022-03-01' = { +resource appService 'Microsoft.Web/sites@2022-09-01' = { name: name location: location tags: tags @@ -95,7 +95,7 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = { } } -resource keyVault 'Microsoft.KeyVault/vaults@2023-02-01' existing = if (!(empty(keyVaultName))) { +resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = if (!(empty(keyVaultName))) { name: keyVaultName } diff --git a/5.internal-document-search/infra/core/host/appserviceplan.bicep b/5.internal-document-search/infra/core/host/appserviceplan.bicep index c444f406..75e10e6b 100644 --- a/5.internal-document-search/infra/core/host/appserviceplan.bicep +++ b/5.internal-document-search/infra/core/host/appserviceplan.bicep @@ -6,7 +6,7 @@ param kind string = '' param reserved bool = true param sku object -resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { +resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = { name: name location: location tags: tags diff --git a/5.internal-document-search/infra/core/monitor/loganalytics.bicep b/5.internal-document-search/infra/core/monitor/loganalytics.bicep index 4188d6a2..fb40c21b 100644 --- a/5.internal-document-search/infra/core/monitor/loganalytics.bicep +++ b/5.internal-document-search/infra/core/monitor/loganalytics.bicep @@ -2,7 +2,7 @@ param workspaceName string = '' param location string = resourceGroup().location param tags object = {} -resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-03-01-preview' = { +resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { name: workspaceName location: location tags: tags diff --git a/5.internal-document-search/infra/core/network/nic.bicep b/5.internal-document-search/infra/core/network/nic.bicep index 5dcb5473..58764a73 100644 --- a/5.internal-document-search/infra/core/network/nic.bicep +++ b/5.internal-document-search/infra/core/network/nic.bicep @@ -5,7 +5,7 @@ param publicIPId string param nsgId string param isPrivateNetworkEnabled bool -resource networkInterface 'Microsoft.Network/networkInterfaces@2021-02-01' = if (isPrivateNetworkEnabled) { +resource networkInterface 'Microsoft.Network/networkInterfaces@2023-11-01' = if (isPrivateNetworkEnabled) { name: name location: location properties: { diff --git a/5.internal-document-search/infra/core/network/nsg.bicep b/5.internal-document-search/infra/core/network/nsg.bicep index 7b332527..e96c7750 100644 --- a/5.internal-document-search/infra/core/network/nsg.bicep +++ b/5.internal-document-search/infra/core/network/nsg.bicep @@ -2,7 +2,7 @@ param name string param location string param isPrivateNetworkEnabled bool -resource nsg 'Microsoft.Network/networkSecurityGroups@2021-02-01' = if (isPrivateNetworkEnabled) { +resource nsg 'Microsoft.Network/networkSecurityGroups@2023-11-01' = if (isPrivateNetworkEnabled) { name: name location: location properties: { diff --git a/5.internal-document-search/infra/core/network/pip.bicep b/5.internal-document-search/infra/core/network/pip.bicep index 12f2f6f4..5437e6d6 100644 --- a/5.internal-document-search/infra/core/network/pip.bicep +++ b/5.internal-document-search/infra/core/network/pip.bicep @@ -2,7 +2,7 @@ param name string param location string param isPrivateNetworkEnabled bool -resource publicIP 'Microsoft.Network/publicIPAddresses@2021-02-01' = if (isPrivateNetworkEnabled) { +resource publicIP 'Microsoft.Network/publicIPAddresses@2023-11-01' = if (isPrivateNetworkEnabled) { name: name location: location properties: { diff --git a/5.internal-document-search/infra/core/network/privateEndpoint.bicep b/5.internal-document-search/infra/core/network/privateEndpoint.bicep index 01dfaceb..230a339b 100644 --- a/5.internal-document-search/infra/core/network/privateEndpoint.bicep +++ b/5.internal-document-search/infra/core/network/privateEndpoint.bicep @@ -25,7 +25,7 @@ resource virtualNetworkLinks 'Microsoft.Network/privateDnsZones/virtualNetworkLi } // https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/private-link/private-endpoint-overview.md -resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-02-01' = if (isPrivateNetworkEnabled) { +resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = if (isPrivateNetworkEnabled) { name: '${name}-endpoint' location: location properties: { @@ -44,7 +44,7 @@ resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-02-01' = if (i } } -resource privateDnsZoneGroup 'Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2023-04-01' = if (isPrivateNetworkEnabled) { +resource privateDnsZoneGroup 'Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2023-11-01' = if (isPrivateNetworkEnabled) { parent: privateEndpoint name: privateDnsZone.name properties: { diff --git a/5.internal-document-search/infra/core/network/subnet.bicep b/5.internal-document-search/infra/core/network/subnet.bicep index 15c1eb13..3bfc9403 100644 --- a/5.internal-document-search/infra/core/network/subnet.bicep +++ b/5.internal-document-search/infra/core/network/subnet.bicep @@ -5,12 +5,12 @@ param networkSecurityGroup object = {} param delegations array = [] param isPrivateNetworkEnabled bool -resource existVnet 'Microsoft.Network/virtualNetworks@2021-02-01' existing = if (isPrivateNetworkEnabled) { +resource existVnet 'Microsoft.Network/virtualNetworks@2023-11-01' existing = if (isPrivateNetworkEnabled) { scope: resourceGroup() name: existVnetName } -resource subnet 'Microsoft.Network/virtualNetworks/subnets@2023-02-01' = if (isPrivateNetworkEnabled) { +resource subnet 'Microsoft.Network/virtualNetworks/subnets@2023-11-01' = if (isPrivateNetworkEnabled) { parent: existVnet name: name properties: { diff --git a/5.internal-document-search/infra/core/network/vnet.bicep b/5.internal-document-search/infra/core/network/vnet.bicep index 22692e53..14d8306d 100644 --- a/5.internal-document-search/infra/core/network/vnet.bicep +++ b/5.internal-document-search/infra/core/network/vnet.bicep @@ -3,7 +3,7 @@ param location string param addressPrefixes array param isPrivateNetworkEnabled bool -resource vnet 'Microsoft.Network/virtualNetworks@2023-02-01' = if (isPrivateNetworkEnabled) { +resource vnet 'Microsoft.Network/virtualNetworks@2023-11-01' = if (isPrivateNetworkEnabled) { name: name location: location properties: { diff --git a/5.internal-document-search/infra/core/search/search-services.bicep b/5.internal-document-search/infra/core/search/search-services.bicep index 894716a1..a117ff1b 100644 --- a/5.internal-document-search/infra/core/search/search-services.bicep +++ b/5.internal-document-search/infra/core/search/search-services.bicep @@ -9,7 +9,7 @@ param sku object = { param authOptions object = {} param semanticSearch string = 'disabled' -resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = { +resource search 'Microsoft.Search/searchServices@2023-11-01' = { name: name location: location tags: tags @@ -19,17 +19,15 @@ resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = { properties: { authOptions: authOptions disableLocalAuth: false - disabledDataExfiltrationOptions: [] encryptionWithCmk: { enforcement: 'Unspecified' } hostingMode: 'default' networkRuleSet: { - bypass: 'None' ipRules: [] } partitionCount: 1 - publicNetworkAccess: 'Enabled' + publicNetworkAccess: 'enabled' replicaCount: 1 semanticSearch: semanticSearch } diff --git a/5.internal-document-search/infra/core/storage/storage-account.bicep b/5.internal-document-search/infra/core/storage/storage-account.bicep index 4cf22e70..e766201c 100644 --- a/5.internal-document-search/infra/core/storage/storage-account.bicep +++ b/5.internal-document-search/infra/core/storage/storage-account.bicep @@ -19,7 +19,7 @@ param sku object = { name: 'Standard_LRS' } param containers array = [] -resource storage 'Microsoft.Storage/storageAccounts@2022-05-01' = { +resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = { name: name location: location tags: tags diff --git a/5.internal-document-search/infra/core/vm/vm.bicep b/5.internal-document-search/infra/core/vm/vm.bicep index 11d32a79..a3677721 100644 --- a/5.internal-document-search/infra/core/vm/vm.bicep +++ b/5.internal-document-search/infra/core/vm/vm.bicep @@ -15,7 +15,7 @@ param imageReference object = { version: 'latest' } -resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-04-01' = if (isPrivateNetworkEnabled) { +resource virtualMachine 'Microsoft.Compute/virtualMachines@2023-09-01' = if (isPrivateNetworkEnabled) { name: name location: location properties: { diff --git a/5.internal-document-search/infra/main.bicep b/5.internal-document-search/infra/main.bicep index 31ed8056..cddbb3f5 100644 --- a/5.internal-document-search/infra/main.bicep +++ b/5.internal-document-search/infra/main.bicep @@ -35,17 +35,33 @@ param storageContainerName string = 'content' param openAiServiceName string = '' param openAiResourceGroupName string = '' -param openAiResourceGroupLocation string = location -param openAiSkuName string = 'S0' +@allowed([ + '1. australiaeast (You can deploy GPT-4 and GPT-3 models)' + '2. canadaeast (You can deploy GPT-4 and GPT-3 models)' + '3. swedencentral (You can deploy GPT-4 and GPT-3 models)' + '4. switzerlandnorth (You can deploy GPT-4 and GPT-3 models)' + '5. eastus (You can deploy only GPT-3 models)' + '6. eastus2 (You can deploy only GPT-3 models)' + '7. francecentral (You can deploy only GPT-3 models)' + '8. japaneast (You can deploy only GPT-3 models)' + '9. northcentralus (You can deploy only GPT-3 models)' + '10. uksouth (You can deploy only GPT-3 models)' +]) +param AzureOpenAIServiceRegion string + +param delimiters array = ['.', '('] +param aoaiRegionWithBlankSpace string = split(AzureOpenAIServiceRegion, delimiters)[1] +param openAiResourceGroupLocation string = trim(aoaiRegionWithBlankSpace) +param useOpenAiGpt4 bool = contains(AzureOpenAIServiceRegion, 'GPT-4') +param openAiSkuName string = 'S0' param openAiGpt35TurboDeploymentName string = 'gpt-35-turbo-deploy' param openAiGpt35Turbo16kDeploymentName string = 'gpt-35-turbo-16k-deploy' param openAiGpt4DeploymentName string = 'gpt-4-deploy' param openAiGpt432kDeploymentName string = 'gpt-4-32k-deploy' param openAiApiVersion string = '2023-05-15' - param formRecognizerServiceName string = '' param formRecognizerResourceGroupName string = '' param formRecognizerResourceGroupLocation string = location @@ -102,29 +118,29 @@ var resourceToken = toLower(uniqueString(subscription().id, environmentName, loc var tags = { 'azd-env-name': environmentName } // Organize resources in a resource group -resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { +resource resourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' = { name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}' location: location tags: tags } -resource openAiResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(openAiResourceGroupName)) { +resource openAiResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' existing = if (!empty(openAiResourceGroupName)) { name: !empty(openAiResourceGroupName) ? openAiResourceGroupName : resourceGroup.name } -resource formRecognizerResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(formRecognizerResourceGroupName)) { +resource formRecognizerResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' existing = if (!empty(formRecognizerResourceGroupName)) { name: !empty(formRecognizerResourceGroupName) ? formRecognizerResourceGroupName : resourceGroup.name } -resource searchServiceResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(searchServiceResourceGroupName)) { +resource searchServiceResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' existing = if (!empty(searchServiceResourceGroupName)) { name: !empty(searchServiceResourceGroupName) ? searchServiceResourceGroupName : resourceGroup.name } -resource storageResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(storageResourceGroupName)) { +resource storageResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' existing = if (!empty(storageResourceGroupName)) { name: !empty(storageResourceGroupName) ? storageResourceGroupName : resourceGroup.name } -resource apiManagementResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (!empty(apiManagementResourceGroupName)) { +resource apiManagementResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' existing = if (!empty(apiManagementResourceGroupName)) { name: !empty(apiManagementResourceGroupName) ? apiManagementResourceGroupName : resourceGroup.name } @@ -217,56 +233,11 @@ module openAi 'core/ai/cognitiveservices.bicep' = { sku: { name: openAiSkuName } - deployments: [ - { - name: openAiGpt35TurboDeploymentName - model: { - format: 'OpenAI' - name: 'gpt-35-turbo' - version: '0613' - } - sku: { - name: 'Standard' - capacity: 120 - } - } - { - name: openAiGpt35Turbo16kDeploymentName - model: { - format: 'OpenAI' - name: 'gpt-35-turbo-16k' - version: '0613' - } - sku: { - name: 'Standard' - capacity: 120 - } - } - { - name: openAiGpt4DeploymentName - model: { - format: 'OpenAI' - name: 'gpt-4' - version: '0613' - } - sku: { - name: 'Standard' - capacity: 120 - } - } - { - name: openAiGpt432kDeploymentName - model: { - format: 'OpenAI' - name: 'gpt-4-32k' - version: '0613' - } - sku: { - name: 'Standard' - capacity: 120 - } - } - ] + useOpenAiGpt4: useOpenAiGpt4 + openAiGpt35TurboDeploymentName: openAiGpt35TurboDeploymentName + openAiGpt35Turbo16kDeploymentName: openAiGpt35Turbo16kDeploymentName + openAiGpt4DeploymentName: openAiGpt4DeploymentName + openAiGpt432kDeploymentName: openAiGpt432kDeploymentName publicNetworkAccess: isPrivateNetworkEnabled ? 'Disabled' : 'Enabled' } } @@ -282,6 +253,7 @@ module formRecognizer 'core/ai/cognitiveservices.bicep' = { sku: { name: formRecognizerSkuName } + deployments: [] } } @@ -736,6 +708,8 @@ output AZURE_OPENAI_GPT_35_TURBO_16K_DEPLOYMENT string = openAiGpt35Turbo16kDepl output AZURE_OPENAI_GPT_4_DEPLOYMENT string = openAiGpt4DeploymentName output AZURE_OPENAI_GPT_4_32K_DEPLOYMENT string = openAiGpt432kDeploymentName output AZURE_OPENAI_API_VERSION string = openAiApiVersion +output AZURE_OPENAI_RESOURCE_GROUP_LOCATION string = openAiResourceGroupLocation +output USE_OPENAI_GPT4 bool = useOpenAiGpt4 output AZURE_FORMRECOGNIZER_SERVICE string = formRecognizer.outputs.name output AZURE_FORMRECOGNIZER_RESOURCE_GROUP string = formRecognizerResourceGroup.name