@Allen Langlois Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
We have tried to deploy the above the shared template and it failed with same error message.
Upon checking further, in your template in communication service resource block you have added dependson
property on both emailservices
and email services/domains
it should be dependent only on emailservices/domains
only.
I have made the below changes to the above shared template and tested it as well it is working fine and I would suggest you validate from your end as well.
Here is the Modified template:
{
"$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": {}
}
We have passed the parameters as a hashtable to the New-AzResourceGroupdeployment
here is the sample cmdlet that we have used to deploy the above template from local visual studio code.
$parms= @{ acsemailName="<AcsName>" tagsByResource= @{test="Microsoft.communication/EmailServices";
teste2="checker"}
dataLocation="unitedstates"}
New-AzResourceGroupDeployment -Name '<deploymentName>' -ResourceGroupName '<resourceGroupName>' -TemplateFile <localMachinePath> -TemplateParameterObject $parms -Verbose
Feel free to reach back to me if you have any further questions on this.