The error is:
"Requested linked domains are not valid (Code: InvalidLinkedDomains)"
It is definetely due to the following line
"linkedDomains": [
"[resourceId('Microsoft.Communication/emailServices/domains',variables('acsename'),'AzureManagedDomain')]"
]
of the communicationServices resource. When deployed with linkedDomains as empty array - communication service is created successfully (but, of course, without linked domain).
ARM Template (taken from the answer in https://learn.microsoft.com/en-us/answers/questions/1189581/azure-communication-service-email-arm-deployment-e):
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"acsemailName": {
"type": "string"
},
"tagsByResource": {
"type": "object"
},
"dataLocation":{
"type": "string"
}
},
"functions": [],
"variables": {
"acsename": "[concat(parameters('acsemailName'),'-email')]"
},
"resources": [
{
"type": "Microsoft.Communication/emailServices",
"apiVersion": "2022-07-01-preview",
"location": "global",
"name" :"[variables('acsename')]",
"tags": "[parameters('tagsByResource')]",
"properties":{
"dataLocation" :"[parameters('dataLocation')]"
}
},
{
"type": "Microsoft.Communication/communicationServices",
"apiVersion": "2022-07-01-preview",
"location": "global",
"name" : "[concat(parameters('acsemailName'),'-cs')]",
"tags": "[parameters('tagsByResource')]",
"dependsOn":[
"[resourceId('Microsoft.Communication/emailServices/domains',variables('acsename'),'AzureManagedDomain')]"
],
"properties": {
"dataLocation":"[parameters('dataLocation')]",
"linkedDomains": [
"[resourceId('Microsoft.Communication/emailServices/domains',variables('acsename'),'AzureManagedDomain')]"
]
}
},
{
"type": "Microsoft.Communication/emailServices/domains",
"apiVersion": "2022-07-01-preview",
"location": "global",
"name": "[concat(variables('acsename'),'/AzureManagedDomain')]",
"tags":"[parameters('tagsByResource')]",
"properties":{
"domainManagement": "AzureManaged",
"userEngagementTracking": "Enabled",
"validSenderUsernames":{"DoNotReply": "DoNotReply"}
},
"dependsOn": [
"[resourceId('Microsoft.Communication/emailServices', variables('acsename'))]"
]
}
],
"outputs": {}
}