ARM Deployment Failing Azure VM with AD Domain Services

Andy Hildebrand 21 Reputation points
2021-04-01T17:41:21.187+00:00

I am working on creating an ARM template that will deploy and Azure VM with Active Directly Domain Services installed on the VM, but my template does not pass the Deployment Validation and I am not sure why.

The error I get is {"code":"InvalidTemplate","message":"Deployment template validation failed: 'The template resource 'uatforza.com' at line '212' and column '9' is not valid: Unable to evaluate template language function 'resourceId': function requires exactly one multi-segmented argument which must be resource type including resource provider namespace. Current function arguments 'Microsoft.Network/virtualNetworks,/subscriptions/ce852ca6-9098-4a03-bfe6-a48d2666cb98/resourceGroups/automation_testting/providers/Microsoft.Network/virtualNetworks/uat-forza-vnet01'. Please see https://aka.ms/arm-template-expressions/#resourceid for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'."}

And the template looks like this...

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"networkInterfaceName": {
"type": "string"
},
"networkSecurityGroupName": {
"type": "string"
},
"networkSecurityGroupRules": {
"type": "array"
},
"subnetName": {
"type": "string"
},
"virtualNetworkId": {
"type": "string"
},
"virtualMachineName": {
"type": "string"
},
"virtualMachineComputerName": {
"type": "string"
},
"virtualMachineRG": {
"type": "string"
},
"osDiskType": {
"type": "string"
},
"virtualMachineSize": {
"type": "string"
},
"adminUsername": {
"type": "string"
},
"adminPassword": {
"type": "secureString"
},
"patchMode": {
"type": "string"
},
"enableHotpatching": {
"type": "bool"
},
"Domain": {
"type": "string"
}
},
"variables": {
"nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]",
"vnetId": "[parameters('virtualNetworkId')]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]"
},
"resources": [
{
"name": "[parameters('networkInterfaceName')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2018-10-01",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateIPAllocationMethod": "Dynamic"
}
}
],
"networkSecurityGroup": {
"id": "[variables('nsgId')]"
}
},
"tags": {
"Customer": "Internal"
}
},
{
"name": "[parameters('networkSecurityGroupName')]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-02-01",
"location": "[parameters('location')]",
"properties": {
"securityRules": "[parameters('networkSecurityGroupRules')]"
},
"tags": {
"Customer": "Internal"
}
},
{
"name": "[parameters('virtualMachineName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2020-12-01",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"storageProfile": {
"osDisk": {
"createOption": "fromImage",
"managedDisk": {
"storageAccountType": "[parameters('osDiskType')]"
}
},
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-gensecond",
"version": "latest"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachineComputerName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"enableAutomaticUpdates": true,
"provisionVmAgent": true,
"patchSettings": {
"enableHotpatching": "[parameters('enableHotpatching')]",
"patchMode": "[parameters('patchMode')]"
}
}
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true
}
}
},
"tags": {
"Customer": "Internal"
}
},
{
"type": "Microsoft.AAD/domainServices",
"name": "[parameters('Domain')]",
"apiVersion": "2017-06-01",
"location": "[resourceGroup().location]",
"properties": {
"domainName": "[parameters('Domain')]",
"subnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetId'), variables('subnetRef'))]",
"ldapsSettings": {
"ldaps": "Disabled",
"externalAccess": "Disabled"
},
"domainSecuritySettings": {
"ntlmV1": "Enabled",
"tlsV1": "Enabled",
"syncNtlmPasswords": "Enabled"
},
"filteredSync": "Disabled"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnetId'))]"
]
}
],
"outputs": {
"adminUsername": {
"type": "string",
"value": "[parameters('adminUsername')]"
}
}
}

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,107 questions
0 comments No comments
{count} votes

Accepted answer
  1. KarishmaTiwari-MSFT 18,352 Reputation points Microsoft Employee
    2021-04-02T01:34:40.967+00:00
    0 comments No comments

0 additional answers

Sort by: Most helpful