Skip to content

Commit b44c477

Browse files
authored
Merge pull request #169890 from stevenmatthew/consolidateSnapshots
Consolidate snapshots
2 parents 6d57103 + c590081 commit b44c477

10 files changed

+161
-169
lines changed

articles/batch/batch-custom-images.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This topic explains how to create a custom image pool using only a managed image
1616

1717
## Prerequisites
1818

19-
- **A managed image resource**. To create a pool of virtual machines using a custom image, you need to have or create a managed image resource in the same Azure subscription and region as the Batch account. The image should be created from snapshots of the VM's OS disk and optionally its attached data disks.
19+
- **A managed image resource**. To create a pool of virtual machines using a custom image, you need to have or create a managed image resource in the same Azure subscription and region as the Batch account. The image should be created from snapshots of the VM's operating system's (OS) disk and optionally its attached data disks.
2020
- Use a unique custom image for each pool you create.
2121
- To create a pool with the image using the Batch APIs, specify the **resource ID** of the image, which is of the form `/subscriptions/xxxx-xxxxxx-xxxxx-xxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage`.
2222
- The managed image resource should exist for the lifetime of the pool to allow scale-up and can be removed after the pool is deleted.
@@ -49,7 +49,7 @@ If you are creating a new VM for the image, use a first party Azure Marketplace
4949

5050
### Create a VM snapshot
5151

52-
A snapshot is a full, read-only copy of a VHD. To create a snapshot of a VM's OS or data disks, you can use the Azure portal or command-line tools. For steps and options to create a snapshot, see the guidance for [Linux](../virtual-machines/linux/snapshot-copy-managed-disk.md) or [Windows](../virtual-machines/windows/snapshot-copy-managed-disk.md) VMs.
52+
A snapshot is a full, read-only copy of a VHD. To create a snapshot of a VMs OS or data disks, you can use the Azure portal or command-line tools. For steps and options to create a snapshot, see the guidance for [VMs](../virtual-machines/snapshot-copy-managed-disk.md).
5353

5454
### Create an image from one or more snapshots
5555

articles/batch/batch-sig-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Follow these guidelines when creating VMs:
7676

7777
### Create a VM snapshot
7878

79-
A snapshot is a full, read-only copy of a VHD. To create a snapshot of a VM's OS or data disks, you can use the Azure portal or command-line tools. For steps and options to create a snapshot, see the guidance for [Linux](../virtual-machines/linux/snapshot-copy-managed-disk.md) or [Windows](../virtual-machines/windows/snapshot-copy-managed-disk.md) VMs.
79+
A snapshot is a full, read-only copy of a VHD. To create a snapshot of a VM's OS or data disks, you can use the Azure portal or command-line tools. For steps and options to create a snapshot, see the guidance for [VMs](../virtual-machines/snapshot-copy-managed-disk.md).
8080

8181
### Create an image from one or more snapshots
8282

articles/virtual-desktop/security-baseline.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,7 @@ The data sources for investigation include the centralized logging sources that
638638

639639
Azure Sentinel provides extensive data analytics across virtually any log source and a case management portal to manage the full lifecycle of incidents. Intelligence information during an investigation can be associated with an incident for tracking and reporting purposes.
640640

