Azure ARM (13) Create a new ARM VM from an existing VHD file

Publisher:MysticSerenadeLatest update time:2019-12-12 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  This article refers to the ARM Template of Git Hub:

  https://github.com/Azure/azure-quickstart-templates/blob/master/201-vm-specialized-vhd-existing-vnet/azuredeploy.json

  But the Template on Git Hub does not contain Availability Set

 

  I modified this Template to set a high availability set:

  https://github.com/leizhang1984/AzureChinaPowerShell/tree/master/ARM/VMSpecializedVHD

 

  In many cases, we need to create a new ARM VM from the VHD file of the operating system disk of the Classic VM.

  The key steps here are as follows:

  1. Create a Classic VM and obtain the VHD path of the OS Disk

2. Create a new one   through ARM Portal:  https://portal.azure.cn

  -  Azure ARM Resource Group

  -  ARM Storage Account

  -  ARM Virtual Network和Subnet

  3. If the Classic VM is powered on, use the AzCopy tool to copy the VHD files of the OS Disk and Data Disk to different containers in the same storage account (Classic Storage).

  Then copy the VHD from Classic Storage Account to ARM Storage Account

  4. If the Classic VM is powered off, use the AzCopy tool to copy the VHD files of the OS Disk and Data Disk to the ARM Storage Account.

  5. Run Azure PowerShell to execute Template Deployment

  

  Let's start this section

1. First , we create a new Azure Classic VM   in ASM mode ( https://manage.windowsazure.cn ). Steps omitted.

  2. Check the OS Disk and Data Disk of this Classic VM, as shown in red in the following figure:

  

3. Create a new one   through ARM Portal:  https://portal.azure.cn

  -  Azure ARM Resource Group

  -  ARM Storage Account

  -  ARM Virtual Network和Subnet

  4. To facilitate copying VHD, we shut down the virtual machine first. (Note that you must bind the fixed VIP and intranet DIP before shutting down)

  5. Use the AzCopy tool to copy the VHD files of OS Disk and Data Disk to the ARM Storage Account.

  6. After copying, we need to modify the corresponding ARM Template

  https://github.com/leizhang1984/AzureChinaPowerShell/tree/master/ARM/VMSpecializedVHD

  

  7. azuredeploy.json in Git Hub, no need to modify

  8. In azuredeploy.parameters.json in Git Hub, make the following changes:


{

    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",

    "contentVersion": "1.0.0.0",

    "parameters": {

        "dnsNameForPublicIP": {

            //Must be lowercase

            "value": "leiarmvmpublicip"

        },

        "existingVirtualNetworkName": {

            //Virtual network name, manually pre-selected and created

            "value": "LeiARMVNet"

        },

        "existingVirtualNetworkResourceGroup": {

            //In ARM mode, Resource Group name

            "value": "LeiARMRG"

        },

        "subnetName": {

            //In ARM mode, virtual network subnet name

            "value": "subnet-1"

        },


        "osDiskVhdUri": {

            //VHD file of the operating system

            "value": "https://leiarmstorage.blob.core.chinacloudapi.cn/vhds/LeiASMWeb01-LeiASMWeb01-2017-03-27.vhd"

        },

        "vmName": {

            //Virtual machine name

           "value": "LeiARMVMWeb01"

        },

        "osType": {

            //Operating system type

            "value": "Windows"

        },

        "vmSize": {

            //VM instance size

            "value": "Standard_D1_V2"

        },

        "diagStorageAccountName":{

            //Storage Account Name used by diag, must be lowercase

            //Can be the same as the Storage Account Name where osDiskVhdUri is located

             "value": "leiarmstoragediag"

        },

         "availabilitySetName":{

            //High availability set name

             "value": "Web-AvbSet"

        }

    }

} 

 

  10. Run Azure PowerShell to verify:


#Login Azure China Cloud

Add-AzureRmAccount -EnvironmentName AzureChinaCloud;


# Select Azure China subscription ID

Select-AzureRmSubscription -SubscriptionID '[Subscription ID]'


#Execute Azure Deploy

New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName LeiARMRG -Mode Incremental -TemplateFile 'D:vmforuserimageazuredeploy.json' -TemplateParameterFile 'D:vmforuserimageazuredeploy.parameters.json'

 

  11. After the execution is completed, the VHD file of the ARM Storage Account will be created in a new ARM VM. As follows:

  

Keywords:ARM Reference address:Azure ARM (13) Create a new ARM VM from an existing VHD file

Previous article:Azure ARM (12) In ARM mode, set multiple public IP addresses on the load balancer
Next article:Azure ARM (15) Create an ARM VM based on an existing VHD file

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号