We are creating our Azure Cognitive services from an ARM template.
The template creates both a Cognitive Service for Language and a Cognitive Search Service, this is the template:
azure.json:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Global Parameters
"projectPrefix": {
"type": "string"
},
"componentGroup": {
"type": "string"
},
// Azure Search Service settings
"searchHostingMode": {
"type": "string",
"defaultValue": "default",
"allowedValues": [
"default",
"highDensity"
],
"metadata": {
"description": "Applicable only for SKU set to standard3. You can set this property to enable a single, high density partition that allows up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU."
}
},
"searchSKU": {
"type": "string",
"defaultValue": "basic",
"allowedValues": [
"free",
"basic",
"standard",
"standard2",
"standard3"
],
"metadata": {
"description": "The SKU of the search service you want to create. E.g. free or standard"
}
},
"searchPartitionCount": {
"type": "int",
"allowedValues": [
1,
2,
3,
4,
6,
12
],
"defaultValue": 1,
"metadata": {
"description": "Partitions allow for scaling of document count as well as faster indexing by sharding your index over multiple Azure Search units."
}
},
"searchReplicaCount": {
"type": "int",
"minValue": 1,
"maxValue": 12,
"defaultValue": 1,
"metadata": {
"description": "Replicas distribute search workloads across the service. You need 2 or more to support high availability (applies to Basic and Standard only)."
}
},
// Azure Cognitive Services for Language
"languageSKU":{
"defaultValue": "s",
"type": "string",
"allowedValues": [
"f", // free
"s" // standard
]
}
},
"functions": [
{
"namespace": "stringUtils",
"members": {
"buildServiceName": {
"parameters": [
{
"name": "resourceName",
"type": "string"
},
{
"name": "sku",
"type": "string"
},
{
"name": "resourceType",
"type": "string"
}
],
"output": {
"type": "string",
"value": "[concat(
parameters('resourceName'), '-',
parameters('sku'), '-',
parameters('resourceType')
)]"
}
}
}
}
],
"variables": {
"languageAzureSearchName": "[stringUtils.buildServiceName(parameters('projectPrefix'), parameters('searchSKU'), 'language-search')]",
"languageServiceName": "[stringUtils.buildServiceName(parameters('projectPrefix'), parameters('languageSKU'), 'language-service')]"
},
"resources": [
{
"comments": "All Cognitive Services for Language will use a single Azure Search Service",
"type": "Microsoft.Search/searchServices",
"apiVersion": "2021-04-01-preview",
"name": "[variables('languageAzureSearchName')]",
"location": "[resourceGroup().location]",
"tags": {
"componentGroup": "[parameters('componentGroup')]"
},
"sku": {
"name": "[parameters('searchSKU')]"
},
"properties": {
"replicaCount": "[parameters('searchReplicaCount')]",
"partitionCount": "[parameters('searchPartitionCount')]",
"hostingMode": "[parameters('searchHostingMode')]",
"disabledDataExfiltrationOptions": [],
"semanticSearch": "disabled"
}
},
// Cognitive Services for Language
{
"type": "Microsoft.CognitiveServices/accounts",
"apiVersion": "2022-03-01",
"name": "[variables('languageServiceName')]",
"location": "[resourceGroup().location]",
"tags": {
"componentGroup": "[parameters('componentGroup')]"
},
"dependsOn": [
"[resourceId('Microsoft.Search/searchServices', variables('languageAzureSearchName'))]"
],
"sku": {
"name": "[parameters('languageSKU')]"
},
"kind": "TextAnalytics",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"apiProperties": {
"qnaAzureSearchEndpointId": "[resourceId('Microsoft.Search/searchServices', variables('languageAzureSearchName'))]"
},
"customSubDomainName": "[variables('languageServiceName')]"
}
}
]
}
and the parameters:
azure.parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"projectPrefix": {
"value": "myProject"
},
"componentGroup": {
"value": "myComponentGroup"
},
"searchHostingMode": {
"value": "default"
},
"searchSKU": {
"value": "basic"
},
"searchPartitionCount": {
"value": 1
},
"searchReplicaCount": {
"value": 1
},
"languageSKU": {
"value": "s"
}
}
}
The resources are created from the 'az cli':
az deployment group create --resource-group myResourceGroup --template-file ./azure.json --parameters ./azure.parameters.json --subscription mySubscription -c
Everything is created with no issues, and we can see this in Azure Portal:
Buttttttt... when attempting to switch to this resource from Language Studio or trying to create a new project there, we receive this error:
{
"error": {
"code": "AzureCognitiveSearchNotFound",
"message": "Please attach an azure cognitive search service to your Text Analytics resource to use the custom Question Answering skill."
}
}
We found a couple ugly work-rounds:
- if we switch to another Search Service and then we switch back to the one created it works.
- If we click on "Sync keys linked to the selected Azure Cognitive Search service." and we apply it works.
Looks like some kind of bug when creating the resources from ARM templates, or maybe we are missing something.
We have compared the fixed exported ARM templates versus the applied ones and they are the same....
Thanks,
Xavi