2017-11-20 16 views
1

私は、マシンを投げるために、そして必要なときに、精巣のために基本的なjsonを作成しようとしていました。私はそれのほとんどは、しかし、私は次のエラーを取得しています行われました:JSONの予期しない文字シーケンスの作成中にエラーが発生しました

Line 158 Unexpected character sequence in member name 
Line 167 A member with the name 'Properties' already exists 

は私が一意であることが67のニーズを理解し、しかし、毎回私が変更と{それはより多くのエラーを作成し削除します。

予期せぬ文字は{157行目ですが、これは文字列でなければならないと思いますか?

私のテンプレートは以下の通りです。

{ 
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "location": { 
     "type": "string" 
    }, 
    "virtualMachineName": { 
     "type": "string" 
    }, 
    "offer": { 
     "type": "string", 
     "defaultvalue": "Windows", 
     "allowedValues": [ 
     "windows", 
     "centos", 
     "RHEL" 
     ] 
    }, 
    "sku": { 
     "type": "string", 
     "defaultvalue": "2012-r2-datacenter", 
     "allowedValues": [ 
     "2012-R2-Datacenter", 
     "2012-R2", 
     "68", 
     "72", 
     "73", 
     "74" 
     ] 
    }, 
    "virtualMachineSize": { 
     "type": "string", 
     "defaultvalue": "standard_A0", 
     "allowedValues": [ 
     "Standard_A0", 
     "Standard_A1", 
     "standard_A2" 
     ] 
    }, 
    "adminUsername": { 
     "type": "string" 
    }, 
    "ipaddress": { 
     "type": "string" 
    }, 
    "virtualNetworkName": { 
     "type": "string" 
    }, 
    "networkInterfaceName": { 
     "type": "string" 
    }, 
    "networkSecurityGroupName": { 
     "type": "string" 
    }, 
    "adminPassword": { 
     "type": "securestring" 
    }, 
    "storageAccountName": { 
     "type": "string" 
    }, 
    "diagnosticsStorageAccountName": { 
     "type": "string" 
    }, 
    "diagnosticsStorageAccountId": { 
     "type": "string" 
    }, 
    "subnetName": { 
     "type": "string" 
    }, 
    "ContainerName": { 
     "type": "string" 
    }, 
    "autoShutdownStatus": { 
     "type": "string" 
    }, 
    "autoShutdownTime": { 
     "type": "string" 
    }, 
    "autoShutdownTimeZone": { 
     "type": "string" 
    }, 
    "autoShutdownNotificationStatus": { 
     "type": "string" 
    } 
    }, 
    "variables": { 
    "vnetId": "[resourceId('avset','Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", 
    "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", 
    "stdvhdcontainername": "[concat(parameters('Containername'))]", 
    "vmosidiskname": "[concat(parameters('virtualMachineName'),'-osdisk')]" 
    }, 
    "resources": [ 
    { 
     "name": "[parameters('virtualMachineName')]", 
     "type": "Microsoft.Compute/virtualMachines", 
     "apiVersion": "2016-04-30-preview", 
     "location": "[parameters('location')]", 
     "dependsOn": [ 
     "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]" 
     ], 
     "properties": { 
     "diagnosticsProfile": { 
      "bootDiagnostics": { 
      "enabled": true, 
      "storageUri": "[concat (parameters('diagnosticsStorageAccountName')), ['blob']]" 
      } 
     }, 
     "hardwareProfile": { 
      "vmSize": "[parameters('virtualMachineSize')]" 
     }, 
     "networkProfile": { 
      "networkInterfaces": [ 
      { 
       "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" 
      } 
      ] 
     }, 
     "osProfile": { 
      "computerName": "[parameters('virtualMachineName')]", 
      "adminUsername": "[parameters('adminUsername')]", 
      "adminPassword": "[parameters('adminPassword')]" 
     }, 
     "storageProfile": { 
      "imageReference": { 
      "offer": "[concat(parameters('offer'))]", 
      "sku": "[concat(parameters('offer'))]", 
      "version": "latest" 
      } 
     }, 
     "osDisk": { 
      "vhd": { 
      "name": "[variables('vmosidiskname')]", 
      "uri": "[concat('http://', parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdvhdcontainername'),'/', variables('vmosidiskname'), '.vhd')]" 
      }, 
      "name": "[parameters('virtualMachineName')]" 
     }, 
     "name": "[concat('shutdown-computevm-', parameters('virtualMachineName'))]", 
     "type": "Microsoft.DevTestLab/schedules", 
     "apiVersion": "2017-04-26-preview", 
     "location": "[parameters('location')]", 
     "properties": { 
      "status": "[parameters('autoShutdownStatus')]", 
      "taskType": "ComputeVmShutdownTask", 
      "dailyRecurrence": { 
      "time": "[parameters('autoShutdownTime')]" 
      }, 
      "timeZoneId": "[parameters('autoShutdownTimeZone')]", 
      "targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]", 
      "notificationSettings": { 
      "status": "[parameters('autoShutdownNotificationStatus')]", 
      "timeInMinutes": "30" 
      }, 
      "dependsOn": [ 
      "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" 
      ] 
     }, 
     { 
      "name": "[parameters('networkInterfaceName')]", 
      "type": "Microsoft.Network/networkInterfaces", 
      "apiVersion": "2016-09-01", 
      "location": "[parameters('location')]" 
     }, 
     "dependsOn": [ 
      "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]" 
     ], 
     "properties": { 
      "ipConfigurations": [ 
      { 
       "name": "ipconfig1", 
       "properties": { 
       "subnet": { 
        "id": "[variables('subnetRef')]" 
       }, 
       "privateipaddress": "[concat(parameters('ipaddress'))]", 
       "privateIPAllocationMethod": "static" 
       } 
      } 
      ] 
     } 

     }, 
     "outputs": [ 
     { 
      "adminUsername": { 
      "type": "string", 
      "value": "[parameters('adminUsername')]" 
      } 

     } 
     ] 
    } 
    ] 
} 


Any pointers would be greatly appreciated.. thanks for your help :) 

