1

I'm trying to deploy two vm's in an avset using visual studio 2015.

I get the error message below when I attempt to deploy:

New-AzureRmResourceGroupDeployment : 2:03:59 AM - Resource Microsoft.Compute/virtualMachines '31' failed with message '{
  "error": {
    "details": [
      {
        "target": "vm.properties.storageProfile.networkProfile",
        "message": "Could not find member 'networkProfile' on object of type 'StorageProfile'. Path 'properties.storageProfile.networkProfile', line 1, position 893."
      },
      {
        "target": "vm.properties.outputs",
        "message": "Could not find member 'outputs' on object of type 'Properties'. Path 'properties.outputs', line 1, position 1072."
      }
    ],
    "code": "BadRequest",
    "message": "The request message is invalid."
  }
}'
At C:\Users\Base\Desktop\Azure-Deploy.ps1:5 char:1
+ New-AzureRmResourceGroupDeployment -Name DCDeploy -ResourceGroupName  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment : 2:03:59 AM - Could not find member 'networkProfile' on object of type 'StorageProfile'. Path 'properties.storageProfile.networkProfile', line 1, position 893.
At C:\Users\Base\Desktop\Azure-Deploy.ps1:5 char:1
+ New-AzureRmResourceGroupDeployment -Name DCDeploy -ResourceGroupName  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment : 2:03:59 AM - Could not find member 'outputs' on object of type 'Properties'. Path 'properties.outputs', line 1, position 1072.
At C:\Users\Base\Desktop\Azure-Deploy.ps1:5 char:1
+ New-AzureRmResourceGroupDeployment -Name DCDeploy -ResourceGroupName  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

