<# ================================================================================  
Name: AzureAddVHD.ps1  
Author: Dan Stolts – dstolts&&microsoft.com - http://ITProGuru.com  
Purpose:Demonstrate how to create an extra hard disk and attach to an Azure VM using Powershell.   
   Creates and Azure VHD and attaches it to an existing VM. Using variables for VM name so easy customization.    
   Designed to be used with  
   * CreateAzureNetwork https://gallery.technet.microsoft.com/scriptcenter/Create-Azure-Network-file-c741468c  
   * CreateAzureStorage https://gallery.technet.microsoft.com/scriptcenter/Create-Azure-Storage-f6943b67  
   * AzureVMCustomScriptExtension https://gallery.technet.microsoft.com/scriptcenter/Execute-Custom-Script-863af809  
   * CreateAzureVM https://gallery.technet.microsoft.com/scriptcenter/Create-Azure-Virtual-fa32946e 
NOTE: To connect to Azure, See   
   Accounts:    https://gallery.technet.microsoft.com/Azure-Accounts-with-c1cc7763  
   Subscriptions: https://gallery.technet.microsoft.com/Azure-Subscriptions-with-be76827a  
  Syntax/Execution: Copy portion of script you want to use and paste into PowerShell (or ISE)   
  Disclaimer: Use at your own Risk!  See details at http://ITProGuru.com/privacy   
    * Must Run PowerShell (or ISE)   
    * UAC may get in the way depending on your settings (See: http://ITProGuru.com/PS-UAC)  
    * Requires PowerShell Azure Module (see http://itproguru.com/AzurePowerShell)  
video of Script will be uploaded to https://channel9.msdn.com/Series/GuruPowerShell  
More scripts from Dan Stolts "ITProGuru" at http://ITProGuru.com/Scripts  
#Add Additional Disk to VM 
$myServiceName = "TechRemote" 
$myVMName = "TechRemote" 
Write-Host "Adding Data Disk to" $myVMName -ForegroundColor Green  
Get-AzureVM $myServiceName -Name $myVMName ` 
      | Add-AzureDataDisk -CreateNew -DiskSizeInGB 128 -DiskLabel "TR-Data" -LUN 0 ` 
      | Update-AzureVM 
#Get-AzureVM $myServiceName -Name $MyVMName |Remove-AzureDataDisk -Lun 0 -DeleteVHD |Update-AzureVM 
Demonstrate how to create an extra hard disk and attach to an Azure VM using Powershell. 
   Creates an Azure VHD and attaches it to an existing VM. Using variables for VM name so easy customization.  
   Designed to be used with 
   * AzureVMCustomScriptExtension https://gallery.technet.microsoft.com/scriptcenter/Execute-Custom-Script-863af809
   * CreateAzureVM https://gallery.technet.microsoft.com/scriptcenter/Create-Azure-Virtual-fa32946e
NOTE: To connect to Azure, See 
   Accounts:    https://gallery.technet.microsoft.com/Azure-Accounts-with-c1cc7763
   Subscriptions: https://gallery.technet.microsoft.com/Azure-Subscriptions-with-be76827a

Brought to you by ITProGuru Dan Stolts. (Microsoft –Chief Technology Strategist)

Blog: http://ITProGuru.com

Script Home: http://ITProGuru.com/Scripts

Accompanying Video soon on Channel 9 at https://channel9.msdn.com/Series/GuruPowerShell


Special ASK: Please use the Copy Button to Copy the code
Please Rate this article.  If it was helpful, flag 4 or 5 stars which are the positive values