Creating virtual machines using virtual machine image

Creating virtual machines using virtual machine image

Creating virtual machines using virtual machine image requires you to specify either an existing operating system disk, or a virtual machine image. Virtual machine images have different provisioning settings depending on whether the source image is Windows or Linux-based. That being said, a signiicant portion of the coniguration options will be the same regardless of the operating system type. Within the management portal, you select the image name from the Gallery view, as Figure 1 shows.

Creating virtual machines using virtual machine image 1

FIGURE 1 The Gallery view for virtual machines

Using the Azure PowerShell cmdlets you can enumerate the available images using the Get-AzureVMImage cmdlet. This cmdlet will return all of the image information that is available (including some images that do not appear in the management portal). It can be quite overwhelming without applying some basic filters.

To only return images available for the Windows Server 2012 R2 Datacenter family, you can filter on the $_.ImageFamily property, as shown in the following example and Figure 2.

$imageFamily = “Windows Server 2012 R2 Datacenter”
Get-AzureVMImage | where { $_.ImageFamily -eq $imageFamily }

Creating virtual machines using virtual machine image 2

FIGURE 2 Enumerating available images by image family

The Azure PowerShell cmdlets use the ImageName property to specify the image to use during creation. You can take the previous example one step further by sorting the PublishedDate in descending order, and then select the ImageName to only return the latest ImageName for the requested image family as shown in the following example and Figure 3.

$imageFamily = “Windows Server 2012 R2 Datacenter”
$imageName = Get-AzureVMImage |
where { $_.ImageFamily -eq $imageFamily } |
sort PublishedDate -Descending |
select -ExpandProperty ImageName -First 1

Creating virtual machines using virtual machine image 3

FIGURE 3 Identifying the newest image by image family

When the image name has been determined, it is passed to the New-AzureQuickVM, or the New-AzureVMConig cmdlet with the ImageName parameter

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...

Creating virtual machines using Azure PowerShell cmdlets

Creating virtual machines using Azure PowerShell cmdlets

You can create virtual machines using Azure PowerShell cmdlets, including advanced configuration options such as: network endpoints, data disks, and Active Directory domain join information. You have full control over the names and locations of the underlying VHD (virtual hard disk) files for the virtual machine during creation. Like the Azure cross-platform command-line tools, the  Azure PowerShell cmdlets support most Azure resources for automation. The Azure PowerShell cmdlets only work on Windows clients.

There are two methods of creating a virtual machine using the Azure PowerShell cmdlets.

The first method is to use the New-AzureQuickVM cmdlet. This cmdlet allows you to provisiona single virtual machine with a simple configuration based on an image only. This cmdlet does not support instantiating a virtual machine from a disk. You also cannot specify additional endpoints, or create data disks during virtual machine creation.

The Windows PowerShell following example uses the New-AzureQuickVM cmdlet to create a virtual machine with the instance size set to Small. It is created in the contoso-vms cloud service in the West US region. The image name is retrieved using the Get-AzureVMImage cmdlet.

$adminUser = “[admin user name]”

$password = “[admin password]”

$serviceName = “contoso-vms”

$location = “West US”

$size = “Small”

$vmName = “vm1”

$imageFamily = “Windows Server 2012 R2 Datacenter”

$imageName = Get-AzureVMImage |

where { $_.ImageFamily -eq $imageFamily } |

sort PublishedDate -Descending |

select -ExpandProperty ImageName -First 1

New-AzureQuickVM -Windows `

-ServiceName $serviceName `

-Name $vmName `

-ImageName $imageName `

-AdminUsername $adminUser `

-Password $password `

-Location $location `

-InstanceSize $size

The second method uses a combination of cmdlets to build up a configuration object for the virtual machine. With this technique you can add additional options to the virtual machine at creation time such as data disks, endpoints, and Active Directory domain join information. The first cmdlet to call is New-AzureVMConig, which creates a local configuration object that can be passed to other Azure cmdlets that support the VM parameter either directly, or using the Windows PowerShell pipeline operator. With this method you can set operating system and data disk configuration (custom paths and file names), configure endpoints (including load-balanced), as well as advanced network features such as reserved, instance level, and static IP addresses.

The Windows PowerShell following example creates a Small virtual machine named vm2 in the contoso-vms cloud service. It also configures the new virtual machine to have an endpoint open for TCP port 1433 using the Add-AzureEndpoint cmdlet, and a 10 GB data disk attached using the Add-AzureData disk cmdlet.

$adminUser = “[admin user name]”

$password = “[admin password]”

$serviceName = “contoso-vms”

$location = “West US”

$size = “Small”

$vmName = “vm2”

$imageFamily = “Windows Server 2012 R2 Datacenter”

$imageName = Get-AzureVMImage |

where { $_.ImageFamily -eq $imageFamily } |

sort PublishedDate -Descending |

select -ExpandProperty ImageName -First 1

New-AzureVMConfig -Name $vmName `

-InstanceSize $size `

-ImageName $imageName |

Add-AzureProvisioningConfig -Windows `

-AdminUsername $adminUser `

-Password $password |

Add-AzureDataDisk -CreateNew `

-DiskSizeInGB 10 `

-LUN 0 `

-DiskLabel “data” |

Add-AzureEndpoint -Name “SQL” `

-Protocol tcp `

-LocalPort 1433 `

-PublicPort 1433 |

New-AzureVM -ServiceName $serviceName `

