> ## Content Index
> Fetch the complete content index at: https://codeisahighway.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to use Azure PowerShell v1.0.x to capture your own custom virtual machine image under Azure Resource Manager
- URL: https://codeisahighway.com/how-to-use-azure-powershell-v1-0-x-to-capture-your-own-custom-virtual-machine-image-under-azure-resource-manager/
- Published: 2015-12-21T00:58:00.000Z
- Updated: 2026-07-30T19:45:40.000Z
- Author: Stephane Lapointe
- Tags: Microsoft Azure, PowerShell, Virtual Machines, Azure Resource Manager, ARM, HowTo, #Import 2023-07-11 16:44, #Import 2026-09-04 10:31, #Import 2026-09-04 13:56

You have a v2 Azure Virtual Machine that has been generalized and are ready to capture it using Azure PowerShell v1.0.x? All right, buckle your seat belt and follow this guide, at the end you should have your captured VHD in your storage account.

> This post assume you already have a virtual machine on Azure that have been generalized and you want to capture it. You can find out how to generalize your VM and other alternatives for your capture in this article: [Step by Step: How to capture your own custom virtual machine image under Azure Resource Manager](https://codeisahighway.com/how-to-capture-your-own-custom-virtual-machine-image-under-azure-resource-manager-api)

# Capture VM image with PowerShell v1.0.x

Here is the 4 calls that you need to perform in PowerShell to capture your image...

```powershell
# Login into Azure and select the desired subscription
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId {YourSubscriptionId}

```

```powershell
# Deallocate the virtual machine
Stop-AzureRmVM -ResourceGroupName 'CaptureVmImageRG' -Name 'CaptureVmImage'

```

You should have a *Succeeded* status.  
![After Stop-AzureRmVM Call](https://codeisahighway.com/content/images/2015/12/AfterStop-AzureRmVM.png)

```powershell
# Set the Generalized state to the virtual machine
Set-AzureRmVM -ResourceGroupName 'CaptureVmImageRG' -Name 'CaptureVmImage' -Generalized

```

You should have an *OK* StatusCode.  
![After Set-AzureRmVM Generalize Call](https://codeisahighway.com/content/images/2015/12/AfterSetAzureRmVMGeneralizeCall.png)

```powershell
# Capture the image to storage account.
Save-AzureRmVMImage -ResourceGroupName 'CaptureVmImageRG' -VMName 'CaptureVmImage' -DestinationContainerName 'mytemplates' -VHDNamePrefix 'template' -Path C:\temp\capturevmtest\SampleTemplate.json

```

The `-Path` parameter of the `Save-AzureRmVMImage` cmdlet will download a copy of the the ARM template file generated in the storage account and save it where you specified. The JSON will also be outputted in the PowerShell window.

![After Save-AzureRmVMImage Call](https://codeisahighway.com/content/images/2015/12/VMImageCapturedInAzurePowerShellV1.png)

Jump to [Capture is done, what's next?](https://codeisahighway.com/how-to-capture-your-own-custom-virtual-machine-image-under-azure-resource-manager-api#AfterCapture)