のparamsは以下の通りです:)

{ 
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "location": { 
     "value": "westeurope" 
    }, 
    "virtualMachineName": { 
     "value": "cent-os-vm2" 
    }, 
    "virtualMachineSize": { 
     "value": "Standard_A0" 
    }, 
    "adminUsername": { 
     "value": "localadmin" 
    }, 
    "virtualNetworkName": { 
     "value": "avset-vnet" 
    }, 
    "networkInterfaceName": { 
     "value": "cent-os-vm01652" 
    }, 
    "networkSecurityGroupName": { 
     "value": "cent-os-vm01-nsg" 
    }, 
    "storageAccountName": { 
     "value": "avsetdisks419" 
    }, 
    "diagnosticsStorageAccountName": { 
     "value": "avsetdiag112" 
    }, 
    "diagnosticsStorageAccountId": { 
     "value": "avsetdiag117" 
    }, 
    "subnetName": { 
     "value": "default" 
    }, 
    "autoShutdownStatus": { 
     "value": "Enabled" 
    }, 
    "autoShutdownTime": { 
     "value": "19:00" 
    }, 
    "autoShutdownTimeZone": { 
     "value": "UTC" 
    }, 
    "autoShutdownNotificationStatus": { 
     "value": "Disabled" 
    }, 
    "ContainerName": { 
     "value": "vhd" 
    }, 
    "offer": { 
     "value": "windows" 
    }, 
    "sku": { 
     "value": "2012-R2-Datacenter" 
    }, 
    "ipaddress": { 
     "value": "10.0.1.9" 
    } 
    } 
} 
+0

https://jsonlint.com/はJSONテンプレートの検証に最適なリソースです。 – M0rty

+0

こんにちは、あなたの助けのためのthaks、私はパラメータを追加しました:) –

+0

@ NorrinRad可能であれば、あなたのログを表示することができますか? –

答えて

1

テンプレートには多くの間違いがあります。次のテンプレートが機能するはずです。