-Location $location

In the above example, the virtual machine configuration is created using the New-AzureVMConfig cmdlet, and passed to each of the cmdlets using the PowerShell pipeline operator. This can also be accomplished by storing the returned configuration in a variable and passing it with the VM parameter (Add-AzureEndpoint -VM $config), or by piping the returned variable itself to the cmdlet ($conig | Add-AzureEndpoint). Variations may show up on the exams so it is important to be familiar with each syntax. There are several additional cmdlets used in this example that are not available with New-AzureQuickVM. The Add-AzureProvisioningConig cmdlet is used to specify the configuration information needed when provisioning from an image such as machine name, and

the administrator user name and password. This cmdlet can modify the behavior of the virtual machine in several other ways. The Add-AzureDataDisk cmdlet is used to attach new empty disks, or attach existing data disks, to a virtual machine. The Add-AzureEndpoint cmdlet is used to create an input endpoint on the virtual machine. Input endpoints allow network trafic into the virtual machine on a specific port. This cmdlet can also be used to add load-balanced endpoints, and can attach access control lists.

To create the virtual machine using this technique you must pass the configuration object to the New-AzureVM cmdlet. The New-AzureVM cmdlet does the bulk of the work of creating the virtual machine with the passed in configuration. Table below shows the differences between the two approaches for creating virtual machines.

New-AzureQuickVMNew-AzureVMConfig and New-AzureVM
Windows and Linux supportedWindows and Linux supported
Create only from imageCreate from image or operating system disk
Specify availability set nameSpecify availability set name
Specify subnet and virtual networkSpecify subnet and virtual network
Deploy to location or afinity groupDeploy to location or afinity group
Deploy X509 certiicatesDeploy X509 certiicates
Deploy SSH certiicates on Linux virtual machinesDeploy SSH certiicates on Linux virtual machines
Specify Active Directory domain join information
Require admin password reset on first login
Create new or attach existing data disks
Configure endpoints (including internal and external load balancing)
Disable Windows Update
Specify the time zone
Specify static IP addresses
Specify reserved IP address of the cloud service/domain name

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...

Creating virtual machines using cross platform command-line tools

Creating virtual machines using cross platform command-line tools

You can create virtual machines using cross platform command-line tools, as Azure allows you to provision and manage virtual machines and many other Azure resources. The commands in these tools can be scripted to provide automated deployments. The cross-platform command-line tools are built using Node.js, and as the name implies will work across multiple platforms. The tools are supported on Windows, Mac, and Linux.

There are few ways to install the X-Plat CLI; using installer packages for Windows and OS X or combination of Node.js and NPM for Linux.

Node.js and npm via nave

Nave is a tool for handling node.js installations. Nave is to node.js just like RVM is to Ruby. It pulls directly from nodejs.org

Follow below instructions:

Note: # = explanation; $ command = execute on Linux VM

$ sudo su –#install node.js through nave
$ wget https://raw.github.com/isaacs/nave/master/nave.sh
$ chmod +x nave.sh
$ ./nave.sh install 0.10.15
$ ./nave.sh use 0.10.15
$ node –v

#install npm

$ curl -s https://npmjs.org/install.sh > npm-install-$$.sh
$ sh npm-install-*.sh

Microsoft Azure X-Plat CLI

use npm command to install Azure X-Plat CLI

#install X-Plat CLI
$ npm install azure-cli -g

Using Microsoft Azure X-Plat CLI

Type $azure to test and show sub-commands

Microsoft Azure Publish Settings File

MIcrosoft Azure Publish Settings File needs to be downloaded and imported in order to create resources on related subscription.

$azure account download
$azure account import “path to the publishing file”

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...

Creating virtual machines using the Azure management portal

Creating virtual machines using the Azure management portal

You can create virtual machines using the Azure management portal, the Azure PowerShell cmdlets, the Azure cross-platform command-line tools, or the management REST API. Each method brings with it their own capabilities and tradeoffs, and it is important to understand which tool should be used in the right scenario.

The Azure management portal allows you to use a wide variety of virtual machine images, and pre-defined templates for entire solutions such as SQL Server AlwaysOn, or even a complete SharePoint farm. For individual virtual machines you can specify some, but not all, configuration options at creation time. Some options, such as configuring the load balancer, and specifying data disk configuration, are not available at creation time through the management portal but can be set after the virtual machine is created. Using the management portal, you must create virtual machines in the same cloud service, one virtual machine at a time. This can be cumbersome for large deployments with many virtual machines and automation may make more sense those scenarios. The management portal is cross-platform and is supported in most modern browsers.

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...

Identifying supported Microsoft workloads

Identifcation of supported Microsoft workloads

Before configuring Azure virtual machines we must identify supported Microsoft workloads as these Azure VMs are based on Windows Server Hyper-V but not all features within Hyper-V are directly supported. Keeping this in mind help avoid surprises later that all workloads from Microsoft (including roles and features of Windows Server itself) are not supported when running within Azure Virtual Machines. The recommended way for keeping track of supported and not supported workloads using Microsoft support article: http://support.microsoft.com/kb/2721672 which includes details of supported and non supported Microsoft workloads within Azure.  Microsoft Azure team keep this article up-to-date whenever new workloads are brought online, or the support policy changes when new capabilities within Azure enhance what is supported.

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More
Loading...

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More
Loading...