Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Multi-rack deployments of Azure Local 2511 and later
This article describes how to create Azure Local virtual machines (VMs) enabled by Azure Arc, using the VM images that you created on multi-rack deployments of Azure Local. You can create Azure Local VMs using the Azure CLI, Azure portal, or Azure Resource Manager (ARM) template.
Note
Arc gateway isn't supported on Azure Local VMs.
Important
This feature is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
Prerequisites
Before you create an Azure Local VM, make sure that the following prerequisites are complete:
- Access to an Azure subscription with the appropriate RBAC role and permissions assigned. For more information, see RBAC roles for Azure Local VM management.
- Access to a resource group where you want to provision the VM.
- Access to one or more VM images on your Azure Local. These VM images could be created using VM image starting from an image in Azure Storage account.
Note
If you’re deploying a Windows VM, make sure that the appropriate VirtIO drivers are present in the image.
- A custom location for your Azure Local instance that you'll use to provision VMs. The custom location will also show up in the Overview page for Azure Local.
- If using a client to connect to your Azure Local, see Connect to Azure Local via Azure CLI client.
- Access to a network interface that you created on a logical network or virtual network subnet associated with Azure Local. You can choose a network interface with static IP allocation. For more information, see how to Create network interfaces.
- Details of your proxy server to provide during VM creation. Azure Local VMs wouldn't have external connectivity to enable guest management without proxy details configured at the time of creation.
Create Azure Local VMs
Follow these steps to create a VM on Azure Local.
Follow these steps on the client running az CLI that is connected to Azure Local.
Sign in and set subscription
Sign in. Type:
az login --use-device-codeSet your subscription.
az account set --subscription <Subscription ID>
Create a Windows VM
Note
If you need more than one network interface for your VM, create one or more interfaces now before you create the VM. Adding a network interface after the VM is provisioned isn't supported in the preview version.
Here we create a VM that uses specific memory and processor counts.
Set some parameters.
$vmName ="local-vm" $subscription = "<Subscription ID>" $resource_group = "local-rg" $customLocationName = "local-cl" $customLocationID ="/subscriptions/$subscription/resourceGroups/$resource_group/providers/Microsoft.ExtendedLocation/customLocations/$customLocationName" $location = "eastus" $computerName = "mycomputer" $userName = "local-user" $password = "<Password for the VM>" $imageName = "/subscriptions/$subscription/resourceGroups/$resource_group/providers/Microsoft.AzureStackHCI/galleryImages/ws22server" $nicName ="local-vnic" $httpProxy = "<Proxy server address>" $httpsProxy = "<Proxy server address>"The parameters for VM creation are tabulated as follows:
Parameters Description name Name for the VM that you create for Azure Local. Make sure to provide a name that follows the Rules for Azure resources. admin-username Username for the user on the VM you're deploying on Azure Local. admin-password Password for the user on the VM you're deploying on Azure Local. image-name ARM resource ID of the VM image used for provisioning. The VM image may reside in a different subscription and resource group than the target VM. location Azure regions as specified by az locations. For example, this could beeastus,westeurope.resource-group Name of the resource group where you create the VM. For ease of management, we recommend that you use the same resource group as Azure Local. subscription Name or ID of the subscription where your Azure Local is deployed. This could be another subscription you use for VM on Azure Local. custom-location Use this to provide the custom location associated with Azure Local where you're creating this VM. authentication-type Type of authentication to use with the VM. The accepted values are all,password, andssh. Default is password for Windows and SSH public key for Linux. Useallto enable bothsshandpasswordauthentication.nics Names or the IDs of the network interfaces associated with your VM. You must have atleast one network interface when you create a VM, to enable guest management. memory-mb Memory in Megabytes allocated to your VM. If not specified, defaults are used. processors The number of processors allocated to your VM. If not specified, defaults are used. proxy-configuration Use this parameter to configure a proxy server for your VM. It is required to enable guest management on your VM. For more information, see Create a VM with proxy configured. zone (Optional) Name of the availability zone (rack) where you want the VM to be placed. strict-placement (Optional) Choose strict placement if you have specified a zone and want the VM to only be scheduled on the specified availability zone. If the specified zone doesn’t have capacity or is unavailable, VM creation will fail. If you specify no for this parameter, the VM will be scheduled on the specified zone on a best-effort basis. Run the following commands to create the applicable VM.
To create a standard Azure Local VM for multi-rack deployments:
az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --zone $zone –-strict-placement true --enable-agent true --enable-vm-config-agent true --proxy-configuration http_proxy=$httpProxy https_proxy=$httpsProxy no_proxy="" cert_file_path=""
The VM is successfully created when the provisioningState shows as succeededin the output.
Note
The VM created has guest management enabled by default. It is required to provide HTTP proxy to enable guest management properly.
Create a Linux VM
To create a Linux VM, use the same command that you used to create the Windows VM.
- The gallery image specified should be a Linux image.
- For Linux VMs, we recommend using SSH keys. For SSH keys, you need to pass the
ssh-key-valuesparameters along withauthentication-type ssh. If you are using an existing key, ensure that the public key is in OpenSSH format. - If you want to use username and password, use the
authentication-type passwordparameter.
Important
The VM created has guest management enabled by default. It is required to provide HTTP proxy to enable guest management properly.
Create a VM with proxy configured
Use this parameter proxy-configuration to configure a proxy server for your VM.
Proxy configuration for VMs is applied only to the onboarding of the Azure connected machine agent and set as environment variables within the guest VM operating system. Browsers and applications on the VM aren't necessarily all enabled with this proxy configuration.
As such, you may need to specifically set the proxy configuration for your applications if they don't reference the environment variables set within the VM.
If creating a VM behind a proxy server, run the following command:
az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --zone $zone –-strict-placement true --enable-agent true --enable-vm-config-agent true --proxy-configuration http_proxy="<Http URL of proxy server>" https_proxy="<Https URL of proxy server>" no_proxy="<URLs which bypass proxy>" cert_file_path="<Certificate file path for your machine>"
You can input the following parameters for proxy-server-configuration:
| Parameters | Description |
|---|---|
| http_proxy | HTTP URLs for proxy server. An example URL is:http://proxy.example.com:3128. |
| https_proxy | HTTPS URLs for proxy server. The server may still use an HTTP address as shown in this example: http://proxy.example.com:3128. |
| no_proxy | URLs, which can bypass proxy. Typical examples would be localhost,127.0.0.1,.svc,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,100.0.0.0/8. |
| cert_file_path | Select the certificate file used to establish trust with your proxy server. An example is: C:\Users\Palomino\proxycert.crt. |
Here's a sample command:
az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --proxy-configuration http_proxy="http://ubuntu:ubuntu@192.168.200.200:3128" https_proxy="http://ubuntu:ubuntu@192.168.200.200:3128" no_proxy="localhost,127.0.0.1,.svc,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,100.0.0.0/8,s-cluster.test.contoso.com" cert_file_path="C:\ClusterStorage\UserStorage_1\server.crt"
For proxy authentication, you can pass the username and password combined in a URL as follows:"http://username:password@proxyserver.contoso.com:3128".
Note
- Two DVD drives are created and used in Azure Local VMs during VM provisioning. The ISO files used during provisioning are removed after successfully creating the VM. However, you might see the empty drives visible for the VM.
- To delete these drives in a Windows VM, use Device Manager to uninstall the drives. Depending on the flavor of Linux you are using, you can also delete them for Linux VMs.
Use managed identity to authenticate Azure Local VMs
When the VMs are created on your Azure Local via Azure CLI or Azure portal, a system-assigned managed identity is also created that lasts for the lifetime of the VMs.
The VMs on Azure Local are extended from Arc-enabled servers and can use system-assigned managed identity to access other Azure resources that support Microsoft Entra ID-based authentication. For example, the VMs can use a system-assigned managed identity to access the Azure Key Vault.
For more information, see system-assigned managed identities and Authenticate against Azure resource with Azure Arc-enabled servers.
Next steps
- Learn how to Manage Azure Local VMs.