Pre-requisites

The following prerequisites must be met, before performing the Core capacity check steps.

  1. Internet connection
  2. Valid Azure Subscription
  3. The person who will perform the below steps must have one of the following roles in the Azure subscription
    • Owner
    • Contributor
  4. Some familiarity with the Azure Portal would be beneficial, although not necessary
  5. Latest version of Microsoft .NET Framework (download link)
  6. Latest version of Microsoft Windows Management Framework (download link)
  7. Latest version of Microsoft PowerShell (download link including detailed installation guide)
  8. Latest version of Azure cmdlets (installation guide), although steps are provided below
  9. Some familiarity with PowerShell ISE, although not necessary (documentation)
  10. Some familiarity with the Azure Portal would be beneficial, although not necessary
  11. Some familiarity with PowerShell scripting would be beneficial, although not necessary
  12. OS level Steps
  13. Go to sysprep folder (C:\windows\system32\sysprep) and setup manager

  1. Follow the steps given below –

  1. Select Fully automate the installation

  1. Click on browse and select file type as inf

File with .INF extension will already be present in the sysprep folder

  1. Click on next till you Reach this screen (don’t change anything) –

  1. Setup in now completed. Press cancel now

For 64 bit open sysprep.INF file and modify 4th line replace I386 with amd64

  1. Go C:\sysprep and make the same changes as above for 64 bit

  1. Right click on the task bar and go properties –

Then go to customize and advance

In advance click on clear list

  1. Go to sysprep.exe and click Reseal

  1. Run the below script to commands to capture Image from sysprep VM
$vmname="Vmname"

Login-AzureRmAccount

Set-AzureRmContext -SubscriptionId "Sunscription ID"

Stop-AzureRmVM -ResourceGroupName 'RGName' -Name $vmname

Set-AzureRmVm -ResourceGroupName 'RGName' -Name $vmname -Generalized

Save-AzureRmVMImage -ResourceGroupName 'RGName' -VMName $vmname -DestinationContainerName mytemplates -VHDNamePrefix template -Path c:\test\$VMname.json

 

Note- VHD will be in captured in Same storage account as VM under myTemplates Container

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami