title: Copying a virtual machine data drive in Microsoft Azure
body: <p>Added more details at the bottom of the question. </p>
  
  <p>We are testing deployment scenarios in Azure VM preview and have run into an issue. </p>
  
  <p>Here is our scenario.  We have a software stack that we use in all of our servers.  We have created an image with all of that stack installed on an attached data drive. We have created a image of the VM that we can use as a template.   Now what we want to do is to to create a VM based on  that template  and create a copy of the data drive and attach it to the newly created VM in an automated manner. </p>
  
  <p>Our problem is that while we have found lots of information about creating drives, we can't find any guidance on how to copy the data drive using Azure for Powershell.</p>
  
  <p>Any thoughts, code, or RTFMs happily accepted.</p>
  
  <p>Cheers,</p>
  
  <p>Terence</p>
  
  <p>We have sucessfully created an operating system image that we can use to create VM's.  But there is a data disk that holds our standard software stack that we want to reuse by copying it across VMs.  The scenario that we are trying to implement is: </p>
  
  <ol>
  <li><p>Create a VM from a standard VM image - PBIMaster </p></li>
  <li><p>Attach a disk as F to that image called PBIMasterDisk </p></li>
  <li><p>Install all of the software required for our app on F: (to big for the OS disk and besides sticking it on the OS disk seems messy)   </p></li>
  <li><p>Build an image from PBIMaster call it PBIMasterImage save it. </p></li>
  <li><p>Create a new image from PBIMaster call it Node1 </p></li>
  <li><p>Copy PBIMasterDisk to a new Azure disk call it Node1Software disk</p></li>
  <li><p>Attach Node1Softwaredisk to Node1 as F:</p></li>
  </ol>
  
  <p>Since the image has the correct registry settings from the previous installs our stack is ready to go.  </p>
  
  <p>9 Add appropriate endpoints. </p>
  
  <p>Rinse and repeat for each additional node. </p>
  
  <p>Hopefully that makes our scenario clearer.  </p>
  
  <p>Thanks. </p>