Azure PowerShell (5) Create simple Azure virtual machines and Linux virtual machines with Azure PowerShell

Source: Internet
Author: User

Windows Azure Platform Family of articles Catalog

Before you introduce a lot of content about Windows Azure, it's basically created from Windows Azure Management portal. This way of creating is straightforward, but the cost of work is enormous if IT administrators need to create 1000 azure services at the same time.

In fact, we can manage Windows Azure through Windows Azure PowerShell through a command-line approach. This makes it very easy to do things like batch creation of Azure Virtual machine. The next step is to start this chapter.

  If you are running Azure PowerShell for the first time, follow the previous article to download the Azure PowerShell settings file and upload it to the cloud.

  

Learn about Azure's help naming

1. Let's Run the command first: HelpAzureto see which command lines Windows Azure provides. I only intercepted part of the content, such as:

  

In the we can see that Azure PowerShell provides a lot of commands. such as the add-azurevhd we have previously explained.

2. We run the command again:get-azurevmimage, this command is to list all Azure Virtual machine images that contain Windows and Linux. I only intercepted part of the content, such as:

  

  

  Start creating an azure virtual machine

1. Specify the current storage

' <SubscriptionName> ' ' <StorageAccount> '

For example, I want to designate a subscription as ' Windows Azure msdn-visual Studio Ultimate ' and a storage account of ' Leivms '.

Execute the following command:

' Windows Azure msdn-visual Studio Ultimate ' ' Leivms '

2. If I want to create a new virtual machine from Azure PowerShell

-VM name is LEIAZUREVM

-VM size is extrasmall

-VM image for Windows Server Datacenter

-windows user name is Leizhang, password is [email protected]

-dns name is leiazure

-High Availability Group for Avbset

-Data Center Select East Asia

  3. to set the image to Windows Server Datacenter First,

$imageList = get-azurevmimage '| where {$_-eq"a699494373c04fc0bc8f2bb1389d6106__ Windows-server-2012-datacenter-201407.01-en.us-127gb.vhd"}$image=$ ImageList[0]

The results of the implementation are as follows:

  

$image command to display information about the Windows Server Datacenter image that we need

 

If I want to blur the query Azureimage, you can use the asterisk (*) wildcard character to blur the query.

For example, I only want to query the image of Windows Server Datacenter, PowerShell is as follows:

$imageList = get-azurevmimage '| where {$_-like"*windows-server-2012-datacenter*"}$ Image=$imageList[0]

4. Create a virtual machine

New-azurevmconfig-name'LEIAZUREVM'-instancesize'Extrasmall'-imagename $image. Imagename-availabilitysetname'Avbset'` | Add-azureprovisioningconfig-windows-adminusername'Leizhang'-password'[email protected]'` | New-azurevm-servicename'leiazure'-location'East Asia'

Execution results such as:

5. Query execution Results

We see create succeeded in PowerShell, but the process of creating an azure VM is asynchronous. At this point we look at the Azure Management Portal and discover that the VMS are being created. Such as:

We can also see the creation of a successful virtual machine via the management portal

OK, we've created the first virtual machine, and if you need to create a 2nd virtual machine LeiAzureVM002 Join the previously created DNS:LeiAzure.cloudapp.net,

and need to join the same high-availability group ' Avbset ', this PowerShell statement executes as follows:

' LeiAzureVM002 ' ' Extrasmall ' ' Avbset ' ' Leizhang ' ' [email protected] ' ' leiazure '

The results of the implementation are as follows:

 

  Create a simple Linux virtual machine

  If I want to create a simple Linux virtual machine, the OS is CentOS.

-VM name is LeiLinuxVM001

-VM size is Medium

-VM image for CentOS 6.4

-windows user name is adminuser, password is [email protected]

-dns name is LeiLinuxVM001

-High Availability Group for Avbset

-Data Center Select East Asia

1. Get CentOS virtual machine image and get CentOS image through fuzzy query

$imageList = get-azurevmimage 'where'*centos*'} $image=$ imagelist[0]

2. Create a virtual machine command:

' LeiLinuxVM001 ' ' Avbset ' ' Adminuser ' ' [email protected] ' |  ' LeiLinuxVM001 ' ' East Asia '

Execution results

Observe the results of the execution:

Bo-Three Stone Blog (hereinafter referred to as Benbow), at the end of this blog article at the bottom of the right is not noted reproduced, source, provenance of the works (content) are the original, the site for the original content of the copyright reserved, do not arbitrarily reproduced, if the need for a friend can send mail contact me; reproduced original works (content ) must also follow the Creative Commons agreement "attribution-non-commercial use-consistent", be sure to indicate or retain the original source of the article and the information of the blogger (Lei Zhang) in the form of a text link, and be sure to keep in mind that the photograph works on this blog (www.cnblog.com/ Threestone) and other relevant watermark copyright information, otherwise deemed to infringe the original Copyright Act; Benbow declined commercial website reprint. All rights reserved, prohibit illegal and malicious plagiarism which violates the copyright protection Law of the People's Republic of China and related laws and Benbow (legal) statement.

Azure PowerShell (5) Create simple Azure virtual machines and Linux virtual machines with 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.