Classic Virtual Machines in Azure Resource Manager

You can create still classic virtual machines from the Azure portal or by using Azure PowerShell. Although, Microsoft doesn’t recommend because it’s an old platform that they want to move away from it.

Deploying classic virtual machines by using the Azure portal

To create an Azure Resource Manager virtual machine from the Azure portal, perform the following steps:

  1. Sign in to the Azure portal at portal.azure.com.
  2. On the Hub menu, click New, click Compute, and then click Windows Server 2012 R2 Datacenter.
  3. On the Windows Server 2012 R2 Datacenter page, under Select a deployment model, select Classic, and then click Create.
  4. On the Basics blade, enter the name that you want to give your virtual machine. The name cannot contain special characters.
  5. Enter the Windows administrative user name and password. The password must be between eight and 123 characters long, and include at least three of the following: one lower-case character, one upper-case character, one number, and one special character. You will need the user name and password to sign in to the virtual machine.
  6. If you have more than one subscription, specify the one for the new virtual machine, a new or existing resource group, and an Azure datacenter location.
  7. On the Choose a size blade, select an appropriate virtual-machine size for your needs. Each size specifies the number of compute cores, memory, and other features, such as support for Premium Storage. These all affect the price. Azure recommends certain sizes automatically, depending on the image that you choose. The choices available on this blade depend on whether you selected HDD or SSD on the Basics blade.
  8. On the Settings blade, configure storage, networking, extensions, high availability, and monitoring settings for the new virtual machine. The networking settings include the Cloud service (domain name) and Endpoints entries.
  9. Click Summary to review your configuration choices. When you finish reviewing or updating the settings, click Create. As Azure creates the virtual machine, you can track the progress under Virtual Machines on the Hub menu.

These steps use the image based on Windows Server 2012 R2 Datacenter Edition to create a virtual machine.

 

Deploying classic virtual machines by using Azure PowerShell

You also can use the Azure PowerShell interface to create classic virtual machines by using Windows PowerShell cmdlets.

You can define a virtual-machine configuration, and then create the virtual machine, as the following sample code shows:

$newVM = New-AzureVMConfig  -name $vmname -Instance $instance -ImageName $osimage | Add-AzureProvisioningConfig -Windows -AdminUsername $adminname -Password $password | Set-AzureSubnet -SubnetNames $subnet
New-AzureVM -ServiceName $cloudservice -AffinityGroup $affinitygroup -VMs $newVM -VNetName $vnet -DnsSettings $dns -WaitForBoot

Alternatively, you can create and configure a virtual machine in one step, as the following code sample shows:

New-AzureQuickVM -Windows -ImageName $osimage -Location $location -Name $vmname –ServiceName $svcName -InstanceSize $size -AdminUserName $adminname –Password $password

There are more configuration options if you use the New-AzureVMConfig and New-AzureVM cmdlets, such as the ability to use a static internal IP address by using Set-AzureStaticVNetIP. New-AzureVMConfig enables you to create more complex virtual-machine configurations, and then pass those configurations to New-AzureVM.

Azure SDK

The Azure SDK is a collection of tools, runtime binaries, client libraries, and templates that considerably simplify the development, testing, and deployment of Azure services and applications.

Note: The Azure SDK is available for several development platforms, including Microsoft .NET, Java, Node.js, Python, Ruby, and PHP. You can download the most recent version of the SDK for each of them from the Azure Downloads page.