641-
- [Snapshot a Windows machine's disk](../virtual-machines/windows/snapshot-copy-managed-disk.md)
642-
643-
- [Snapshot a Linux machine's disk](../virtual-machines/linux/snapshot-copy-managed-disk.md)
641+
- [Snapshot a machine's disk](../virtual-machines/windows/snapshot-copy-managed-disk.md)
644642

645643
- [Microsoft Azure Support diagnostic information and memory dump collection](https://azure.microsoft.com/support/legal/support-diagnostic-information-collection/)
646644

articles/virtual-machines/.openpublishing.redirection.virtual-machines.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,16 @@
15201520
"redirect_url": "/azure/virtual-machines/sizes",
15211521
"redirect_document_id": false
15221522
},
1523+
{
1524+
"source_path_from_root": "/articles/virtual-machines/linux/snapshot-copy-managed-disk.md",
1525+
"redirect_url": "/azure/virtual-machines/snapshot-copy-managed-disk",
1526+
"redirect_document_id": false
1527+
},
1528+
{
1529+
"source_path_from_root": "/articles/virtual-machines/windows/snapshot-copy-managed-disk.md",
1530+
"redirect_url": "/azure/virtual-machines/snapshot-copy-managed-disk",
1531+
"redirect_document_id": true
1532+
},
15231533
{
15241534
"source_path_from_root": "/articles/virtual-machines/linux/b-series-burstable.md",
15251535
"redirect_url": "/azure/virtual-machines/sizes-b-series-burstable",

articles/virtual-machines/TOC.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,10 +1208,8 @@
12081208
href: ../backup/restore-managed-disks.md?context=/azure/virtual-machines/context/context
12091209
- name: Backup and disaster recovery for managed disks
12101210
href: backup-and-disaster-recovery-for-azure-iaas-disks.md
1211-
- name: Snapshot a disk - CLI
1212-
href: ./linux/snapshot-copy-managed-disk.md
1213-
- name: Snapshot a disk - PowerShell
1214-
href: ./windows/snapshot-copy-managed-disk.md
1211+
- name: Snapshot a disk
1212+
href: snapshot-copy-managed-disk.md
12151213
- name: Backup unmanaged disks
12161214
href: ./linux/incremental-snapshots.md
12171215
- name: Backup and disaster recovery for unmanaged disks

articles/virtual-machines/backup-recovery.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ In development and test environments, snapshots provide a quick and simple optio
3939

4040
For more information on creating snapshots, see:
4141

42-
* [Create copy of VHD stored as a Managed Disk using Snapshots in Windows](./windows/snapshot-copy-managed-disk.md)
43-
* [Create copy of VHD stored as a Managed Disk using Snapshots in Linux](./linux/snapshot-copy-managed-disk.md)
44-
45-
42+
* [Create copy of VHD stored as a Managed Disk](./windows/snapshot-copy-managed-disk.md)
4643

4744
## Next steps
4845
You can try out Azure Backup by following the [Azure Backup quickstart](../backup/quick-backup-vm-portal.md).

articles/virtual-machines/linux/snapshot-copy-managed-disk.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

articles/virtual-machines/managed-disks-overview.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ A managed disk snapshot is a read-only crash-consistent full copy of a managed d
106106

107107
Snapshots are billed based on the used size. For example, if you create a snapshot of a managed disk with provisioned capacity of 64 GiB and actual used data size of 10 GiB, that snapshot is billed only for the used data size of 10 GiB. You can see the used size of your snapshots by looking at the [Azure usage report](../cost-management-billing/understand/review-individual-bill.md). For example, if the used data size of a snapshot is 10 GiB, the **daily** usage report will show 10 GiB/(31 days) = 0.3226 as the consumed quantity.
108108

109-
To learn more about how to create snapshots for managed disks, see the following resources:
110-
111-
- [Create a snapshot of a managed disk in Windows](windows/snapshot-copy-managed-disk.md)
112-
- [Create a snapshot of a managed disk in Linux](linux/snapshot-copy-managed-disk.md)
109+
To learn more about how to create snapshots for managed disks, see the [Create a snapshot of a managed disk](windows/snapshot-copy-managed-disk.md) article.
113110

114111
### Images
115112

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: Create an Azure snapshot of a virtual hard disk
3+
description: Learn how to create a copy of an Azure VM to use as a backup or for troubleshooting issues using the portal, PowerShell, or CLI.
4+
author: roygara
5+
ms.author: rogarana
6+
ms.service: storage
7+
ms.subservice: disks
8+
ms.workload: infrastructure-services
9+
ms.topic: how-to
10+
ms.date: 09/07/2021
11+
---
12+
13+
# Create a snapshot of a virtual hard disk
14+
15+
**Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets
16+
17+
A snapshot is a full, read-only copy of a virtual hard disk (VHD). You can use a snapshot as a point-in-time backup, or to help troubleshoot virtual machine (VM) issues. You can take a snapshot of both operating system (OS) or data disk VHDs.
18+
19+
## Create a snapshot of a VHD
20+
21+
If you want to use a snapshot to create a new VM, ensure that you first cleanly shut down the VM. This action clears any processes that are in progress.
22+
23+
# [Portal](#tab/portal)
24+
25+
To create a snapshot using the Azure portal, complete these steps.
26+
27+
1. In the [Azure portal](https://portal.azure.com), select **Create a resource**.
28+
1. Search for and select **Snapshot**.
29+
1. In the **Snapshot** window, select **Create**. The **Create snapshot** window appears.
30+
1. For **Resource group**, select an existing [resource group](/azure/azure-resource-manager/management/overview#resource-groups) or enter the name of a new one.
31+
1. Enter a **Name**, then select a **Region** and **Snapshot type** for the new snapshot. If you would like to store your snapshot in zone-resilient storage, you need to select a region that supports [availability zones](/azure/availability-zones/az-overview). For a list of supporting regions, see [Azure regions with availability zones](/azure/availability-zones/az-region#azure-regions-with-availability-zones).
32+
1. For **Source subscription**, select the subscription that contains the managed disk to be backed up.
33+
1. For **Source disk**, select the managed disk to snapshot.
34+
1. For **Storage type**, select **Standard HDD**, unless you require zone-redundant storage or high-performance storage for your snapshot.
35+
1. If needed, configure settings on the **Encryption**, **Networking**, and **Tags** tabs. Otherwise, default settings are used for your snapshot.
36+
1. Select **Review + create**.
37+
38+
# [PowerShell](#tab/powershell)
39+
40+
This example requires that you use [Cloud Shell](https://shell.azure.com/bash) or have the [Azure CLI](/cli/azure/) installed.
41+
42+
Follow these steps to take a snapshot with the `New-AzSnapshotConfig` and `New-AzSnapshot` cmdlets. This example assumes that you have a VM called *myVM* in the *myResourceGroup* resource group. The code sample provided creates a snapshot in the same resource group and within the same region as your source VM.
43+
44+
First, you'll use the [New-AzSnapshotConfig](/powershell/module/az.compute/new-azsnapshotconfig) cmdlet to create a configurable snapshot object. You can then use the [New-AzSnapshot](/powershell/module/az.compute/new-azsnapshot) cmdlet to take a snapshot of the disk.
45+
46+
1. Set the required parameters. Update the values to reflect your environment.
47+
48+
```azurepowershell-interactive
49+
$resourceGroupName = 'myResourceGroup'
50+
$location = 'eastus'
51+
$vmName = 'myVM'
52+
$snapshotName = 'mySnapshot'
53+
```
54+
55+
1. Use the [Get-AzVM](/powershell/module/az.compute/get-azvm) cmdlet to get the VM containing the VHD you want to copy.
56+
57+
```azurepowershell-interactive
58+
$vm = Get-AzVM `
59+
-ResourceGroupName $resourceGroupName `
60+
-Name $vmName
61+
```
62+
63+
1. Create the snapshot configuration. In the example, the snapshot is of the OS disk. By default, the snapshot uses locally redundant standard storage. We recommend that you store your snapshots in standard storage instead of premium storage whatever the storage type of the parent disk or target disk. Premium snapshots incur additional cost.
64+
65+
```azurepowershell-interactive
66+
$snapshot = New-AzSnapshotConfig `
67+
-SourceUri $vm.StorageProfile.OsDisk.ManagedDisk.Id `
68+
-Location $location `
69+
-CreateOption copy
70+
```
71+
72+
If you want to store your snapshot in zone-resilient storage, you must create the snapshot in a region that supports [availability zones](/azure/availability-zones/az-overview and include the `-SkuName Standard_ZRS` parameter. For a list of regions that support availability zones, see [Azure regions with availability zones](/azure/availability-zones/az-region#azure-regions-with-availability-zones).
73+
74+
1. Take the snapshot.
75+
76+
```azurepowershell-interactive
77+
New-AzSnapshot `
78+
-Snapshot $snapshot `
79+
-SnapshotName $snapshotName `
80+
-ResourceGroupName $resourceGroupName
81+
```
82+
83+
1. Use the [Get-AzSnapshot](/powershell/module/az.compute/get-azsnapshot) cmdlet to verify that your snapshot exists.
84+
85+
```azurepowershell-interactive
86+
Get-AzSnapshot `
87+
-ResourceGroupName $resourceGroupName
88+
```
89+
90+
# [Azure CLI](#tab/cli)
91+
92+
This example requires that you use [Cloud Shell](https://shell.azure.com/bash) or have the [Azure CLI](/cli/azure/) installed.
93+
94+
Follow these steps to take a snapshot with the `az snapshot create` command and the `--source-disk` parameter. This example assumes that you have a VM called *myVM* in the *myResourceGroup* resource group. The code sample provided creates a snapshot in the same resource group and within the same region as your source VM.
95+
96+
1. Get the disk ID with [az vm show](/cli/azure/vm#az_vm_show).
97+
98+
```azurecli-interactive
99+
osDiskId=$(az vm show \
100+
-g myResourceGroup \
101+
-n myVM \
102+
--query "storageProfile.osDisk.managedDisk.id" \
103+
-o tsv)
104+
```
105+
106+
1. Take a snapshot named *osDisk-backup* using [az snapshot create](/cli/azure/snapshot#az_snapshot_create). In the example, the snapshot is of the OS disk. By default, the snapshot uses locally redundant standard storage. We recommend that you store your snapshots in standard storage instead of premium storage whatever the storage type of the parent disk or target disk. Premium snapshots incur additional cost.
107+
108+
```azurecli-interactive
109+
az snapshot create \
110+
-g myResourceGroup \
111+
--source "$osDiskId" \
112+
--name osDisk-backup
113+
```
114+
115+
If you would like to store your snapshot in zone-resilient storage, you need to create it in a region that supports [availability zones](/azure/availability-zones/az-overview) and include the optional `--sku Standard_ZRS` parameter. A list of [availability zones](/azure/availability-zones/az-region#azure-regions-with-availability-zones) can be found here.
116+
117+
1. Use [az snapshot list](/cli/azure/snapshot#az_snapshot_list) to verify that your snapshot exists.
118+
119+
```azurecli-interactive
120+
az snapshot list \
121+
-g myResourceGroup \
122+
- table
123+
```
124+
125+
---
126+
127+
## Next steps
128+
129+
Deploy a virtual machine from a snapshot. Create a managed disk from a snapshot and then attach the new managed disk as the OS disk.
130+
131+
# [Portal](#tab/portal)
132+
133+
For more information, see the example in [Create a VM from a VHD by using the Azure portal](/windows/create-vm-specialized-portal).
134+
135+
# [PowerShell](#tab/powershell)
136+
137+
For more information, see the example in [Create a Windows VM from a specialized disk by using PowerShell](/windows/create-vm-specialized).
138+
139+
# [Azure CLI](#tab/cli)
140+
141+
For more information, see the example in [Create a complete Linux virtual machine with the Azure CLI](/previous-versions/azure/virtual-machines/scripts/virtual-machines-linux-cli-sample-create-vm-from-snapshot?toc=%2fcli%2fmodule%2ftoc.json).
142+
143+
---

0 commit comments

Comments
 (0)