Managing virtual machines for Windows Azure PowerShell

Source: Internet
Author: User

We can use Windows Azure PowerShell to manage Windows Azure virtual machines. Next, let's look at how to create and delete virtual machines using Windows Azure PowerShell.

1. Get the virtual machine image. Get-azurevmimage This command returns a list of virtual machine images, because there are so many mirrors in azure now, it's best to redirect to a TXT file for viewing when running the command. In addition, we only need to know the name of the mirror after we create the virtual machine with the NEW-AZUREQUICKVM command, so we can filter out the imagename by executing the Get-azurevmimage plus pipeline. Such as

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/8C/34/ Wkiom1hk7laduquaaaa8lawfuoc295.png "" 644 "height="/>

2. Get the Azure region. Get-azurelocation, also we just need to know DisplayName, through the pipeline filter displayname can be.

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8C/34/ Wkiom1hk7lfgtngiaacjcplai8a341.png "" 644 "height=" 197 "/>

3.NEW-AZUREQUICKVM Create a virtual machine.

In PowerShell, execute the following command sequentially

PS c:\users\huangcj> $image = "55bc2b193643443bb879a78bda516fc8__ Windows-server-2012-datacenter-20161214-zh.cn-127gb.vhd
"
PS c:\users\huangcj> $location = get-azurelocation
PS c:\users\huangcj> $svcname = "Hcjtest"
PS c:\users\huangcj> $admpass = "abc;123456"
PS c:\users\huangcj> new-azurequickvm-windows-instancesize "Large"-servicename $svcname-name "Hcjt5"-imagename $i Ma
Ge-password $admpass-adminusername "HUANGCJ"-location $location [0].name

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8C/31/ Wkiol1hk7ljd2lseaagztppcbsy641.png "" 644 "height=" 166 "/>

$location [0].name is the China East, the Shanghai Data Center, $location [1].name is the Beijing data center.

When you're done, we'll see the created virtual machines in Azure portal.

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/8C/35/ Wkiom1hk7lntt0waaaba2gibdac412.png "" 644 "height=" 111 "/>

4. Deleting a virtual machine REMOVE-AZUREVM

It's easier to delete a name, see

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/8C/31/ Wkiol1hk7lntwznwaaa2xe3msvs017.png "" 644 "height=" 133 "/>

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/8C/31/ Wkiol1hk7lqd6hyzaaciel84rn8856.png "" 644 "height=" 138 "/>

The above command does not delete the hard disk VHD file, and if you want to delete it, add the parameter –deletevhd

Managing virtual machines for Windows Azure PowerShell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.