My template is below:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "stdAdminUserName": {
      "type": "string",
      "minLength": 1
    },
    "stdAdminPassword": {
      "type": "securestring"
    },
    "storageAccountName": {
      "type": "string",
      "minLength": 1
    },
    "storageAccountType": {
      "type": "string",
      "allowedValues": [
        "Standard_LRS",
        "Standard_GRS"
      ]
    },
    "faultDomains": {
      "type": "int"
    },
    "updateDomains": {
      "type": "int"
    },
    "applicationid": {
      "type": "string",
      "minLength": 1
    },
    "sharedservice": {
      "type": "string",
      "minLength": 1
    },
    "msdref": {
      "type": "string",
      "minLength": 1
    },
    "project": {
      "type": "string",
      "minLength": 1
    },
    "costcentre": {
      "type": "string",
      "minLength": 1
    },
    "templateref": {
      "type": "string",
      "minLength": 1
    },
    "environment": {
      "type": "string",
      "minLength": 1
    },
    "operatingsystem": {
      "type": "string",
      "minLength": 1
    },
    "deploymentzone": {
      "type": "string",
      "minLength": 1
    },
    "shutdownschedule": {
      "type": "string",
      "minLength": 1
    },
    "avSetName": {
      "type": "string",
      "minLength": 1
    },
    "vmInstances": {
      "type": "int"
    },
    "vmSize": {
      "type": "string",
      "minLength": 1
    },
    "vmDiskSize": {
      "type": "string",
      "minLength": 1
    },
    "networkName": {
      "type": "string",
      "minLength": 1
    },
    "networkResourceGroup": {
      "type": "string",
      "minLength": 1
    },
    "subnetName": {
      "type": "string",
      "minLength": 1
    },
    "vmNicNamePrefix": {
      "type": "string",
      "minLength": 1
    },
    "vmNamePrefix": {
      "type": "string",
      "minLength": 1
    }
  },
  "variables": {
    "VNetID": "[resourceId(Parameters('networkResourceGroup'), 'Microsoft.Network/virtualNetworks', Parameters('networkname'))]",
    "SubnetRef": "[resourceid(variables('VNetID'), '/subnets/', Parameters('subnetName'))]",
    "stdVMImagePublisher": "MicrosoftWindowsServer",
    "stdVMImageOffer": "WindowsServer",
    "stdWindowsOSVersion": "2012-R2-Datacenter",
    "stdVHDContainerName": "vhds",
    "VMOSDiskNamePrefix": "VMOSDisk",
    "VMDATADisk1NamePrefix": "DataDisk1VM",
    "VMDATADisk2NamePrefix": "DataDisk2VM"
  },
  "resources": [
    {
      "name": "[Parameters('storageAccountName')]",
      "type": "Microsoft.Storage/storageAccounts",
      "location": "[resourceGroup().location]",
      "apiVersion": "2015-06-15",
      "dependsOn": [],
      "tags": {
        "displayname": "[Parameters('storageAccountName')]",
        "applicationid": "[Parameters('applicationid')]",
        "sharedservice": "[Parameters('sharedservice')]",
        "msdref": "[Parameters('msdref')]",
        "project": "[Parameters('project')]",
        "costcentre": "[Parameters('costcentre')]",
        "operatingsystem": "[Parameters('operatingsystem')]",
        "deploymentzone": "[Parameters('deploymentzone')]",
        "shutdownschedule": "[Parameters('shutdownschedule')]"
      },
      "properties": {
        "accountType": "[Parameters('storageAccountType')]"
      }
    },
    {
      "name": "[parameters('avSetName')]",
      "type": "Microsoft.Compute/availabilitySets",
      "location": "[resourceGroup().location]",
      "apiVersion": "2015-06-15",
      "dependsOn": [],
      "tags": {
        "displayName": "[parameters('avSetName')]"
      },
      "properties": {
        "platformUpdateDomainCount": "[parameters('updateDomains')]",
        "platformFaultDomainCount": "[parameters('faultDomains')]"
      }
    },
    {
      "name": "[concat(Parameters('vmNicNamePrefix'), copyindex(1))]",
      "type": "Microsoft.Network/networkInterfaces",
      "location": "[resourceGroup().location]",
      "apiVersion": "2015-06-15",
      "copy": {
        "name": "nicLoop",
        "count": "[parameters('vmInstances')]"
      },
      "tags": {
        "costcenter": "[Parameters('costcentre')]",
        "environment": "[Parameters('environment')]",
        "project": "[Parameters('project')]",
        "role": "vmnic",
        "templateref": "[Parameters('templateRef')]"
      },
      "properties": {
        "ipConfigurations": [
          {
            "name": "ipconfig1",
            "properties": {
              "privateIPAllocationMethod": "Dynamic",
              "subnet": {
                 "id": "[variables('SubnetRef')]"
              }
            }
          }
        ]
      }
    },
    {
      "name": "[concat(parameters('vmInstances'), copyindex(1))]",
      "type": "Microsoft.Compute/virtualMachines",
      "location": "[resourceGroup().location]",
      "apiVersion": "2015-06-15",
      "dependsOn": [
        "[concat('Microsoft.Storage/storageAccounts/', Parameters('storageAccountName'))]",
        "[concat('Microsoft.Compute/availabilitySets/', Parameters('avSetName'))]",
        "nicLoop"
      ],
      "copy": {
        "name": "virtualMachineLoop",
        "count": "[parameters('vmInstances')]"
      },
      "tags": {
        "applicationid": "[Parameters('applicationid')]",
        "costcentre": "[Parameters('costcentre')]",
        "deploymentzone": "[Parameters('deploymentzone')]",
        "displayname": "[concat(parameters('vmInstances'), copyindex(1))]",
        "environment": "[Parameters('environment')]",
        "msdref": "[Parameters('msdref')]",
        "operatingsystem": "[Parameters('operatingsystem')]",
        "project": "[Parameters('project')]",
        "sharedservice": "[Parameters('sharedservice')]"
      },
      "properties": {
        "availabilitySet": {
          "id": "[resourceId('Microsoft.Compute/availabilitySets',parameters('avSetName'))]"
        },
        "hardwareProfile": {
          "vmSize": "[Parameters('vmSize')]"
        },
        "osProfile": {
          "computerName": "[concat(parameters('vmInstances'), copyindex(1))]",
          "adminUsername": "[Parameters('stdAdminUserName')]",
          "adminPassword": "[Parameters('stdAdminPassword')]"
        },
        "storageProfile": {
          "imageReference": {
            "publisher": "[variables('STDVMImagePublisher')]",
            "offer": "[variables('STDVMImageOffer')]",
            "sku": "[variables('stdWindowsOSVersion')]",
            "version": "latest"
          },
          "osDisk": {
            "name": "[concat(variables('VMOSDiskNamePrefix'), copyindex(1))]",
            "vhd": {
              "uri": "[concat('http://', Parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdVHDContainerName'), '/', variables('VMOSDiskNamePrefix'), copyindex(1), '.vhd')]"
            },
            "caching": "ReadWrite",
            "createOption": "FromImage"
          },
          "networkProfile": {
            "networkInterfaces": [
              {
                "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(Parameters('vmNicNamePrefix'), copyindex(1)))]"
              }
            ]
          }

        },
        "outputs": {
        }
      }
    }
  ]
}
Norrin Rad
  • 353
  • 1
  • 4
  • 12
  • Your template has a mistake, you lose a `},` at the end of `storageProfile`, so `networkprofile` becomes a attribute for storageProfile. – Shui shengbao Nov 14 '17 at 02:38