The Azure SDK for .NET installs numerous components, including:

  • Microsoft ASP.NET and Web Tools for Visual Studio to facilitate the creation, deployment, and management of web apps.
  • Azure Tools for Visual Studio to simplify working with applications hosted in Azure Platform as a Service (PaaS) cloud services and Infrastructure as a Service (IaaS) virtual machines.
  • Azure Authoring Tools to automate the deployment and configuration of Azure PaaS cloud services deployment packages.
  • The Azure emulation environment, which consists of the Azure compute and storage emulators to simulate Azure compute and storage services within the Visual Studio interface.
  • Azure Storage Tools to provide tools, such as AzCopy, that allow you to optimize the transfer of data into and out of an Azure Storage account.
  • Azure Libraries for .NET, such as NuGet packages for Azure Storage, Azure Service Bus, and Azure Cache, to make it possible to develop Azure projects while offline.
    Note: NuGet is the package manager for the Microsoft development platform.
  • Azure Resource Manager Tools, including templates, snippets, and scripts to assist with creating and deploying Azure Resource Management resources.
  • Azure Diagnostics with Visual Studio Application Insights integration and support for the profiler to allow you to identify and diagnose performance-related issues in live Azure apps and services.
  • Docker Tools for Visual Studio to provide support for Windows containers.
  • Azure Service Fabric Tools to enable creating, deploying, and upgrading Azure Service Fabric projects from within Visual Studio.
  • Azure HDInsight Tools for Visual Studio to allow you to run your Hive query and provide insight into HDInsight job execution.
  • Azure Data Factory Tools to simplify Azure Data Factory authoring.

Why and when to use Azure CLI

I have been a heavy Windows user for many years, but lately I have been using another OS to increase my vision and experience. But the issue is, PowerShell is a Windows OS based, and usually is not available on Non-Windows OS (as far as I know). So, I need to evolve to another command line tool. The natural progression is Azure CLI. Ok, you probably get the picture, but what is Azure CLI? How Azure CLI can help us managing Azure from a Non-Windows OS devices?

The Azure CLI provides a command-line, shell-based interface that you can use to interact with your Azure subscriptions. Although for the most part, the Azure CLI offers the same set of features as the Azure PowerShell modules, two primary differences exist between them:

  • You can install and run the Azure CLI not only on the Windows operating system but also on Linux and OS X.
  • Because of its ability to run on Linux, it is straightforward to integrate the Azure CLI with several traditional shell-scripting tools, such as grep, awk, sed, xargs, and cut, thereby allowing Linux admins to use their existing skills.

The installation process for the Azure CLI depends on the target operating system; however, the installers for all the supported operating systems are available directly from the Azure Downloads page (see here). Like the Azure PowerShell modules, the Azure CLI for the Windows operating system relies on Web PI. On the Linux and OS X operating systems, you can perform the installation by using an npm package.

On the Windows operating system, the installation modifies the path system environment variable. Effectively, after you launch a command prompt window, you can automatically run any of the Azure CLI commands.

Note: All commands start with the word azure. To learn more about the Azure CLI syntax, run the following command from the Windows command prompt:
azure help

After you install the Azure CLI, you can connect to the Azure subscriptions that you want to manage. Like the Azure PowerShell modules, to establish such a connection, you first need to authenticate by using either a Microsoft account or a work or school account that exists in the Azure AD tenant associated with the target subscription.

To initiate the authentication process, run the following command from the command prompt:
azure login

A message displays, prompting you to start a browser and browse to the Device Login page, where you need to  enter the code provided in the same message. This step verifies the Azure CLI as the application publisher and allows you to type your user credentials to authenticate to the Azure subscription.

Azure AD authentication is token-based, and after signing in, the user remains authenticated until the authentication token expires. The expiration time for an Azure AD token is 12 hours.

After you authenticate, you can use the azure account list command to view a list of subscriptions associated with your account. If you have multiple subscriptions, you can specify the one you want to manage by using the azure account set command and providing either the subscription name or its ID.

Note: You can identify the subscription name and ID by reviewing the output of the azure account list command.

Unlike the Azure PowerShell modules, the Azure CLI uses separate modes for working with the Azure Resource Manager deployment model and the Service Management deployment model. Both modes use the same set of commands, and to switch between them, you can use the azure config mode command.

To switch to the Azure Resource Manager mode, run the following command:
azure config mode arm

To switch to the classic deployment mode, run the following command:
azure config mode asm

At this point, you can also use Azure PowerShell cmdlets to view, provision, and manage Azure services and resources.