Azure AI Search name must be valid#
Operational Excellence · AI Search · Rule · 2021_06 · Awareness
Azure Resource Manager (ARM) has requirements for AI Search service names.
Description#
When naming Azure resources, resource names must meet service requirements. The requirements for AI Search (previously known as Cognitive Search) service names are:
- Between 2 and 60 characters long.
- Lowercase letters, numbers, and hyphens.
- The first two and last one character must be a letter or a number.
- AI Search service names must be globally unique.
Recommendation#
Consider using names that meet Azure AI Search service naming requirements. Additionally consider naming resources with a standard naming convention.
Examples#
Configure with Bicep#
To deploy AI Search services that pass this rule:
- Set the
name
property to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLength
andmaxLength
attributes.
For example:
@minLength(2)
@maxLength(60)
@description('The name of the resource.')
param name string
@description('The location resources will be deployed.')
param location string = resourceGroup().location
resource search 'Microsoft.Search/searchServices@2023-11-01' = {
name: name
location: location
identity: {
type: 'SystemAssigned'
}
sku: {
name: 'standard'
}
properties: {
replicaCount: 3
partitionCount: 1
hostingMode: 'default'
}
}
Configure with Azure Verified Modules
A pre-validated module supported by Microsoft is available from the Azure Bicep public registry. To reference the module, please use the following syntax:
To use the latest version:
Configure with Azure template#
To deploy AI Search services that pass this rule:
- Set the
name
property to a string that matches the naming requirements. - Optionally, consider constraining name parameters with
minLength
andmaxLength
attributes.
For example:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.34.44.8038",
"templateHash": "4357322963880451118"
}
},
"parameters": {
"name": {
"type": "string",
"minLength": 2,
"maxLength": 60,
"metadata": {
"description": "The name of the resource."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location resources will be deployed."
}
}
},
"resources": [
{
"type": "Microsoft.Search/searchServices",
"apiVersion": "2023-11-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default"
}
}
]
}
Notes#
This rule does not check if Azure AI Search service names are unique.
Links#
- OE:04 Continuous integration
- REST API reference
- Define your naming convention
- Recommended abbreviations for Azure resource types
- Azure deployment reference