Невозможно создать виртуальную машину, используя шаблон ARM - PullRequest
0 голосов
/ 05 марта 2019

Я пытаюсь создать виртуальную машину, используя шаблоны ARM.Я уже создал сетевой адаптер, VNET, подсеть и т. Д. Однако при попытке создать виртуальную машину я получаю ошибку разбора.

New-AzDeployment: 17:13:38 - ресурс Microsoft.Compute /Сбой virtualMachines 'before' с сообщением '{
"error": {"details": [], "code": "InvalidRequestFormat", "message": "Невозможно проанализировать запрос."}} 'В строке: 1 символ: 1 + New-AzDeployment -Расположение "UK West" -TemplateFile "C: \ Users \ Matt.Lea ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: NotSpecified: (:) [New-AzDeployment], Exception + FullyQualifiedErrorId: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureDeploymentCmdlet

Я использую JSONсоздать виртуальные машины.

"resources": [
    {
        "name": "[parameters('DR Network RG')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[parameters('HUB Network RG')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[parameters('Test DR Network RG')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[variables('hubsharedrg')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[variables('DRVMRG')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[variables('DRTESTVMRG')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "name": "[variables('rsvrg')]",
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[variables('Location')]",
        "tags": {},
        "properties": {}
    },
    {
        "apiVersion": "2017-05-10",
        "name": "DR-Template",
        "type": "Microsoft.Resources/deployments",
        "resourceGroup": "[parameters('DR Network RG')]",
        "dependsOn": [
            "[resourceId('Microsoft.Resources/resourceGroups/', parameters('DR Network RG'))]",
            "[resourceId('Microsoft.Resources/resourceGroups/', parameters('HUB Network RG'))]",
            "[resourceId('Microsoft.Resources/resourceGroups/', parameters('Test DR Network RG'))]"
        ],
        "properties": {
            "mode": "incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentversion": "1.0.0.0",
                "parameters": {},
                "variables": {},
                "resources": [
                    {
                        "apiVersion": "2017-06-01",
                        "type": "Microsoft.Network/virtualNetworks",
                        "name": "[parameters('DR VNet')]",
                        "dependsOn": [
                            "[concat('Microsoft.Network/networkSecurityGroups/', variables('DRNetworkSecurityGroup'))]"
                        ],
                        "location": "[variables('Location')]",
                        "properties": {
                            "addressSpace": {
                                "addressPrefixes": [
                                    "[parameters('DR vnetAddressPrefix')]"
                                ]
                            },
                            "subnets": [
                                {
                                    "name": "[parameters('DR Failover Subnet')]",
                                    "properties": {
                                        "addressPrefix": "[parameters('DR Failover Subnet Address Prefix')]"
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "apiVersion": "2015-06-15",
                        "type": "Microsoft.Network/networkSecurityGroups",
                        "name": "[variables('DRNetworkSecurityGroup')]",
                        "location": "[variables('location')]",
                        "properties": {
                            "securityRules": []
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "HUB-Template",
        "type": "Microsoft.Resources/deployments",
        "resourceGroup": "[parameters('HUB Network RG')]",
        "dependsOn": [
            "DR-Template"
        ],
        "properties": {
            "mode": "incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentversion": "1.0.0.0",
                "parameters": {},
                "variables": {},
                "resources": [
                    {
                        "apiVersion": "2017-06-01",
                        "type": "Microsoft.Network/virtualNetworks",
                        "name": "[parameters('HUB vnet')]",
                        "dependsOn": [
                            "[concat('Microsoft.Network/networkSecurityGroups/', variables('DomainControllerNSG'))]"
                        ],
                        "location": "[variables('Location')]",
                        "properties": {
                            "addressSpace": {
                                "addressPrefixes": [
                                    "[parameters('HUB vnetAddressPrefix')]"
                                ]
                            },
                            "subnets": [
                                {
                                    "name": "[parameters('HUB DC Subnet')]",
                                    "properties": {
                                        "addressPrefix": "[parameters('HUB DC Subnet AddressPrefix')]"
                                    }
                                },
                                {
                                    "name": "[parameters('Gateway Subnet')]",
                                    "properties": {
                                        "addressPrefix": "[parameters('Gateway Subnet AddressPrefix')]"
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "apiVersion": "2015-06-15",
                        "type": "Microsoft.Network/networkSecurityGroups",
                        "name": "[variables('DomainControllerNSG')]",
                        "location": "[variables('location')]",
                        "properties": {
                            "securityRules": []
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "DR-TEST-Template",
        "type": "Microsoft.Resources/deployments",
        "resourceGroup": "[parameters('Test DR Network RG')]",
        "dependsOn": [
            "HUB-Template"
        ],
        "properties": {
            "mode": "incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentversion": "1.0.0.0",
                "parameters": {},
                "variables": {},
                "resources": [
                    {
                        "apiVersion": "2017-06-01",
                        "type": "Microsoft.Network/virtualNetworks",
                        "name": "[parameters('Test DR vnet')]",
                        "dependsOn": [
                            "[concat('Microsoft.Network/networkSecurityGroups/', variables('DRtestNSG'))]"
                        ],
                        "location": "[variables('Location')]",
                        "properties": {
                            "addressSpace": {
                                "addressPrefixes": [
                                    "[parameters('Test DR vnetAddressPrefix')]"
                                ]
                            },
                            "subnets": [
                                {
                                    "name": "[parameters('Test DR Subnet')]",
                                    "properties": {
                                        "addressPrefix": "[parameters('Test DR Subnet AddressPrefix')]"
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "apiVersion": "2015-06-15",
                        "type": "Microsoft.Network/networkSecurityGroups",
                        "name": "[variables('DRtestNSG')]",
                        "location": "[variables('location')]",
                        "properties": {
                            "securityRules": []
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "DC-Template",
        "type": "Microsoft.Resources/deployments",
        "resourceGroup": "[variables('hubsharedrg')]",
        "dependsOn": [
            "DR-TEST-Template"
        ],
        "properties": {
            "mode": "incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentversion": "1.0.0.0",
                "parameters": {},
                "variables": {},
                "resources": [
                    {
                        "type": "Microsoft.Storage/storageAccounts",
                        "name": "[variables('storageAccountName')]",
                        "location": "[variables('location')]",
                        "apiVersion": "2018-07-01",
                        "sku": {
                            "name": "[variables('storageaccountsku')]"
                        },
                        "kind": "Storage",
                        "properties": {}
                    },
                    {
                        "type": "Microsoft.Network/networkInterfaces",
                        "name": "[variables('nicnamedc1')]",
                        "location": "[variables('location')]",
                        "apiVersion": "2018-10-01",
                        "properties": {
                            "ipConfigurations": [
                                {
                                    "name": "ipconfig1",
                                    "properties": {
                                        "privateIPAllocationMethod": "Dynamic",
                                        "subnet": {
                                            "id": "[variables('subnetRef')]"
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "name": "[variables('vmnamedc1')]",
                        "type": "Microsoft.Compute/virtualMachines",
                        "location": "[variables('location')]",
                        "apiVersion": "2017-03-30",
                        "tags": {},
                        "properties": {
                            "hardwareProfile": {
                                "vmSize": "[variables('vmSize')]"
                            },
                            "osProfile": {
                                "computerName": "[variables('vmnamedc1')]",
                                "adminUsername": "[parameters('AdminUserName')]",
                                "adminPassword": "[parameters('AdminPassword')]"
                            },
                            "storageProfile": {
                                "imageReference": {
                                    "publisher": "[variables('vmImagePublisher')]",
                                    "offer": "[variables('vm1ImageOffer')]",
                                    "sku": "[parameters('WindowsOSVersion')]",
                                    "version": "latest"
                                },
                                "osDisk": {
                                    "name": "[concat(variables('vmnamedc1'),'_OSDisk')]",
                                    "caching": "ReadWrite",
                                    "createOption": "FromImage"
                                },
                                "dataDisks": [
                                    {
                                        "name": "[concat(variables('vmnamedc1'),'_DataDisk1')]",
                                        "lun": 0,
                                        "diskSizeGB": "100",
                                        "caching": "None",
                                        "createOption": "Empty"
                                    }
                                ]
                            },
                            "networkProfile": {
                                "networkInterfaces": [
                                    {
                                        "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicnamedc1'))]"
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        }
    }
]
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...