Skip to content

Commit 0f2af38

Browse files
authored
Merge pull request #219825 from MicrosoftDocs/release-undo-vmscripts-archive
Release undo vmscripts archive
2 parents e8d9fd2 + 9606df8 commit 0f2af38

8 files changed

+293
-36
lines changed

.openpublishing.redirection.json

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25603,36 +25603,6 @@
2560325603
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-managed-disks-to-same-or-different-subscription",
2560425604
"redirect_document_id": false
2560525605
},
25606-
{
25607-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-copy-managed-disks-vhd.md",
25608-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-managed-disks-vhd",
25609-
"redirect_document_id": false
25610-
},
25611-
{
25612-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-same-or-different-subscription.md",
25613-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-same-or-different-subscription",
25614-
"redirect_document_id": false
25615-
},
25616-
{
25617-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-storage-account.md",
25618-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-storage-account",
25619-
"redirect_document_id": false
25620-
},
25621-
{
25622-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-snapshot.md",
25623-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-snapshot",
25624-
"redirect_document_id": false
25625-
},
25626-
{
25627-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-vhd.md",
25628-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-vhd",
25629-
"redirect_document_id": false
25630-
},
25631-
{
25632-
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd.md",
25633-
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd",
25634-
"redirect_document_id": false
25635-
},
2563625606
{
2563725607
"source_path_from_root": "/articles/virtual-machines/scripts/virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md",
2563825608
"redirect_url": "/previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-vm-from-managed-os-disks",

articles/virtual-machines/TOC.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,17 +1446,17 @@
14461446
- name: PowerShell
14471447
items:
14481448
- name: Create managed disk from a VHD
1449-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd
1449+
href: scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd
14501450
- name: Create a managed disk from a snapshot
1451-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-snapshot
1451+
href: scripts/virtual-machines-powershell-sample-create-managed-disk-from-snapshot
14521452
- name: Copy a snapshot to the same or different subscription
1453-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-same-or-different-subscription
1453+
href: scripts/virtual-machines-powershell-sample-copy-snapshot-to-same-or-different-subscription
14541454
- name: Export a snapshot as a VHD to a storage account
1455-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-snapshot-to-storage-account
1455+
href: scripts/virtual-machines-powershell-sample-copy-snapshot-to-storage-account
14561456
- name: Export a managed disk as a VHD to a storage account
1457-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-copy-managed-disks-vhd
1457+
href: scripts/virtual-machines-powershell-sample-copy-managed-disks-vhd
14581458
- name: Create a snapshot from a VHD
1459-
href: /previous-versions/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd
1459+
href: scripts/virtual-machines-powershell-sample-create-snapshot-from-vhd
14601460
- name: Networking
14611461
items:
14621462
- name: Overview
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Export/Copy the VHD of a managed disk to another region's account (Windows) - PowerShell
3+
description: Azure PowerShell script sample - Export/Copy the VHD of a managed disk to a storage account in same or different region
4+
services: virtual-machines-windows
5+
documentationcenter: storage
6+
author: ramankumarlive
7+
manager: kavithag
8+
9+
tags: azure-service-management
10+
11+
ms.assetid:
12+
ms.service: virtual-machines-windows
13+
14+
ms.topic: sample
15+
ms.tgt_pltfrm: vm-windows
16+
ms.workload: infrastructure
17+
ms.date: 09/17/2018
18+
ms.author: ramankum
19+
---
20+
21+
# Export/Copy the VHD of a managed disk to a storage account in different region with PowerShell (Windows)
22+
23+
This script exports the VHD of a managed disk to a storage account in different region. It first generates the SAS URI of the managed disk and then uses it to copy the underlying VHD to a storage account in different region. Use this script to copy managed disks to another region for regional expansion.
24+
25+
[!INCLUDE [sample-powershell-install](../../../includes/sample-powershell-install.md)]
26+
27+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
28+
29+
30+
31+
## Sample script
32+
33+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/copy-managed-disks-vhd-to-storage-account/copy-managed-disks-vhd-to-storage-account.ps1 "Copy the VHD of a managed disk")]
34+
35+
36+
## Script explanation
37+
38+
This script uses the following commands to generate SAS URI of a managed disk and copies the underlying VHD to a storage account using the SAS URI. Each command in the table links to the command specific documentation.
39+
40+
| Command | Notes |
41+
|---|---|
42+
| [Grant-AzDiskAccess](/powershell/module/az.compute/grant-azdiskaccess) | Generates SAS URI for a managed disk that is used to copy the underlying VHD to a storage account. |
43+
| [New-AzureStorageContext](/powershell/module/azure.storage/new-azurestoragecontext) | Creates a storage account context using the account name and key. This context can be used to perform read/write operations on the storage account. |
44+
| [Start-AzureStorageBlobCopy](/powershell/module/azure.storage/start-azurestorageblobcopy) | Copies the underlying VHD of a snapshot to a storage account |
45+
46+
## Next steps
47+
48+
[Create a managed disk from a VHD](./virtual-machines-powershell-sample-create-managed-disk-from-vhd.md?toc=%252fpowershell%252fmodule%252ftoc.json)
49+
50+
[Create a virtual machine from a managed disk](./virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md?toc=%2fpowershell%2fmodule%2ftoc.json)
51+
52+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
53+
54+
Additional virtual machine PowerShell script samples can be found in the [Azure Windows VM documentation](../windows/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Copy snapshot of managed disk to subscription (Windows) - PowerShell
3+
description: Azure PowerShell Script Sample - Copy (move) snapshot of a managed disk to same or different subscription
4+
services: virtual-machines-windows
5+
documentationcenter: storage
6+
author: ramankumarlive
7+
manager: kavithag
8+
9+
tags: azure-service-management
10+
11+
ms.assetid:
12+
ms.service: virtual-machines-windows
13+
14+
ms.topic: sample
15+
ms.tgt_pltfrm: vm-windows
16+
ms.workload: infrastructure
17+
ms.date: 02/28/2019
18+
ms.author: ramankum
19+
---
20+
21+
# Copy snapshot of a managed disk in same subscription or different subscription with PowerShell (Windows)
22+
23+
This script copies a snapshot of a managed disk to same or different subscription. Use this script for the following scenarios:
24+
25+
1. Migrate a snapshot in Premium storage (Premium_LRS) to Standard storage (Standard_LRS or Standard_ZRS) to reduce your cost.
26+
1. Migrate a snapshot from locally redundant storage (Premium_LRS, Standard_LRS) to zone redundant storage (Standard_ZRS) to benefit from the higher reliability of ZRS storage.
27+
1. Move a snapshot to different subscription in the same region for longer retention.
28+
29+
[!INCLUDE [sample-powershell-install](../../../includes/sample-powershell-install.md)]
30+
31+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
32+
33+
34+
35+
## Sample script
36+
37+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/copy-snapshot-to-same-or-different-subscription/copy-snapshot-to-same-or-different-subscription.ps1 "Copy snapshot")]
38+
39+
## Script explanation
40+
41+
This script uses following commands to create a snapshot in the target subscription using the Id of the source snapshot. Each command in the table links to command specific documentation.
42+
43+
| Command | Notes |
44+
|---|---|
45+
| [New-AzSnapshotConfig](/powershell/module/az.compute/new-azsnapshotconfig) | Creates snapshot configuration that is used for snapshot creation. It includes the resource Id of the parent snapshot and location that is same as the parent snapshot. |
46+
| [New-AzSnapshot](/powershell/module/az.compute/new-azsnapshot) | Creates a snapshot using snapshot configuration, snapshot name, and resource group name passed as parameters. |
47+
48+
## Next steps
49+
50+
[Create a virtual machine from a snapshot](./virtual-machines-windows-powershell-sample-create-vm-from-snapshot.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
51+
52+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
53+
54+
Additional virtual machine PowerShell script samples can be found in the [Azure Windows VM documentation](../windows/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: PowerShell Sample - Export/Copy snapshot as VHD to a storage account in different region
3+
description: Azure PowerShell Script Sample - Export/Copy snapshot as VHD to a storage account in same different region
4+
documentationcenter: storage
5+
author: ramankumarlive
6+
manager: kavithag
7+
ms.service: virtual-machines
8+
ms.subservice: disks
9+
ms.topic: sample
10+
ms.workload: infrastructure
11+
ms.date: 06/05/2017
12+
ms.author: ramankum
13+
---
14+
15+
# Export/Copy managed snapshots as VHD to a storage account in different region with PowerShell
16+
17+
This script exports a managed snapshot to a storage account in different region. It first generates the SAS URI of the snapshot and then uses it to copy it to a storage account in different region. Use this script to maintain backup of your managed disks in different region for disaster recovery.
18+
19+
[!INCLUDE [sample-powershell-install](../../../includes/sample-powershell-install.md)]
20+
21+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
22+
23+
24+
25+
## Sample script
26+
27+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/copy-snapshot-to-storage-account/copy-snapshot-to-storage-account.ps1 "Copy snapshot")]
28+
29+
30+
## Script explanation
31+
32+
This script uses following commands to generate SAS URI for a managed snapshot and copies the snapshot to a storage account using SAS URI. Each command in the table links to command specific documentation.
33+
34+
| Command | Notes |
35+
|---|---|
36+
| [Grant-AzSnapshotAccess](/powershell/module/az.compute/new-azdisk) | Generates SAS URI for a snapshot that is used to copy it to a storage account. |
37+
| [New-AzureStorageContext](/powershell/module/azure.storage/new-azurestoragecontext) | Creates a storage account context using the account name and key. This context can be used to perform read/write operations on the storage account. |
38+
| [Start-AzureStorageBlobCopy](/powershell/module/azure.storage/start-azurestorageblobcopy) | Copies the underlying VHD of a snapshot to a storage account |
39+
40+
## Next steps
41+
42+
[Create a managed disk from a VHD](virtual-machines-powershell-sample-create-managed-disk-from-vhd.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
43+
44+
[Create a virtual machine from a managed disk](./virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
45+
46+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
47+
48+
Additional virtual machine PowerShell script samples can be found in the [Azure Linux VM documentation](../linux/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Create managed disk from snapshot - PowerShell sample
3+
description: Azure PowerShell Script Sample - Create a managed disk from a snapshot
4+
services: virtual-machines
5+
documentationcenter: storage
6+
author: ramankumarlive
7+
manager: kavithag
8+
ms.service: virtual-machines
9+
ms.subservice: disks
10+
ms.topic: sample
11+
ms.tgt_pltfrm: vm-windows
12+
ms.workload: infrastructure
13+
ms.date: 06/05/2017
14+
ms.author: ramankum
15+
---
16+
17+
# Create a managed disk from a snapshot with PowerShell
18+
19+
This script creates a managed disk from a snapshot. Use it to restore a virtual machine from snapshots of OS and data disks. Create OS and data managed disks from respective snapshots and then create a new virtual machine by attaching managed disks. You can also restore data disks of an existing VM by attaching data disks created from snapshots.
20+
21+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
22+
23+
24+
25+
## Sample script
26+
27+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/create-managed-disk-from-snapshot/create-managed-disk-from-snapshot.ps1 "Create managed disk from snapshot")]
28+
29+
30+
## Script explanation
31+
32+
This script uses following commands to create a managed disk from a snapshot. Each command in the table links to command specific documentation.
33+
34+
| Command | Notes |
35+
|---|---|
36+
| [Get-AzSnapshot](/powershell/module/az.compute/get-azsnapshot) | Gets snapshot properties. |
37+
| [New-AzDiskConfig](/powershell/module/az.compute/new-azdiskconfig) | Creates disk configuration that is used for disk creation. It includes the resource Id of the parent snapshot, location that is same as the location of parent snapshot and the storage type. |
38+
| [New-AzDisk](/powershell/module/az.compute/new-azdisk) | Creates a disk using disk configuration, disk name, and resource group name passed as parameters. |
39+
40+
41+
## Next steps
42+
43+
[Create a virtual machine from a managed disk](./virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md?toc=%2fpowershell%2fmodule%2ftoc.json)
44+
45+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
46+
47+
Additional virtual machine PowerShell script samples can be found in the [Azure Windows VM documentation](../windows/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Create a managed disk from a VHD file in a storage account in a subscription - PowerShell Sample
3+
description: Azure PowerShell Script Sample - Create a managed disk from a VHD file in a storage account in same or different subscription
4+
documentationcenter: storage
5+
author: ramankumarlive
6+
manager: kavithag
7+
ms.service: virtual-machines
8+
ms.topic: sample
9+
ms.workload: infrastructure
10+
ms.date: 06/05/2017
11+
ms.author: ramankum
12+
---
13+
14+
# Create a managed disk from a VHD file in a storage account in same or different subscription with PowerShell
15+
16+
This script creates a managed disk from a VHD file in a storage account in same or different subscription. Use this script to import a specialized (not generalized/sysprepped) VHD to managed OS disk to create a virtual machine. Also, use it to import a data VHD to managed data disk.
17+
18+
Don't create multiple identical managed disks from a VHD file in small amount of time. To create managed disks from a vhd file, blob snapshot of the vhd file is created and then it is used to create managed disks. Only one blob snapshot can be created in a minute that causes disk creation failures due to throttling. To avoid this throttling, create a [managed snapshot from the vhd file](virtual-machines-powershell-sample-create-snapshot-from-vhd.md?toc=%2fpowershell%2fmodule%2ftoc.json) and then use the managed snapshot to create multiple managed disks in short amount of time.
19+
20+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
21+
22+
23+
24+
25+
## Sample script
26+
27+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/create-managed-disks-from-vhd-in-different-subscription/create-managed-disks-from-vhd-in-different-subscription.ps1 "Create managed disk from VHD")]
28+
29+
30+
## Script explanation
31+
32+
This script uses following commands to create a managed disk from a VHD in different subscription. Each command in the table links to command specific documentation.
33+
34+
| Command | Notes |
35+
|---|---|
36+
| [New-AzDiskConfig](/powershell/module/az.compute/new-azdiskconfig) | Creates disk configuration that is used for disk creation. It includes storage type, location, resource ID of the storage account where the parent VHD is stored, VHD URI of the parent VHD. |
37+
| [New-AzDisk](/powershell/module/az.compute/new-azdisk) | Creates a disk using disk configuration, disk name, and resource group name passed as parameters. |
38+
39+
## Next steps
40+
41+
[Create a virtual machine by attaching a managed disk as OS disk](virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md)
42+
43+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
44+
45+
Additional virtual machine PowerShell script samples can be found in the [Azure Windows VM documentation](../windows/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: VHD snapshot to make many identical managed disks (Windows) - PowerShell
3+
description: Azure PowerShell Script Sample - Create a snapshot from a VHD to create multiple identical managed disks in small amount of time
4+
documentationcenter: storage
5+
author: ramankumarlive
6+
manager: kavithag
7+
ms.service: virtual-machines
8+
ms.subservice: disks
9+
ms.topic: sample
10+
ms.tgt_pltfrm: vm-windows
11+
ms.workload: infrastructure
12+
ms.date: 06/05/2017
13+
ms.author: ramankum
14+
---
15+
16+
# Create a snapshot from a VHD to create multiple identical managed disks in small amount of time with PowerShell (Windows)
17+
18+
This script creates a snapshot from a VHD file in a storage account in same or different subscription. Use this script to import a specialized (not generalized/sysprepped) VHD to a snapshot and then use the snapshot to create multiple identical managed disks in small amount of time. Also, use it to import a data VHD to a snapshot and then use the snapshot to create multiple managed disks in small amount of time.
19+
20+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
21+
22+
23+
24+
25+
## Sample script
26+
27+
[!code-powershell[main](../../../powershell_scripts/virtual-machine/create-snapshots-from-vhd-in-different-subscription/create-snapshots-from-vhd-in-different-subscription.ps1 "Create snapshot from VHD")]
28+
29+
30+
## Next steps
31+
32+
[Create a managed disk from snapshot](virtual-machines-powershell-sample-create-managed-disk-from-snapshot.md?toc=%2fpowershell%2fmodule%2ftoc.json)
33+
34+
35+
[Create a virtual machine by attaching a managed disk as OS disk](./virtual-machines-powershell-sample-create-vm-from-managed-os-disks.md)
36+
37+
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/).
38+
39+
Additional virtual machine PowerShell script samples can be found in the [Azure Windows VM documentation](../windows/powershell-samples.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

0 commit comments

Comments
 (0)