You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 6, 2023. It is now read-only.
#Provide the subscription Id where Managed Disks will be created
1
+
2
+
<#
3
+
4
+
.DESCRIPTION
5
+
6
+
This sample demonstrates how to create a Managed Disk from a VHD file.
7
+
Create Managed Disks from VHD files in following scenarios:
8
+
1. Create a Managed OS Disk from a specialized VHD file. A specialized VHD is a copy of VHD from an exisitng VM that maintains the user accounts, applications and other state data from your original VM.
9
+
Attach this Managed Disk as OS disk to create a new virtual machine.
10
+
2. Create a Managed data Disk from a VHD file. Attach the Managed Disk to an existing VM or attach it as data disk to create a new virtual machine.
11
+
12
+
.NOTES
13
+
14
+
1. Before you use this sample, please install the latest version of Azure PowerShell from here: http://go.microsoft.com/?linkid=9811175&clcid=0x409
15
+
2. Provide the appropriate values for each variable. Note: The angled brackets should not be included in the values you provide.
16
+
17
+
18
+
#>
19
+
20
+
#Provide the subscription Id
2
21
$subscriptionId='yourSubscriptionId'
3
22
4
-
#Provide the name of your resource group where Managed Disks will be created.
23
+
#Provide the name of your resource group
5
24
$resourceGroupName='yourResourceGroupName'
6
25
7
26
#Provide the name of the Managed Disk
@@ -10,28 +29,31 @@ $diskName = 'yourDiskName'
10
29
#Provide the size of the disks in GB. It should be greater than the VHD file size.
11
30
$diskSize='128'
12
31
13
-
#Provide the storage type for Managed Disk. Premium_LRS or Standard_LRS.
14
-
$storageType='Premium_LRS'
32
+
#Provide the URI of the VHD file that will be used to create Managed Disk.
33
+
# VHD file can be deleted as soon as Managed Disk is created.
34
+
# e.g. https://contosostorageaccount1.blob.core.windows.net/vhds/contoso-um-vm120170302230408.vhd
#Provide the storage type for the Managed Disk. PremiumLRS or StandardLRS.
38
+
$sku='PremiumLRS'
15
39
16
-
#Provide the Azure region (e.g. westus) where Managed Disk will be located.
17
-
#This location should be same as the storage account where VHD file is stored
40
+
#Provide the Azure location (e.g. westus) where Managed Disk will be located.
41
+
#The location should be same as the location of the storage account where VHD file is stored.
18
42
#Get all the Azure location using command below:
19
-
#Get-AzLocation
43
+
#Get-AzureRmLocation
20
44
$location='westus'
21
45
22
-
#Provide the URI of the VHD file (page blob) in a storage account. Please not that this is NOT the SAS URI of the storage container where VHD file is stored.
0 commit comments