Skip to content

Commit

Permalink
Added Option to select Cognitive Service Kind & Disable Azure Search (#…
Browse files Browse the repository at this point in the history
…85)

* Added Option to select Cognitive Service Kind

* Added condition to cognitive service deployment

* * Update api version of app insights
* removed linting rule

* * Enable multiple cognitive service deployments
* Allow disabling Search
* Update Portal UI

* * update params
* fix BringOwnFeatureNotEnabled

* removing qnamaker for now

* updated sku definition for two kinds

* updated kind name of text translator

* Updated docs with new parameters

* linting
  • Loading branch information
marvinbuss authored Sep 24, 2021
1 parent be01da6 commit fb9830e
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/linters/.arm-ttk.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
@{
# Test = @( )
Skip = @(
'Template Should Not Contain Blanks',
'Template Should Not Contain Blanks'
'DeploymentTemplate Must Not Contain Hardcoded Uri'
'DependsOn Best Practices',
'Outputs Must Not Contain Secrets',
'DependsOn Best Practices'
'Outputs Must Not Contain Secrets'
'IDs Should Be Derived From ResourceIDs'
'Parameters Must Be Referenced'
)
Expand Down
2 changes: 1 addition & 1 deletion .github/linters/.powershell-psscriptanalyzer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#)
#IncludeDefaultRules=${true}
ExcludeRules = @(
'PSUseShouldProcessForStateChangingFunctions',
'PSUseShouldProcessForStateChangingFunctions'
'PSReviewUnusedParameter'
'PSAvoidGlobalVars'
'PSAvoidUsingPlainTextForPassword'
Expand Down
2 changes: 2 additions & 0 deletions docs/EnterpriseScaleAnalytics-AzureDevOpsDeployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ To begin, please open the [infra/params.dev.json](/infra/params.dev.json). In th
| databricksWorkspaceUrl | Specifies the workspace URL of the Databricks workspace that will be connected to the Machine Learning Workspace. | `adb-{databricks-workspace-id}.azuredatabricks.net` |
| databricksAccessToken | Specifies the access token of the Databricks workspace that will be connected to the Machine Learning Workspace. Use a secret for this parameter and overwrite as part of the deployment pipelines. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Purview/accounts/{purview-name}` |
| enableRoleAssignments | Specifies whether role assignments should be enabled. | `true` or `false` |
| cognitiveServiceKinds | Specifies the cognitive service kind that will be deployed. | [`FormRecognizer`, `LUIS`] |
| enableSearch | Specifies whether Azure Search should be deployed as part of the template. | `true` or `false` |
| subnetId | Specifies the resource ID of the subnet to which all services will connect. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/virtualNetworks/{vnet-name}/subnets/{subnet-name}` |
| privateDnsZoneIdKeyVault | Specifies the resource ID of the private DNS zone for KeyVault. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/privateDnsZones/privatelink.vaultcore.azure.net` |
| privateDnsZoneIdSynapseDev | Specifies the resource ID of the private DNS zone for Synapse Dev. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/privateDnsZones/privatelink.dev.azuresynapse.net` |
Expand Down
2 changes: 2 additions & 0 deletions docs/EnterpriseScaleAnalytics-GitHubActionsDeployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ To begin, please open the [infra/params.dev.json](/infra/params.dev.json). In th
| databricksWorkspaceUrl | Specifies the workspace URL of the Databricks workspace that will be connected to the Machine Learning Workspace. | `adb-{databricks-workspace-id}.azuredatabricks.net` |
| databricksAccessToken | Specifies the access token of the Databricks workspace that will be connected to the Machine Learning Workspace. Use a secret for this parameter and overwrite as part of the deployment pipelines. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Purview/accounts/{purview-name}` |
| enableRoleAssignments | Specifies whether role assignments should be enabled. | `true` or `false` |
| cognitiveServiceKinds | Specifies the cognitive service kind that will be deployed. | [`FormRecognizer`, `LUIS`] |
| enableSearch | Specifies whether Azure Search should be deployed as part of the template. | `true` or `false` |
| subnetId | Specifies the resource ID of the subnet to which all services will connect. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/virtualNetworks/{vnet-name}/subnets/{subnet-name}` |
| privateDnsZoneIdKeyVault | Specifies the resource ID of the private DNS zone for KeyVault. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/privateDnsZones/privatelink.vaultcore.azure.net` |
| privateDnsZoneIdSynapseDev | Specifies the resource ID of the private DNS zone for Synapse Dev. | `/subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.Network/privateDnsZones/privatelink.dev.azuresynapse.net` |
Expand Down
92 changes: 92 additions & 0 deletions docs/reference/portal.dataProduct.json
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,96 @@
}
}
},
{
"name": "cognitiveServiceKinds",
"label": "Cognitive Services Kind",
"type": "Microsoft.Common.DropDown",
"visible": true,
"defaultValue": "None",
"toolTip": "Select the kind of Cognitive Service that should be deployed.",
"multiselect": true,
"selectAll": false,
"filter": true,
"filterPlaceholder": "Filter items ...",
"multiLine": true,
"constraints": {
"allowedValues": [
{
"label": "Anomaly Detector",
"description": "Select if you want to deploy Anomaly Detector.",
"value": "AnomalyDetector"
},
{
"label": "Computer Vision",
"description": "Select if you want to deploy Computer Vision.",
"value": "ComputerVision"
},
{
"label": "Content Moderator",
"description": "Select if you want to deploy Content Moderator.",
"value": "ContentModerator"
},
{
"label": "Custom Vision",
"description": "Select if you want to deploy Custom Vision.",
"value": "CustomVision.Training"
},
{
"label": "Face",
"description": "Select if you want to deploy Face.",
"value": "Face"
},
{
"label": "Form Recognizer",
"description": "Select if you want to deploy Form Recognizer.",
"value": "FormRecognizer"
},
{
"label": "Immersive Reader",
"description": "Select if you want to deploy Immersive Reader.",
"value": "ImmersiveReader"
},
{
"label": "LUIS",
"description": "Select if you want to deploy Language Understanding Intelligent Service.",
"value": "LUIS"
},
{
"label": "Personalizer",
"description": "Select if you want to deploy Personalizer.",
"value": "Personalizer"
},
{
"label": "Speech Services",
"description": "Select if you want to deploy Speech Services.",
"value": "SpeechServices"
},
{
"label": "Text Analytics",
"description": "Select if you want to deploy Text Analytics.",
"value": "TextAnalytics"
},
{
"label": "Text Translator",
"description": "Select if you want to deploy Text Translator.",
"value": "TextTranslation"
}
],
"required": false
}
},
{
"name": "enableSearch",
"label": "Enable Azure Search",
"type": "Microsoft.Common.CheckBox",
"visible": true,
"defaultValue": false,
"toolTip": "Enable the deployment of Azure Search.",
"constraints": {
"required": false,
"validationMessage": "Enable the deployment of Azure Search."
}
},
{
"name": "infoBoxRoleAssignment",
"type": "Microsoft.Common.InfoBox",
Expand Down Expand Up @@ -1309,6 +1399,8 @@
"databricksWorkspaceUrl": "[if(empty(steps('generalSettings').machineLearningDeploymentSettings.databricksWorkspaceUrl.properties.workspaceUrl), '', steps('generalSettings').machineLearningDeploymentSettings.databricksWorkspaceUrl.properties.workspaceUrl)]",
"databricksAccessToken": "[if(empty(steps('generalSettings').machineLearningDeploymentSettings.databricksAccessToken), '', steps('generalSettings').machineLearningDeploymentSettings.databricksAccessToken)]",
"enableRoleAssignments": "[steps('generalSettings').generalSettings.enableRoleAssignments]",
"cognitiveServiceKinds": "[if(empty(steps('generalSettings').generalSettings.cognitiveServiceKinds), parse('[]'), steps('generalSettings').generalSettings.cognitiveServiceKinds)]",
"enableSearch": "[steps('generalSettings').generalSettings.enableSearch]",
"subnetId": "[if(empty(steps('connectivitySettings').virtualNetwork.subnetId), '', steps('connectivitySettings').virtualNetwork.subnetId)]",
"privateDnsZoneIdKeyVault": "[if(empty(steps('connectivitySettings').privateDnsZones.privateDnsZoneIdKeyVault), '', steps('connectivitySettings').privateDnsZones.privateDnsZoneIdKeyVault)]",
"privateDnsZoneIdSynapseDev": "[if(empty(steps('connectivitySettings').privateDnsZones.privateDnsZoneIdSynapseDev), '', steps('connectivitySettings').privateDnsZones.privateDnsZoneIdSynapseDev)]",
Expand Down
33 changes: 26 additions & 7 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ param databricksWorkspaceUrl string = ''
param databricksAccessToken string = ''
@description('Specifies whether role assignments should be enabled for Synapse (Blob Storage Contributor to default storage account).')
param enableRoleAssignments bool = false
@allowed([
'AnomalyDetector'
'ComputerVision'
'ContentModerator'
'CustomVision.Training'
'CustomVision.Prediction'
'Face'
'FormRecognizer'
'ImmersiveReader'
'LUIS'
'Personalizer'
'SpeechServices'
'TextAnalytics'
'TextTranslation'
])
@description('Specifies the cognitive service kind that will be deployed.')
param cognitiveServiceKinds array = []
@description('Specifies whether Azure Search should be deployed as part of the template.')
param enableSearch bool = false

// Network parameters
@description('Specifies the resource ID of the subnet to which all services will connect.')
Expand Down Expand Up @@ -107,7 +126,7 @@ var datalakeFileSystemScopes = [for datalakeFileSystemId in datalakeFileSystemId
var keyvault001Name = '${name}-vault001'
var synapse001Name = '${name}-synapse001'
var datafactory001Name = '${name}-datafactory001'
var cognitiveservice001Name = '${name}-cognitiveservice001'
var cognitiveservicesName = '${name}-cognitiveservice'
var search001Name = '${name}-search001'
var applicationInsights001Name = '${name}-insights001'
var containerRegistry001Name = '${name}-containerregistry001'
Expand Down Expand Up @@ -172,21 +191,21 @@ module datafactory001 'modules/services/datafactory.bicep' = if (processingServi
}
}

module cognitiveservice001 'modules/services/cognitiveservices.bicep' = {
name: 'cognitiveservice001'
module cognitiveservices 'modules/services/cognitiveservices.bicep' = [for (cognitiveServiceKind, index) in cognitiveServiceKinds: {
name: 'cognitiveservice${padLeft(index + 1, 3, '0')}'
scope: resourceGroup()
params: {
location: location
tags: tagsJoined
subnetId: subnetId
cognitiveServiceName: cognitiveservice001Name
cognitiveServiceKind: 'FormRecognizer'
cognitiveServiceName: '${cognitiveservicesName}${padLeft(index + 1, 3, '0')}'
cognitiveServiceKind: cognitiveServiceKind
cognitiveServiceSkuName: 'S0'
privateDnsZoneIdCognitiveService: privateDnsZoneIdCognitiveService
}
}
}]

module search001 'modules/services/search.bicep' = {
module search001 'modules/services/search.bicep' = if(enableSearch) {
name: 'search001'
scope: resourceGroup()
params: {
Expand Down
54 changes: 42 additions & 12 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.4.613.9944",
"templateHash": "12179575723073357481"
"templateHash": "15295458181843473147"
}
},
"parameters": {
Expand Down Expand Up @@ -137,6 +137,35 @@
"description": "Specifies whether role assignments should be enabled for Synapse (Blob Storage Contributor to default storage account)."
}
},
"cognitiveServiceKinds": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "Specifies the cognitive service kind that will be deployed."
},
"allowedValues": [
"AnomalyDetector",
"ComputerVision",
"ContentModerator",
"CustomVision.Training",
"CustomVision.Prediction",
"Face",
"FormRecognizer",
"ImmersiveReader",
"LUIS",
"Personalizer",
"SpeechServices",
"TextAnalytics",
"TextTranslation"
]
},
"enableSearch": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Specifies whether Azure Search should be deployed as part of the template."
}
},
"subnetId": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -257,7 +286,7 @@
"keyvault001Name": "[format('{0}-vault001', variables('name'))]",
"synapse001Name": "[format('{0}-synapse001', variables('name'))]",
"datafactory001Name": "[format('{0}-datafactory001', variables('name'))]",
"cognitiveservice001Name": "[format('{0}-cognitiveservice001', variables('name'))]",
"cognitiveservicesName": "[format('{0}-cognitiveservice', variables('name'))]",
"search001Name": "[format('{0}-search001', variables('name'))]",
"applicationInsights001Name": "[format('{0}-insights001', variables('name'))]",
"containerRegistry001Name": "[format('{0}-containerregistry001', variables('name'))]",
Expand Down Expand Up @@ -1186,9 +1215,13 @@
]
},
{
"copy": {
"name": "cognitiveservices",
"count": "[length(parameters('cognitiveServiceKinds'))]"
},
"type": "Microsoft.Resources/deployments",
"apiVersion": "2019-10-01",
"name": "cognitiveservice001",
"name": "[format('cognitiveservice{0}', padLeft(add(copyIndex(), 1), 3, '0'))]",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
Expand All @@ -1205,10 +1238,10 @@
"value": "[parameters('subnetId')]"
},
"cognitiveServiceName": {
"value": "[variables('cognitiveservice001Name')]"
"value": "[format('{0}{1}', variables('cognitiveservicesName'), padLeft(add(copyIndex(), 1), 3, '0'))]"
},
"cognitiveServiceKind": {
"value": "FormRecognizer"
"value": "[parameters('cognitiveServiceKinds')[copyIndex()]]"
},
"cognitiveServiceSkuName": {
"value": "S0"
Expand All @@ -1224,7 +1257,7 @@
"_generator": {
"name": "bicep",
"version": "0.4.613.9944",
"templateHash": "1987002146294078897"
"templateHash": "3093428550225992785"
}
},
"parameters": {
Expand Down Expand Up @@ -1260,8 +1293,7 @@
"Personalizer",
"SpeechServices",
"TextAnalytics",
"QnAMaker",
"TranslatorText"
"TextTranslation"
]
},
"privateDnsZoneIdCognitiveService": {
Expand All @@ -1284,17 +1316,14 @@
"type": "SystemAssigned"
},
"sku": {
"name": "[parameters('cognitiveServiceSkuName')]"
"name": "[if(or(equals(parameters('cognitiveServiceKind'), 'ComputerVision'), equals(parameters('cognitiveServiceKind'), 'TextTranslation')), 'S1', if(equals(parameters('cognitiveServiceKind'), 'TextAnalytics'), 'S', parameters('cognitiveServiceSkuName')))]"
},
"kind": "[parameters('cognitiveServiceKind')]",
"properties": {
"allowedFqdnList": [],
"apiProperties": {},
"customSubDomainName": "[parameters('cognitiveServiceName')]",
"disableLocalAuth": true,
"encryption": {
"keySource": "Microsoft.CognitiveServices"
},
"networkAcls": {
"defaultAction": "Deny",
"ipRules": [],
Expand Down Expand Up @@ -1356,6 +1385,7 @@
}
},
{
"condition": "[parameters('enableSearch')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2019-10-01",
"name": "search001",
Expand Down
8 changes: 2 additions & 6 deletions infra/modules/services/cognitiveservices.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ param cognitiveServiceSkuName string = 'S0'
'Personalizer'
'SpeechServices'
'TextAnalytics'
'QnAMaker'
'TranslatorText'
'TextTranslation'
])
param cognitiveServiceKind string
param privateDnsZoneIdCognitiveService string = ''
Expand All @@ -42,17 +41,14 @@ resource cognitiveService 'Microsoft.CognitiveServices/accounts@2021-04-30' = {
type: 'SystemAssigned'
}
sku: {
name: cognitiveServiceSkuName
name: cognitiveServiceKind == 'ComputerVision' || cognitiveServiceKind == 'TextTranslation' ? 'S1' : cognitiveServiceKind == 'TextAnalytics' ? 'S' : cognitiveServiceSkuName
}
kind: cognitiveServiceKind
properties: {
allowedFqdnList: []
apiProperties: {}
customSubDomainName: cognitiveServiceName
disableLocalAuth: true
encryption: {
keySource: 'Microsoft.CognitiveServices'
}
networkAcls: {
defaultAction: 'Deny'
ipRules: []
Expand Down
Loading

0 comments on commit fb9830e

Please sign in to comment.