title: Azure Resource Manager: unable to attach existing VHD when creating VM from powershell / azure preview portal
body: <p>trying to migrate VMs from Azure Service Management to Azure Resource Manager, after having created new storage accounts and new vm configuration under ARM, I'm not able to deploy VMs WITH attached data disks based on migrated vhds..</p>
  
  <p>Note: the deployment works w/o datadisks, fails with datadisks attached</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>ResourceGroupName        : 
  Id                       : 
  Name                     : n1n3-dc-1506
  Type                     : 
  Location                 : 
  Tags                     : null
  AvailabilitySetReference : null
  Extensions               : null
  HardwareProfile          : {
                               "VirtualMachineSize": "Standard_A2"
                             }
  InstanceView             : null
  NetworkProfile           : {
                               "NetworkInterfaces": [
                                 {
                                   "Primary": true,
                                   "ReferenceUri": "/subscriptions/b540a9de-cd22-4d3e-b302-fd57b053cc8e/resourceGroups/N1N3/providers/Microsoft.Network/networkInterfaces/n1n3-dc-1506-NIC0"
                                 }
                               ]
                             }
  OSProfile                : null
  Plan                     : null
  ProvisioningState        : 
  StorageProfile           : {
                               "DataDisks": [
                                 {
                                   "DiskSizeGB": 1000,
                                   "Lun": 0,
                                   "Caching": "ReadOnly",
                                   "CreateOption": "attach",
                                   "Name": "n1n3-dc-1506-data0.vhd",
                                   "SourceImage": null,
                                   "VirtualHardDisk": {
                                     "Uri": "https://n1n3dcstdlrs1506.blob.core.windows.net/vhds/n1n3-dc-1506-data0.vhd"
                                   }
                                 }
                               ],
                               "ImageReference": null,
                               "OSDisk": {
                                 "OperatingSystemType": "Windows",
                                 "Caching": "ReadOnly",
                                 "CreateOption": "attach",
                                 "Name": "n1n3-dc-1506-os.vhd",
                                 "SourceImage": null,
                                 "VirtualHardDisk": {
                                   "Uri": "https://n1n3dcstdlrs1506.blob.core.windows.net/vhds/n1n3-dc-1506-os.vhd"
                                 }
                               },
                               "SourceImage": null
                             }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Deployment status</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>EndTime             : 19/06/2015 12:12:08 +02:00
  Error               : Microsoft.Azure.Management.Compute.Models.ApiError
  Output              : 
  StartTime           : 19/06/2015 12:12:07 +02:00
  Status              : Failed
  TrackingOperationId : f00aba57-e49d-4574-813a-2dc4803e6aa8
  RequestId           : 8fbfc336-05e4-47c4-a211-e2a9a5b40871
  StatusCode          : OK</code></pre>
  </div>
  </div>
  </p>
  
  <p>Note: deploying the VMs, and trying to attach disks later fails anyway.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code># Get the VM
  $DC2vm = Get-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName
  # Add Data Disk 
  Add-AzureVMDataDisk –VM $DC2vm –Name $($DCdstVMName + '-data0.vhd') –VhdUri $('https://'+$DCdestSTDStorageName+'.blob.core.windows.net/vhds/'+$($DCdstVMName + '-data0.vhd')) –LUN 0 –Caching ReadOnly –DiskSizeinGB 500 -CreateOption attach -Verbose
  # Update VM state
  Update-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName –VM $DC2vm
  
  
  Update-AzureVM : PropertyChangeNotAllowed: Changing property 'dataDisks' is not allowed.
  In riga:4 car:1
  + Update-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName –VM $DC2vm
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : CloseError: (:) [Update-AzureVM], CloudException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any guess?
  Many thanks,
  Francesco</p>