Новое в Azure, создание очень простого шаблона c ARM. Может ли кто-нибудь сказать мне, почему я постоянно получаю следующую ошибку: «Ошибка проверки шаблона развертывания:« Ресурс «Microsoft.Network/virtualNetworks/vNet» не определен в шаблоне. См. https://aka.ms/arm-template для подробностей использования. '. (Код: InvalidTemplate) "
Я безуспешно пытался удалить записи DependsOn.
Спасибо!
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"VMname": {
"type": "string",
"metadata": {
"description": "Name of the VM"
}
},
"vNet": {
"type": "string",
"maxLength": 10,
"metadata": {
"description": "Name of the Virtual Network"
}
},
"StorageAccountName": {
"type": "string",
"maxLength": 50,
"metadata": {
"description": "Name of Storage Account"
}
}
},
"functions": [],
"variables": {},
"resources": [{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('StorageAccountName')]",
"apiVersion": "2019-06-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "[parameters('StorageAccountName')]"
},
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage"
},
{
"name": "VMname-PublicIP",
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2019-11-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[toLower('VMname')]"
}
}
},
{
"name": "VMname-nsg",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2018-08-01",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "nsgRule1",
"properties": {
"description": "description",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
}
]
}
},
{
"name": "[parameters('vNet')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2019-11-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', 'VMname-nsg')]"
],
"tags": {
"displayName": "vNet"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"subnets": [
{
"name": "vNet-Subnet",
"properties": {
"addressPrefix": "10.0.0.0/24",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', 'VMname-nsg')]"
}
}
}
]
}
},
{
"name": "VMname-NetworkInterface",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2019-11-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', 'VMname-PublicIP')]",
"[resourceId('Microsoft.Network/virtualNetworks', 'vNet')]"
],
"tags": {
"displayName": "VMname Network Interface"
},
"properties": {
"ipConfigurations": [
{
"name": "ipConfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'VMname-PublicIP')]"
},
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vNet', 'vNet-Subnet')]"
}
}
}
]
}
},
{
"name": "[parameters('VMname')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2019-07-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', toLower('StorageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces', 'VMname-NetworkInterface')]"
],
"tags": {
"displayName": "VMname"
},
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A2_v2"
},
"osProfile": {
"computerName": "VMname",
"adminUsername": "adminUsername",
"adminPassword": "adminPassword"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"osDisk": {
"name": "VMnameOSDisk",
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'VMname-NetworkInterface')]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts/', toLower('StorageAccountName'))).primaryEndpoints.blob]"
}
}
}
}],
"outputs": {}
}