1 Answers1

1

You could use NotePad++ check, network profile is in your storageProfile. But they are juxtaposed attributes. The error log also tells you this.

enter image description here

You could try following template.

    "properties": {
        "availabilitySet": {
            "id": "[resourceId('Microsoft.Compute/availabilitySets',parameters('avSetName'))]"
        },
        "hardwareProfile": {
            "vmSize": "[Parameters('vmSize')]"
        },
        "osProfile": {
            "computerName": "[concat(parameters('vmInstances'), copyindex(1))]",
            "adminUsername": "[Parameters('stdAdminUserName')]",
            "adminPassword": "[Parameters('stdAdminPassword')]"
        },
        "storageProfile": {
            "imageReference": {
                "publisher": "[variables('STDVMImagePublisher')]",
                "offer": "[variables('STDVMImageOffer')]",
                "sku": "[variables('stdWindowsOSVersion')]",
                "version": "latest"
            },
            "osDisk": {
                "name": "[concat(variables('VMOSDiskNamePrefix'), copyindex(1))]",
                "vhd": {
                    "uri": "[concat('http://', Parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdVHDContainerName'), '/', variables('VMOSDiskNamePrefix'), copyindex(1), '.vhd')]"
                },
                "caching": "ReadWrite",
                "createOption": "FromImage"
            }
        },
        "networkProfile": {
            "networkInterfaces": [{
                "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(Parameters('vmNicNamePrefix'), copyindex(1)))]"
            }]
        }

    }

Note: outputs is a attribute parallel to resources and variables.

Shui shengbao
  • 3,503
  • 1
  • 10
  • 20
  • Hi Thanks again Walter, I understand the outputs is equal to variables and resources, it could be the lack of sleep or just plain dense, but I'm getting this error, so looks like its not seeing the output. Have I missed a bracket somewhere and its been seen in the resources: Error -- 'Could not find member 'outputs' on object of type 'TemplateResource'. Path 'properties.template.resources[3].outputs', line 245, position 20.'. -- – Norrin Rad Nov 14 '17 at 02:54
  • Hi, in your template you don't print output, you could delete it. The error means output is under `resources`. You need move it. – Shui shengbao Nov 14 '17 at 02:55
  • Thanks Walter, I had a feeling it was a bit mixed up. First I think I need to pass out. I appreciate your help (again) hope you have a great day.. thanks again :) – Norrin Rad Nov 14 '17 at 03:00
  • Hi, if you have other error log, you could compare with this [template](https://github.com/Azure/azure-quickstart-templates/blob/master/201-2-vms-loadbalancer-natrules/azuredeploy.json). :) – Shui shengbao Nov 14 '17 at 03:03
  • @NorrinRad Hi, does this [answer](https://stackoverflow.com/questions/47414226/set-azure-dns-setting-from-csv-file-for-network-interface-cards/47425588#47425588) work for you? – Shui shengbao Nov 23 '17 at 03:04
  • Hi this was very helpfl thanks. Sorry about the late reply, been ill and not been working, hope you're well :) – Norrin Rad Nov 29 '17 at 21:08
  • @NorrinRad I am so sorry for you. I hope you feel better soon. – Shui shengbao Nov 30 '17 at 01:02
  • hi where are you in the world? – Norrin Rad Nov 30 '17 at 08:46
  • I am in China. I am Microsoft Azure supporter. – Shui shengbao Nov 30 '17 at 08:53
  • Hi, we could chat in this room https://chat.stackoverflow.com/rooms/159465/discussion-between-shengbao-shui-msft-and-norrin-rad – Shui shengbao Nov 30 '17 at 08:54
  • Microsoft has a support center in Wuxi, China --:) – Shui shengbao Nov 30 '17 at 08:56
  • hi I sent you a message in that chat room .. anyway might be easier on Email my email is rajinder.rahul@gmail.com – Norrin Rad Nov 30 '17 at 09:13
  • Fine, my e-mail is `v-shshui@hotmail.com`. If you have Azure issue, maybe you could contact me. We are free to support --:). – Shui shengbao Nov 30 '17 at 09:16
  • @NorrinRad In my country, I need go home, if you have question, you could e-mail to me. --:) – Shui shengbao Nov 30 '17 at 09:49