Azure: Moving VHD to Azure with PowerShell and create VM image

%3CLINGO-SUB%20id%3D%22lingo-sub-355832%22%20slang%3D%22en-US%22%3EAzure%3A%20Moving%20VHD%20to%20Azure%20with%20PowerShell%20and%20create%20VM%20image%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-355832%22%20slang%3D%22en-US%22%3E%3CHR%20%2F%3E%0A%3CH1%20id%3D%22toc-hId-1874498149%22%20id%3D%22toc-hId-1900289436%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Credits%22%3E%3C%2FA%3ECredits%3C%2FH1%3E%0A%3CP%3EOriginal%20Article%3A%20%3CA%20href%3D%22https%3A%2F%2Fwikiazure.com%2Fcompute%2Fmover-vhd-hacia-azure-usando-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fwikiazure.com%2Fcompute%2Fmover-vhd-hacia-azure-usando-powershell%2F%3C%2FA%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--677658812%22%20id%3D%22toc-hId--651867525%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Introduction%22%3E%3C%2FA%3EIntroduction%3C%2FH1%3E%0A%3CP%3EThis%20is%20a%20guide%20for%20moving%20a%20VHD%20to%20Azure%20using%20PowerShell%20with%20Azure%20Resource%20Manager%205.1%20module.%20Then%20in%20the%20Azure%20portal%2C%20we%20will%20create%20an%20image%20from%20the%20VHD%2C%20this%20will%20help%20us%20to%20be%20able%20to%20provision%20VMs%20from%20that%20image.%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1065151523%22%20id%3D%22toc-hId-1090942810%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Issue%22%3E%3C%2FA%3EIssue%3C%2FH1%3E%0A%3CP%3EThis%20guide%20is%20provided%20as%20an%20alternative%20solution%20for%20provisioning%20a%20%3CA%20href%3D%22https%3A%2F%2Fazuremarketplace.microsoft.com%2Fen-us%2Fmarketplace%2Fapps%2Fkemptech.vlm-azure%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20KEMP%20LoadMaster%20virtual%20machine%3C%2FA%3E%26nbsp%3Bon%20an%20Azure%20subscription%20with%20the%20Enterprise%20Agreement%20in%20case%20there%20are%20limitations%20for%20the%20current%20region%20to%20provision%20the%20KEMP%20LoadMaster%20directly%20from%20the%20Azure%20marketplace.%3C%2FP%3E%0A%3CP%3E%3CEM%3ENote%3C%2FEM%3E%3A%20You%20can%20move%20an%20exported%20VHD%20from%20a%20local%20virtualization%20tool%20or%20from%20another%20cloud.%3C%2FP%3E%0A%3CP%3EThe%20use%20of%20managed%20disks%20for%20the%20new%20virtual%20machine%20simplifies%20the%20administration%20of%20the%20virtual%20machine%20and%20provides%20better%20availability%20when%20the%20virtual%20machine%20is%20placed%20in%20an%20availability%20set.%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--1487005438%22%20id%3D%22toc-hId--1461214151%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Solution%22%3E%3C%2FA%3ESolution%3C%2FH1%3E%0A%3CP%3EMove%20VHD%20to%20Azure%20using%20PowerShell%20and%20create%26nbsp%3Ban%20image%20object%26nbsp%3Bfrom%20the%20OS%20Disk%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-59291392%22%20id%3D%22toc-hId-85082679%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Pre_requisites%22%3E%3C%2FA%3EPrerequisites%3A%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3EActive%20Azure%20subscription%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Foffers%2Fms-azr-0044p%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Free%20Account%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20Powershell%205.x%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureRM%2F5.1.1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Resource%20Manager%20Module%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EVHD%20of%20the%20KEMP%20LoadMaster%20-%20%3CA%20href%3D%22https%3A%2F%2Fkemptechnologies.com%2Fvlm-download%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Download%20VHD%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EA%20resource%20group%20previously%20provisioned%20in%20the%20Azure%20subscription%20-%20see%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.resources%2Fnew-azurermresourcegroup%3Fview%3Dazurermps-6.13.0%23examples%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Creating%20Resource%20Groups%20using%20PowerShell%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EValidate%20that%20the%20VHD%20is%20fixed%20size%2C%20that%20means%20it%20cannot%20be%2010.1GB%20or%2010.01GB%20in%20that%20case%20expand%20the%20size%20of%20the%20disk%20to%2011GB%26nbsp%3B%20using%20hyper-v%20manager%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-1802101727%22%20id%3D%22toc-hId-1827893014%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Steps%22%3E%3C%2FA%3ESteps%20to%20move%20VHD%20to%20Azure%20using%20PowerShell%3C%2FH2%3E%0A%3CP%3E1.%20We%20will%20open%20Powershell%20on%20our%20local%20computer%20and%20access%20our%20Azure%20subscription%20through%20the%20command%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%22AzureRM.Profile%20%5C%20Login-AzureRmAccount%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F4721.move_2D00_vhd_2D00_to_2D00_Azure_2D00_daverendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F4721.move_2D00_vhd_2D00_to_2D00_Azure_2D00_daverendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20To%20simplify%20the%20process%20we%20will%20use%20two%20variables%3A%20The%20name%20of%20the%20Azure%20subscription%20and%20the%20ID%20of%20the%20Azure%20subscription%20by%20executing%20the%20following%20commands%20(replace%20the%20name%20and%20ID%20of%20your%20subscription)%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24Subscription%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22Your%20Subscription%20Name%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24SubscriptionId%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F3250.move_2D00_vhd_2D00_to_2D00_Azure_2D00_2_2D00_daverendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F3250.move_2D00_vhd_2D00_to_2D00_Azure_2D00_2_2D00_daverendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E3.%20We%20will%20select%20the%20current%20subscription%20as%20Default%2C%20for%20that%20we%20execute%20the%20following%20command%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22Get-AzureRmSubscription%20-SubscriptionId%22%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23009900%3B%22%3E4%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3Ed%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23009900%3B%22%3E278909%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-xxxx-xxxx-xxxx-xxxxxxxx%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22-TenantId%22%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23009900%3B%22%3E683%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3Ebfafa-xxxx-xxxx-a%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23009900%3B%22%3E787%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-xxxxxxxxx%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22%7C%20Set-AzureRmContext%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E4.%20Proceed%20to%20create%20a%20Storage%20Account%20%2F%20Storage%20Account%20through%20the%20following%20command%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24storageAccount%20%3D%20New-AzureRmStorageAccount%20-ResourceGroupName%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22DRendon%22%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-Name%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22kempvdhtestingdr%22%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%0A%20%20%20%20%20%20%20%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-SkuName%20Standard_LRS%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-Location%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22eastus%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24ctx%20%3D%20%24%20storageAccount.Context%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F4152.04_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F4152.04_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E5.%20Now%20we%20are%20going%20to%20generate%20the%20container%20for%20our%20blob%20storage%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24containerName%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22kempvdhcontainerdr%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3Enew-azurestoragecontainer%20-Name%20%24%20containerName%20-Context%20%24ctx%20-Permission%20blob%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E6.%20Store%20in%20a%20variable%20the%20location%20of%20the%20VHD%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24localPath%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E'C%3A%5CUsers%5Cdaver%5CDownloads%5CVLM-trial%5CLoadMaster-VLM-Microsoft-HyperV%5Cvlm2.vhd'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E7.%20Assign%20a%20variable%20to%20name%20the%20VHD%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24vhdName%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E'kempVhdtest.vhd'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E8.%20Proceed%20to%20move%20the%20VHD%20to%20the%20blob%20storage%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24urlOfUploadedImageVhd%20%3D%20(%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E'%3CA%20href%3D%22https%3A%2F%2Fkempvdhtestingdr.blob.core.windows.net%2Fkempvdhcontainerdr%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fkempvdhtestingdr.blob.core.windows.net%2Fkempvdhcontainerdr%3C%2FA%3E'%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%2B%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E'%2F'%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%0A%20%20%20%20%20%20%20%20%2B%20%24vhdName)%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3EAdd-AzureRmVhd%20-ResourceGroupName%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E%22DRendon%22%3C%2FCODE%3E%20%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-Destination%20%24%20urlOfUploadedImageVhd%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-LocalFilePath%20%24localPath%20-OverWrite%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%22Add-AzureRmVhd%20cmdlet%20uploads%20on-premises%20virtual%20hard%20disks%2C%20in%20.vhd%20file%20format%2C%20to%20a%20blob%20storage%20account%20as%20fixed%20virtual%20hard%20disks%22%3C%2FP%3E%0A%3CP%3EThere%20are%20other%20optional%20parameters%20that%20we%20can%20make%20use%20of%3A%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAsJob%3A%20Run%20cmdlet%20in%20the%20background%20and%20return%20a%20Job%20to%20track%20progress.%3C%2FLI%3E%0A%3CLI%3EBaseImageUriToPatch%3A%20Specifies%20the%20URI%20to%20a%20base%20image%20blob%20in%20Azure%20Blob%20Storage%3C%2FLI%3E%0A%3CLI%3EDefaultProfile%3A%20The%20credentials%2C%20account%2C%20tenant%2C%20and%20subscription%20used%20for%20communication%20with%20Azure.%3C%2FLI%3E%0A%3CLI%3ENumberOfUploaderThreads%3A%20Specifies%20the%20number%20of%20uploader%20threads%20to%20be%20used%20when%20uploading%20the%20.vhd%20file.%3C%2FLI%3E%0A%3CLI%3EOverWrite%3A%20Indicates%20that%20this%20cmdlet%20overwrites%20an%20existing%20blob%20in%20the%20specified%20destination%20URI%2C%20if%20one%20exists.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20VHD%20migration%20process%20will%20start%20right%20away%20and%20depending%20on%20the%20size%20it%20could%20take%20a%20couple%20of%20minutes%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F0576.06_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F0576.06_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20upload%20has%20been%20successful%20you%20should%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F2477.07_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F2477.07_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ENow%20there%20are%202%20options%20to%20create%20the%20image%3A%20from%20PowerShell%20or%20from%20the%20Azure%20Portal.%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--553541729%22%20id%3D%22toc-hId--527750442%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Creating_the_image_of_the_Virtual_Machine%22%3E%3C%2FA%3ECreating%20the%20image%20of%20the%20Virtual%20Machine%3C%2FH1%3E%0A%3CH2%20id%3D%22toc-hId-992755101%22%20id%3D%22toc-hId-1018546388%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Option_1_Creating_the_image_of_the_Virtual_Machine_using_PowerShell%22%3E%3C%2FA%3EOption%201.%20Creating%20the%20image%20of%20the%20Virtual%20Machine%20using%20PowerShell%3C%2FH2%3E%0A%3CP%3E1.%20Let's%20create%20an%20image%20object%20and%20then%20store%20it%20in%20the%20variable%20%24%20imageConfig%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24location%20%3D%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3CCODE%20style%3D%22color%3A%20blue%3B%22%3E'EastUS'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24imageConfig%20%3D%20New-AzureRmImageConfig%20-Location%20%24%20location%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F6443.13_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F6443.13_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E2.%20Then%20we%20are%20going%20to%20set%20the%20properties%20of%20the%20operating%20system%20disk%20in%20the%20object%20of%20the%20image%20using%20the%20Set-AzureRmImageOsDisk%20command%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24imageConfig%20%3D%20Set-AzureRmImageOsDisk%20-Image%20%24imageConfig%20-OsType%20Windows%20-OsState%20Generalized%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-BlobUri%20%24urlOfUploadedImageVhd%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CA%20style%3D%22font-size%3A%2012.1px%3B%22%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F2626.14_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F2626.14_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E3.%20Now%20proceed%20to%20generate%20the%20image%3A%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24image%20%3D%20New-AzureRmImage%20-ImageName%20%24imageName%20-ResourceGroupName%20%24resourceGroupName%20-Image%20%24imageConfig%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CH2%20id%3D%22toc-hId--1559401860%22%20id%3D%22toc-hId--1533610573%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Creating_the_image_of_the_Virtual_Machine_in_Azure%22%3E%3C%2FA%3EOption%202.%20Creating%20the%20image%20of%20the%20Virtual%20Machine%20in%20Azure%3C%2FH2%3E%0A%3CP%3E%26nbsp%3BOnce%26nbsp%3B%3CSPAN%3Ethe%20migration%20process%20is%3C%2FSPAN%3E%20completed%2C%20go%20to%20the%20storage%20account%20to%20verify%20that%20the%20VHD%20is%20correctly%20listed%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F0728.08_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F0728.08_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E2.%20Now%20go%20create%20a%20new%20resource%2C%26nbsp%3B%20search%20for%20%22image%22%20then%20click%20on%20the%20image%20as%20shown%20below%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F8611.09_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F8611.09_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20Provide%20the%20parameters%20required%20to%20provision%20the%20image%20from%20the%20VHD%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F7750.10_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F7750.10_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20will%20see%20a%20notification%20if%20the%20image%20was%20created%20correctly%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F8030.11_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%20width%3A%20380px%3B%20height%3A%2066px%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F8030.11_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20can%20create%20the%20virtual%20machines%20from%20this%20image%20when%20we%20need%20it%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcfs-file.ashx%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F3124.12_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20style%3D%22border-width%3A%200px%3B%20border-style%3A%20solid%3B%22%20src%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fresized-image.ashx%2F__size%2F550x0%2F__key%2Fcommunityserver-wikis-components-files%2F00-00-00-00-05%2F3124.12_2D00_move_2D00_vhd_2D00_to_2D00_Azure_2D00_DaveRendon_2D00_wikiazure.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-379921980%22%20id%3D%22toc-hId-405713267%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Script_Download%22%3E%3C%2FA%3EScript%20Download%3C%2FH1%3E%0A%3CP%3EHere%20is%20the%20complete%20script%20on%20VHD%20migration%20with%20Azure%20Powershell%205.x%2C%20you%20can%20also%20download%20it%20from%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FMove-your-VHD-to-Azure-e16f9fd6%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgallery.technet.microsoft.com%2FMove-your-VHD-to-Azure-e16f9fd6%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CDIV%20class%3D%22reCodeBlock%22%20style%3D%22border%3A%201px%20solid%20%237f9db9%3B%20overflow-y%3A%20auto%3B%22%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3EAzureRM.Profile%5CLogin-AzureRmAccount%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24subscriptionName%20%3D%20%22Your%20Subscription%20Name%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24subscriptionId%20%3D%20%22xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24tenantId%20%3D%22xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%22%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24resourceGroupName%20%3D%20'DRendon'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24location%20%3D%20'EastUS'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24vhdName%20%3D%20'kemp360central-v1.25.vhd'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24imageName%20%3D%20'kempcentral25'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24containerName%20%3D%20%22kempcentraldrtestcontainer%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24storageAccountName%20%3D%20%22kempcentraldrtest%22%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3ESelect-AzureRmSubscription%20-SubscriptionId%20%24subscriptionId%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23Select%20your%20default%20subscription%20on%20ARM%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3EGet-AzureRmSubscription%20-SubscriptionId%20%24subscriptionId%20-TenantId%20%24tenantId%20%7C%20Set-AzureRmContext%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23create%20new%20storage%20account%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24storageAccount%20%3D%20New-AzureRmStorageAccount%20-ResourceGroupName%20%24resourceGroupName%20-Name%20%24storageAccountName%20-SkuName%20Standard_LRS%20-Location%20%24location%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24ctx%20%3D%20%24storageAccount.Context%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23create%20container%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3Enew-azurestoragecontainer%20-Name%20%24containerName%20-Context%20%24ctx%20-Permission%20blob%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23set%20the%20local%20path%20from%20the%20vhd%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24localPath%20%3D%20'C%3A%5CUsers%5Cdaver%5CDownloads%5Ckemp360central%5Ckemp360central-v1.25.vhd'%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23%20set%20the%20url%20of%20the%20image%20and%20move%20the%20vhd%2C%20also%20use%20the%20-overwrite%20option%20since%20process%20might%20fail%20sporadically%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23%20-overwrite%20solves%20the%20error%20Add-AzureRmVhd%20%3A%20The%20pipeline%20was%20not%20run%20because%20a%20pipeline%20is%20already%20running.%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23%20Pipelines%20cannot%20be%20run%20concurrently%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24urlOfUploadedImageVhd%20%3D%20('%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F52418.powershell-arm-5-x-migrate-vhd-to-azure-and-create-vm-image%2Fedit.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2F%3C%2FA%3E'%0A%20%20%20%20%20%20%20%20%2B%20%24storageAccountName%20%2B%20'.blob.core.windows.net%2F'%20%2B%20%24containerName%26nbsp%3B%20%2B%20'%2F'%20%2B%20%24vhdName)%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3EAdd-AzureRmVhd%20-ResourceGroupName%20%24resourceGroupName%20-Destination%20%24urlOfUploadedImageVhd%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-LocalFilePath%20%24localPath%20-OverWrite%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%203px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23%20Create%20a%20managed%20image%20from%20the%20uploaded%20VHD%0A%20%20%20%20%20%20%20%20%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24imageConfig%20%3D%20New-AzureRmImageConfig%20-Location%20%24location%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%23set%20the%20managed%20disk%20from%20the%20image%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24imageConfig%20%3D%20Set-AzureRmImageOsDisk%20-Image%20%24imageConfig%20-OsType%20Windows%20-OsState%20Generalized%20%60%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3E%3CCODE%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FCODE%3E%3CSPAN%20style%3D%22margin-left%3A%2012px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E-BlobUri%20%24urlOfUploadedImageVhd%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23f8f8f8%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20style%3D%22margin-left%3A%200px%20!important%3B%22%3E%3CCODE%20style%3D%22color%3A%20%23000000%3B%22%3E%24image%20%3D%20New-AzureRmImage%20-ImageName%20%24imageName%20-ResourceGroupName%20%24resourceGroupName%20-Image%20%24imageConfig%3C%2FCODE%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-313479438%22%20id%3D%22toc-hId-339270725%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Troubleshooting%22%3E%3C%2FA%3ETroubleshooting%3C%2FH1%3E%0A%3CH2%20id%3D%22toc-hId-259338414%22%20id%3D%22toc-hId-285129701%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Discover_questions%22%3E%3C%2FA%3EDiscover%20questions%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3EWas%20the%20VHD%20uploaded%20to%20Azure%20Cloud%20or%20the%20OS%20on%20the%20VHD%20is%20from%20Azure%20Marketplace%3F%3C%2FLI%3E%0A%3CLI%3EWhat%20Operation%20System%2Fversion%20is%20installed%20on%20the%20VHD%3F%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BDid%20you%20install%20Azure%20Guest%20Agent%20on%20the%20OS%3F%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EWas%20the%20VHD%20OS%20generalized%20before%20shutdown%3F%26nbsp%3B%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EYou%20should%20be%20able%20to%20identify%20what%20Linux%20OS%20type%2Fversion%20is%20running%20on%20your%20PC%2C%20install%20Guest%20Agent%2C%20generalize%20the%20OS%20before%20importing%20it%20to%20Azure%20Cloud.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-2002148749%22%20id%3D%22toc-hId-2027940036%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Steps_you_may_apply_in_order_to_fix_the_issue%22%3E%3C%2FA%3ESteps%20you%20may%20apply%20in%20order%20to%20fix%20the%20issue%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3EIdentify%20OS%20type%2Fversion%2C%20and%20install%20on%20it%20Guest%20Agent.%20Please%20review%20an%20article%3A%20Linux%20distributions%20endorsed%20on%20Azure%3C%2FLI%3E%0A%3CLI%3EGeneralize%20the%20OS%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Flinux%2Fcapture-image%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20How%20to%20create%20an%20image%20of%20a%20virtual%20machine%20or%20VHD%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EReview%20the%20Azure%20documentation%20in%20order%20to%20prepare%20the%20OS.%20Following%20article%20contains%20steps%20how%20to%20prepare%20the%20OS%20and%20install%20required%20applications%3A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fextensions%2Fagent-linux%23requirements%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EUnderstanding%20and%20using%20the%20Azure%20Linux%20Agent%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BFix%20the%20size%20of%20the%20vhd%2C%20that%20is%2C%20the%20VHD%20size%20integer%2C%20i.e.%20200GB%2C%20it%20cannot%20be%20200.5GB%20or%20200.05GB.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BEnsure%20that%26nbsp%3Bblob%20is%20formatted%20as%20VHD%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH1%20id%3D%22toc-hId-1246943147%22%20id%3D%22toc-hId-1272734434%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22See_Also%22%3E%3C%2FA%3ESee%20Also%3C%2FH1%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fprepare-for-upload-vhd-image%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPrepare%20a%20Windows%20VHD%20or%20VHDX%20to%20upload%20to%20Azure%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fbuild-image-with-packer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHow%20to%20use%20Packer%20to%20create%20Windows%20virtual%20machine%20images%20in%20Azure%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-stack%2Fazure-stack-supported-os%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EList%20of%20supported%20images%20for%20Azure%3C%2FA%3E%3CSPAN%3E%26nbsp%3B-%26nbsp%3BThe%20list%20says%20for%20stack%20but%20it%20is%20applicable%20for%20all%20of%20Azure.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH1%20id%3D%22toc-hId--1305213814%22%20id%3D%22toc-hId--1279422527%22%3E%3CA%20target%3D%22_blank%22%20name%3D%22Other_Languages%22%3E%3C%2FA%3EOther%20Languages%3A%3C%2FH1%3E%0A%3CP%3E%26nbsp%3BSpanish%20(es-MX)%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F52416.mover-vhd-hacia-azure-usando-powershell-arm-es-mx.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F52416.mover-vhd-hacia-azure-usando-powershell-arm-es-mx.aspx%3C%2FA%3E%3C%2FP%3E%0A%3CHR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-355832%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHybrid%20Cloud%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
MVP

Credits

Original Article: https://wikiazure.com/compute/mover-vhd-hacia-azure-usando-powershell/

Introduction

This is a guide for moving a VHD to Azure using PowerShell with Azure Resource Manager 5.1 module. Then in the Azure portal, we will create an image from the VHD, this will help us to be able to provision VMs from that image.

Issue

This guide is provided as an alternative solution for provisioning a KEMP LoadMaster virtual machine on an Azure subscription with the Enterprise Agreement in case there are limitations for the current region to provision the KEMP LoadMaster directly from the Azure marketplace.

Note: You can move an exported VHD from a local virtualization tool or from another cloud.

The use of managed disks for the new virtual machine simplifies the administration of the virtual machine and provides better availability when the virtual machine is placed in an availability set.

Solution

Move VHD to Azure using PowerShell and create an image object from the OS Disk

Prerequisites:

Steps to move VHD to Azure using PowerShell

1. We will open Powershell on our local computer and access our Azure subscription through the command:

"AzureRM.Profile \ Login-AzureRmAccount"

 

2. To simplify the process we will use two variables: The name of the Azure subscription and the ID of the Azure subscription by executing the following commands (replace the name and ID of your subscription):

$Subscription = "Your Subscription Name"
$SubscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

3. We will select the current subscription as Default, for that we execute the following command:

"Get-AzureRmSubscription -SubscriptionId" 4d278909-xxxx-xxxx-xxxx-xxxxxxxx "-TenantId" 683bfafa-xxxx-xxxx-a787-xxxxxxxxx "| Set-AzureRmContext"

4. Proceed to create a Storage Account / Storage Account through the following command:

$storageAccount = New-AzureRmStorageAccount -ResourceGroupName "DRendon" `
-Name "kempvdhtestingdr" `
-SkuName Standard_LRS `
-Location "eastus"
$ctx = $ storageAccount.Context

5. Now we are going to generate the container for our blob storage:

$containerName = "kempvdhcontainerdr"
new-azurestoragecontainer -Name $ containerName -Context $ctx -Permission blob

6. Store in a variable the location of the VHD:

$localPath = 'C:\Users\daver\Downloads\VLM-trial\LoadMaster-VLM-Microsoft-HyperV\vlm2.vhd'

7. Assign a variable to name the VHD:

$vhdName = 'kempVhdtest.vhd'

8. Proceed to move the VHD to the blob storage:

$urlOfUploadedImageVhd = ('https://kempvdhtestingdr.blob.core.windows.net/kempvdhcontainerdr' + '/' + $vhdName)
Add-AzureRmVhd -ResourceGroupName "DRendon" -Destination $ urlOfUploadedImageVhd `
-LocalFilePath $localPath -OverWrite

