Introduction to Azure Stack Hub VMs
Azure Stack Hub offers virtual machines (VMs) as a type of on-demand and scalable computing resource. You can choose a VM when you need more control over the computing environment. This article provides details about creating your first VM.
An Azure Stack Hub VM gives you the flexibility of virtualization without the need to manage clusters or individual machines. However, you still need to maintain the VM by doing tasks such as configuring, patching/updating, and installing the software that runs on it.
You can use Azure Stack Hub VMs in several ways. For example:
Development and test: Azure Stack Hub VMs enable you to create a computer with a specific configuration required to code and test an application.
Applications in the cloud: Because demand for your application can fluctuate, it might make economic sense to run it on a VM in Azure Stack Hub. You pay for extra VMs when you need them and shut them down when you don't.
Extended datacenter: VMs in an Azure Stack Hub virtual network can be connected to your organization's network, or to Azure.
The VMs that your application uses can scale up, or scale out, to whatever is required to meet your needs.
Before creating a VM
There are always design considerations when you build out an application infrastructure in Azure Stack Hub. These aspects of a VM are important to think about before you start creating your infrastructure:
- The names of your application resources.
- The size of the VM.
- The maximum number of VMs that can be created.
- The operating system that the VM runs.
- The configuration of the VM after it starts.
- The related resources that the VM needs.
A VM has a name assigned to it and it has a computer name configured as part of the operating system. The name of a VM can be up to 15 characters.
If you use Azure Stack Hub to create the operating system disk, the computer name and the VM name are the same. If you upload and use your own image that contains a previously configured operating system and use it to create a VM, the names may be different. When you upload your own image file, as a best practice make sure the computer name in the operating system matches the VM name.
The size of the VM that you use is determined by the workload that you want to run. The size that you choose then determines factors such as processing power, memory, and storage capacity. Azure Stack Hub offers different kinds of sizes to support many types of uses.
Your subscription has default quota limits in place that can impact the deployment of VMs for your project. The current limit on a per subscription basis is 20 VMs per region.
Operating system disks and images
VMs in Azure Stack Hub are limited to the generation 1 virtual hard disk (VHD/VHDX) format. VHDs can be used to store the machine operating system (OS) and data. VHDs are also used for the images you use to install an OS. Azure Stack Hub provides a marketplace to use with various versions and types of operating systems. Marketplace images are identified by image publisher, offer, SKU, and version (typically the latest version is specified as latest).
The following table shows how to find the information for an image:
|Azure Stack Hub portal||The values are automatically specified for you when you select an image to use.|
|Azure Stack Hub PowerShell||
|REST APIs||List image publishers
List image offers
List image SKUs
You can choose to upload and use your own image. If you do, the publisher name, offer, and SKU aren't used.
VM extensions give your VM additional capabilities through post-deployment configuration and automated tasks. You can accomplish these common tasks using extensions:
Run custom scripts: The Custom Script extension helps you to configure workloads on the VM by running your script when the VM is provisioned.
Deploy and manage configurations: The PowerShell Desired State Configuration (DSC) extension helps you set up DSC on a VM to manage configurations and environments.
Collect diagnostics data: The Azure Diagnostics extension helps you configure the VM to collect diagnostics data that can be used to monitor the health of your application.
The resources in the following table are used by the VM and need to exist or be created when the VM is created:
|Resource group||Yes||The VM must be contained in a resource group.|
|Storage account||No||The VM doesn't need the storage account to store its virtual hard disks if using managed disks.|
|Virtual network||Yes||The VM must be a member of a virtual network.|
|Public IP address||No||The VM can have a public IP address assigned to it to remotely access it.|
|Network interface||Yes||The VM needs the network interface to communicate in the network.|
|Data disks||No||The VM can include data disks to expand storage capabilities.|
Create your first VM
There are several ways to create a VM. Your choice depends on your environment. The following table provides information to help get you started creating your VM:
|Azure Stack Hub portal||Create a Windows VM with the Azure Stack Hub portal.
Create a Linux VM using the Azure Stack Hub portal.
|Templates||Azure Stack Hub Quickstart templates are located at:
|PowerShell||Create a Windows VM by using PowerShell in Azure Stack Hub
Create a Linux VM by using PowerShell in Azure Stack Hub
|CLI||Create a Windows VM by using CLI in Azure Stack Hub
Create a Linux VM by using CLI in Azure Stack Hub
Manage your VM
You can manage VMs using a browser-based portal, command-line tools with support for scripting, or directly through APIs. Some typical management tasks are:
- Getting information about a VM.
- Connecting to a VM.
- Managing availability.
- Making backups.
Get information about your VM
The following table shows some of the ways you can get information about a VM:
|Azure Stack Hub portal||On the hub menu, click Virtual Machines and then select the VM from the list. On the page for the VM, you have access to overview information, setting values, and monitoring metrics.|
|Azure PowerShell||Managing VMs is similar in Azure and Azure Stack Hub. For more information about using PowerShell, see the Azure topic Create and Manage Windows VMs with the Azure PowerShell module.|
|Client SDKs||Using C# to manage VMs is similar in Azure and Azure Stack Hub. For more information, see Create and manage Windows VMs in Azure using C#.|
Connect to your VM
You can use the Connect option in the Azure Stack Hub portal to connect to your VM.