Hi all
I'm just starting out with JSON and trying to build my first ARM template but I've come across an error which I can't find any relating information on...
This is the error:
New-AzureRmResourceGroupDeployment : 10:58:54 - Resource Microsoft.Compute/virtualMachines 'ic-test-1' failed with message '{
"error": {
"details": [ {
"target": "vm.properties.osDisk",
"message": "Could not find member 'osDisk' on object of type 'Properties'. Path 'properties.osDisk', line 1, position 411." },
{
"target": "vm.properties.dataDisks",
"message": "Could not find member 'dataDisks' on object of type 'Properties'. Path 'properties.dataDisks', line 1, position
490."
}
],
"code": "BadRequest",
"message": "The request message is invalid."
}
I'm deploying using Powershell and the template successfully deployed before I added the VM properties to specify the disk details (we want unmanaged disks).
As mentioned, I'm still learning but to me the syntax looks right and throws up no errors in the code editor (VS Code), can anyone point me in the right direction? I'm totally stumped on this one. Here's the full JSON:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"type": "string",
"allowedValues": [
"Standard_LRS",
"Standard_ZRS",
"Standard_GRS",
"Standard_RAGRS",
"Premium_LRS"
],
"defaultValue": "Standard_LRS",
"metadata": {
"description": "The type of replication to use for the storage account."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "local admin password for the VM."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"vmName": "ic-test-1",
"nicName": "[concat(variables('vmName'), '-nic')]",
"virtualNetworkName": "VNET1",
"subnetName": "default",
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
"storageAccountName": "[concat('storage', uniqueString(resourceGroup().id))]"
},
"resources": [
{
"apiVersion": "2018-03-01",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.1.0.0/24"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "10.1.0.0/24"
}
}
]
}
},
{
"apiVersion": "2018-03-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('virtualNetworkName')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('SubnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "2017-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[parameters('location')]",
],
"properties": {
"hardwareProfile": {
"vmSize": "Basic_A2"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "administrator1",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
}
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
}
},
"osDisk": {
"name": "OSdisk",
"vhd": {
"uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/osdisk.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
},
"dataDisks": [
{
"name": "SQL_Data",
"diskSizeGB": 70,
"lun": 0,
"vhd": {
"uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/SQL_Data.vhd')]"
},
"caching": "ReadOnly",
"createOption": "Empty"
},
{
"name": "Log",
"diskSizeGB": 40,
"lun": 1,
"vhd": {
"uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/Log.vhd')]"
},
"caching": "None",
"createOption": "Empty"
},
{
"name": "Files",
"diskSizeGB": 10,
"lun": 2,
"vhd": {
"uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/Files.vhd')]"
},
"createOption": "Empty"
}
],
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
}
}
},
{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-02-01",
"sku": {
"name": "[parameters('storageSKU')]"
},
"kind": "Storage",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {}
}
],
}
Any help is much appreciated
Thanks