"Add-AzureRmVhd cmdlet uploads on-premises virtual hard disks, in .vhd file format, to a blob storage account as fixed virtual hard disks"

There are other optional parameters that we can make use of: 

  • AsJob: Run cmdlet in the background and return a Job to track progress.
  • BaseImageUriToPatch: Specifies the URI to a base image blob in Azure Blob Storage
  • DefaultProfile: The credentials, account, tenant, and subscription used for communication with Azure.
  • NumberOfUploaderThreads: Specifies the number of uploader threads to be used when uploading the .vhd file.
  • OverWrite: Indicates that this cmdlet overwrites an existing blob in the specified destination URI, if one exists.

The VHD migration process will start right away and depending on the size it could take a couple of minutes:

 

Once the upload has been successful you should see something like this:

 

Now there are 2 options to create the image: from PowerShell or from the Azure Portal. 

Creating the image of the Virtual Machine

Option 1. Creating the image of the Virtual Machine using PowerShell

1. Let's create an image object and then store it in the variable $ imageConfig

$location = 'EastUS'
$imageConfig = New-AzureRmImageConfig -Location $ location

 

2. Then we are going to set the properties of the operating system disk in the object of the image using the Set-AzureRmImageOsDisk command:

$imageConfig = Set-AzureRmImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized `
-BlobUri $urlOfUploadedImageVhd

3. Now proceed to generate the image: 

$image = New-AzureRmImage -ImageName $imageName -ResourceGroupName $resourceGroupName -Image $imageConfig

Option 2. Creating the image of the Virtual Machine in Azure

 Once the migration process is completed, go to the storage account to verify that the VHD is correctly listed:

 

2. Now go create a new resource,  search for "image" then click on the image as shown below:

 

3. Provide the parameters required to provision the image from the VHD as follows:

 

You will see a notification if the image was created correctly:

 

Now we can create the virtual machines from this image when we need it:

 

 

Script Download

Here is the complete script on VHD migration with Azure Powershell 5.x, you can also download it from here: https://gallery.technet.microsoft.com/Move-your-VHD-to-Azure-e16f9fd6

AzureRM.Profile\Login-AzureRmAccount
$subscriptionName = "Your Subscription Name"
$subscriptionId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$tenantId ="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$resourceGroupName = 'DRendon'
$location = 'EastUS'
$vhdName = 'kemp360central-v1.25.vhd'
$imageName = 'kempcentral25'
$containerName = "kempcentraldrtestcontainer"
$storageAccountName = "kempcentraldrtest"
 
Select-AzureRmSubscription -SubscriptionId $subscriptionId
  
#Select your default subscription on ARM
Get-AzureRmSubscription -SubscriptionId $subscriptionId -TenantId $tenantId | Set-AzureRmContext
  
#create new storage account
$storageAccount = New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName -SkuName Standard_LRS -Location $location
$ctx = $storageAccount.Context
  
#create container
 
new-azurestoragecontainer -Name $containerName -Context $ctx -Permission blob
  
#set the local path from the vhd
$localPath = 'C:\Users\daver\Downloads\kemp360central\kemp360central-v1.25.vhd'
  
  
# set the url of the image and move the vhd, also use the -overwrite option since process might fail sporadically
# -overwrite solves the error Add-AzureRmVhd : The pipeline was not run because a pipeline is already running.
# Pipelines cannot be run concurrently
$urlOfUploadedImageVhd = ('https://' + $storageAccountName + '.blob.core.windows.net/' + $containerName  + '/' + $vhdName)
Add-AzureRmVhd -ResourceGroupName $resourceGroupName -Destination $urlOfUploadedImageVhd `
-LocalFilePath $localPath -OverWrite
  
