Log workspace name must be valid#
Operational Excellence · Azure Monitor Logs · Rule · 2025_06 · Awareness
Azure Resource Manager (ARM) has requirements for Azure Monitor Log workspace names.
Description#
When naming Azure resources, resource names must meet service requirements. The requirements for Azure Monitor Log workspace names are:
- Between 3 and 63 characters long.
- Letters, numbers, and hyphens.
- Must start and end with a letter or number.
- Resource names must be unique within a resource group.
Recommendation#
Consider using names that meet Azure Monitor log workspaces naming requirements. Additionally consider naming resources with a standard naming convention.
Examples#
Configure with Bicep#
To deploy workspaces 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(4)
@maxLength(63)
@description('The name of the resource.')
param name string
@description('The location resources will be deployed.')
param location string = resourceGroup().location
param secondaryLocation string
// An example Log Analytics workspace with replication enabled.
resource workspace 'Microsoft.OperationalInsights/workspaces@2025-02-01' = {
name: name
location: location
properties: {
replication: {
enabled: true
location: secondaryLocation
}
publicNetworkAccessForIngestion: 'Enabled'
publicNetworkAccessForQuery: 'Enabled'
retentionInDays: 30
features: {
disableLocalAuth: true
}
sku: {
name: 'PerGB2018'
}
}
}
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 workspaces 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",
"parameters": {
"name": {
"type": "string",
"minLength": 4,
"maxLength": 63,
"metadata": {
"description": "The name of the resource."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location resources will be deployed."
}
},
"secondaryLocation": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.OperationalInsights/workspaces",
"apiVersion": "2025-02-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"replication": {
"enabled": true,
"location": "[parameters('secondaryLocation')]"
},
"publicNetworkAccessForIngestion": "Enabled",
"publicNetworkAccessForQuery": "Enabled",
"retentionInDays": 30,
"features": {
"disableLocalAuth": true
},
"sku": {
"name": "PerGB2018"
}
}
}
]
}
Notes#
This rule does not check if workspace names are unique.
Links#
- OE:04 Continuous integration
- Naming rules and restrictions for Azure resources
- Recommended abbreviations for Azure resource types
- Parameters in Bicep
- Bicep functions
- Azure resource deployment