{ 
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "location": { 
     "type": "string" 
    }, 
    "virtualMachineName": { 
     "type": "string" 
    }, 
    "offer": { 
     "type": "string", 
     "defaultvalue": "windows", 
     "allowedValues": [ 
     "windows", 
     "centos", 
     "RHEL" 
     ] 
    }, 
    "sku": { 
     "type": "string", 
     "defaultvalue": "2012-R2-Datacenter", 
     "allowedValues": [ 
     "2012-R2-Datacenter", 
     "2012-R2", 
     "68", 
     "72", 
     "73", 
     "74" 
     ] 
    }, 
    "virtualMachineSize": { 
     "type": "string", 
     "defaultvalue": "Standard_A0", 
     "allowedValues": [ 
     "Standard_A0", 
     "Standard_A1", 
     "standard_A2" 
     ] 
    }, 
    "adminUsername": { 
     "type": "string" 
    }, 
    "ipaddress": { 
     "type": "string" 
    }, 
    "virtualNetworkName": { 
     "type": "string" 
    }, 
    "networkInterfaceName": { 
     "type": "string" 
    }, 
    "networkSecurityGroupName": { 
     "type": "string" 
    }, 
    "adminPassword": { 
     "type": "securestring" 
    }, 
    "storageAccountName": { 
     "type": "string" 
    }, 
    "diagnosticsStorageAccountName": { 
     "type": "string" 
    }, 
    "diagnosticsStorageAccountId": { 
     "type": "string" 
    }, 
    "subnetName": { 
     "type": "string" 
    }, 
    "ContainerName": { 
     "type": "string" 
    }, 
    "autoShutdownStatus": { 
     "type": "string" 
    }, 
    "autoShutdownTime": { 
     "type": "string" 
    }, 
    "autoShutdownTimeZone": { 
     "type": "string" 
    }, 
    "autoShutdownNotificationStatus": { 
     "type": "string" 
    } 
    }, 
    "variables": { 
    "vnetId": "[resourceId('avset','Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", 
    "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", 
    "stdvhdcontainername": "[concat(parameters('Containername'))]", 
    "vmosidiskname": "[concat(parameters('virtualMachineName'),'-osdisk')]" 
    }, 
    "resources": [ 
    { 
     "name": "[parameters('virtualMachineName')]", 
     "type": "Microsoft.Compute/virtualMachines", 
     "apiVersion": "2016-04-30-preview", 
     "location": "[parameters('location')]", 
     "dependsOn": [ 
     "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]" 
     ], 
     "properties": { 
      "diagnosticsProfile": { 
      "bootDiagnostics": { 
       "enabled": true, 
       "storageUri": "[concat (parameters('diagnosticsStorageAccountName')), ['blob']]" 
      } 
      }, 
      "hardwareProfile": { 
      "vmSize": "[parameters('virtualMachineSize')]" 
      }, 
      "networkProfile": { 
       "networkInterfaces": [ 
       { 
       "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" 
       } 
      ] 
      }, 
      "osProfile": { 
       "computerName": "[parameters('virtualMachineName')]", 
       "adminUsername": "[parameters('adminUsername')]", 
       "adminPassword": "[parameters('adminPassword')]" 
      }, 
      "storageProfile": { 
      "imageReference": { 
       "offer": "[concat(parameters('offer'))]", 
       "sku": "[concat(parameters('offer'))]", 
       "version": "latest" 
      } 
      }, 
      "osDisk": { 
      "vhd": { 
       "name": "[variables('vmosidiskname')]", 
       "uri": "[concat('http://', parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdvhdcontainername'),'/', variables('vmosidiskname'), '.vhd')]" 
      }, 
      "name": "[parameters('virtualMachineName')]" 
      } 
      } 
     }, 
     { 
      "name": "[concat('shutdown-computevm-', parameters('virtualMachineName'))]", 
      "type": "Microsoft.DevTestLab/schedules", 
      "apiVersion": "2017-04-26-preview", 
      "location": "[parameters('location')]", 
      "properties": { 
      "status": "[parameters('autoShutdownStatus')]", 
      "taskType": "ComputeVmShutdownTask", 
      "dailyRecurrence": { 
       "time": "[parameters('autoShutdownTime')]" 
      }, 
      "timeZoneId": "[parameters('autoShutdownTimeZone')]", 
      "targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]", 
      "notificationSettings": { 
       "status": "[parameters('autoShutdownNotificationStatus')]", 
       "timeInMinutes": "30" 
      }, 
       "dependsOn": [ 
       "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" 
       ] 
      } 
     }, 

     { 
      "name": "[parameters('networkInterfaceName')]", 
      "type": "Microsoft.Network/networkInterfaces", 
      "apiVersion": "2016-09-01", 
      "location": "[parameters('location')]", 
      "dependsOn": [ 
      "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]" 
      ], 
     "properties": { 
      "ipConfigurations": [ 
      { 
       "name": "ipconfig1", 
       "properties": { 
       "subnet": { 
        "id": "[variables('subnetRef')]" 
       }, 
       "privateipaddress": "[concat(parameters('ipaddress'))]", 
       "privateIPAllocationMethod": "static" 
       } 
      } 
      ] 
     } 

     } 


    ], 
    "outputs": { 

     "adminUsername": { 
      "type": "string", 
      "value": "[parameters('adminUsername')]" 
      } 
     } 
} 

162行目で、,が失われました。リソースMicrosoft.Compute/virtualMachines,Microsoft.DevTestLab/schedules,Microsoft.Network/networkInterfacesは並行しています。テンプレートにはMicrosoft.Compute/virtualMachinesが含まれているので、エラーログwith the name 'Properties' already existsが表示されます。

注:デフォルト値も確認する必要があります。大文字と小文字が区別されます

更新:Ipconfigurationsが間違っている 、それは以下の好きなはずです。

"properties": { 
     "ipConfigurations": [ 
      { 
      "name": "ipconfig1", 
      "properties": { 
       "privateIPAllocationMethod": "Dynamic", 
       "publicIPAddress": { 
       "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" 
       }, 
       "subnet": { 
       "id": "[variables('subnetRef')]" 
       } 
      } 
      } 

アップデート2:私のために

template.jsonparameters.json作品。おそらく、この例に従ってテンプレートを変更することができます。

関連する問題