# Create a managed image from the uploaded VHD
$imageConfig = New-AzureRmImageConfig -Location $location
 
#set the managed disk from the image
$imageConfig = Set-AzureRmImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized `
    -BlobUri $urlOfUploadedImageVhd
 
$image = New-AzureRmImage -ImageName $imageName -ResourceGroupName $resourceGroupName -Image $imageConfig





Troubleshooting

Discover questions

  1. Was the VHD uploaded to Azure Cloud or the OS on the VHD is from Azure Marketplace?
  2. What Operation System/version is installed on the VHD?
  3.  Did you install Azure Guest Agent on the OS? 
  4. Was the VHD OS generalized before shutdown? 

You should be able to identify what Linux OS type/version is running on your PC, install Guest Agent, generalize the OS before importing it to Azure Cloud.

Steps you may apply in order to fix the issue

  1. Identify OS type/version, and install on it Guest Agent. Please review an article: Linux distributions endorsed on Azure
  2. Generalize the OS: How to create an image of a virtual machine or VHD
  3. Review the Azure documentation in order to prepare the OS. Following article contains steps how to prepare the OS and install required applications:       Understanding and using the Azure Linux Agent
  4.  Fix the size of the vhd, that is, the VHD size integer, i.e. 200GB, it cannot be 200.5GB or 200.05GB. 
  5.  Ensure that blob is formatted as VHD

See Also

Other Languages:

 Spanish (es-MX): https://social.technet.microsoft.com/wiki/contents/articles/52416.mover-vhd-hacia-azure-usando-power...


0 Replies