Skip to content

Commit eab501f

Browse files
Merge pull request #252357 from samyaktelsang-msft/add_vmss_custom_image
Add how to deploy a vmss instance from a hardened linux image
2 parents be75cfd + ec0d522 commit eab501f

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

articles/confidential-computing/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@
146146
href: harden-the-linux-image-to-remove-sudo-users.md
147147
- name: Harden a Linux image to remove Azure guest agent
148148
href: harden-a-linux-image-to-remove-azure-guest-agent.md
149+
- name: Deploy a virtual machine scale set using hardened image
150+
href: vmss-deployment-from-hardened-linux-image.md
149151
- name: Secure Key Release (SKR) with Azure Key Vault
150152
items:
151153
- name: SKR with Azure Confidential Computing Concept

articles/confidential-computing/index.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ landingContent:
9898
url: harden-the-linux-image-to-remove-sudo-users.md
9999
- text: Harden a Linux image to remove azure guest agent
100100
url: harden-a-linux-image-to-remove-azure-guest-agent.md
101+
- text: Deploy a virtual machine scale set using hardened image
102+
url: vmss-deployment-from-hardened-linux-image.md
101103
- linkListType: reference
102104
links:
103105
- text: AMD confidential VMs FAQ
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: Deploy a virtual machine scale set using a hardened Linux image
3+
description: Learn how to use vmss to deploy a scale set using the hardened linux image.
4+
author: samyaktelsang-msft
5+
ms.service: virtual-machines
6+
mms.subservice: confidential-computing
7+
ms.topic: how-to
8+
ms.workload: infrastructure
9+
ms.date: 9/12/2023
10+
ms.author: satelsan
11+
ms.custom: devx-track-azurecli
12+
---
13+
14+
# Deploy a virtual machine scale set using a hardened Linux image
15+
16+
**Applies to:** :heavy_check_mark: Hardened Linux Images
17+
18+
Virtual machine scale set deployments using images from Azure marketplace can be done following the steps described for standard [VMSS deployments](/azure/virtual-machine-scale-sets/flexible-virtual-machine-scale-sets-cli).
19+
20+
However, if you have chosen to create a hardened linux image by removing the Azure guest agents, it's crucial to comprehend what functionalities the VM loses before you decide to remove the Azure Linux Agent, and how it affects vmss deployment.
21+
22+
This "how to" document describes the steps to deploy a virtual machine scale set instance while comprehending the functional limitations of the hardened image on deploying the vmss instance.
23+
## Prerequisites
24+
25+
- Azure subscription - If you don't have an Azure subscription, [create a free Azure account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
26+
- If your free trial accounts don't have access to the VMs used in this tutorial, one option is to use a [pay as you go subscription](https://azure.microsoft.com/pricing/purchase-options/pay-as-you-go/).
27+
- A hardened linux image - you can create one from this [article](harden-a-linux-image-to-remove-azure-guest-agent.md).
28+
29+
### VMSS confidential VM deployment from a hardened Linux image
30+
31+
Steps to deploy a scale set using VMSS and a hardened image are as follows:
32+
33+
1. Follow the steps to harden a Linux image.
34+
35+
[Harden a Linux image to remove Azure guest agent](harden-a-linux-image-to-remove-azure-guest-agent.md).
36+
37+
[Harden a Linux image to remove sudo users](harden-the-linux-image-to-remove-sudo-users.md).
38+
39+
2. Log in to the Azure CLI.
40+
41+
Make sure that you've installed the latest [Azure CLI](/cli/azure/install-azure-cli) and are logged in to an Azure account with [az login](/cli/azure/reference-index).
42+
43+
3. Launch Azure Cloud Shell.
44+
45+
The [Azure Cloud Shell](https://shell.azure.com/cli) is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
46+
47+
To open the Cloud Shell, just select Try it from the upper right corner of a code block. You can also open Cloud Shell in a separate browser tab by going to https://shell.azure.com/bash. Select Copy to copy the blocks of code, paste it into the Cloud Shell, and select Enter to run it.
48+
49+
If you prefer to install and use the CLI locally, this quickstart requires Azure CLI version 2.0.30 or later. Run az--version to find the version. If you need to install or upgrade, see Install Azure CLI.
50+
51+
4. Create a resource group.
52+
53+
Create a resource group with the [az group create](/cli/azure/group) command. An Azure resource group is a logical container into which Azure resources are deployed and managed. The following example creates a resource group named myResourceGroup in the eastus location:
54+
55+
56+
```Azure CLI
57+
az group create --name myResourceGroup --location eastus
58+
```
59+
60+
> [!NOTE]
61+
> Confidential VMs are not available in all locations. For currently supported locations, see which [VM products are available by Azure region](https://azure.microsoft.com/global-infrastructure/services/?products=virtual-machines).
62+
63+
5. Create a Virtual Machine Scale Set.
64+
65+
Now create a Virtual Machine Scale Set with az vmss create az cli. The following example creates a scale set called myScaleSet with an instance count of 2.
66+
67+
If you are looking to set an admin username, ensure that it isn't part of the [reserved words](/rest/api/compute/virtualmachines/createorupdate#osprofile) list for vmss.
68+
In this case, the username is auto set to azureuser.
69+
For the admin credentials, you will be able to use the credentials that you set from the hardened image while you create the vm.
70+
71+
> [!NOTE]
72+
> For specalized images, [osprofile properties](/azure/virtual-machines/shared-image-galleries) are handled differently than generalized images.
73+
> Using a [load balancer](/azure/load-balancer/load-balancer-overview) is optional but is encouraged for these reasons.
74+
75+
```azurecli-interactive
76+
az vmss create \
77+
--resource-group myResourceGroup \
78+
--name myScaleSet \
79+
--vm-sku "Standard_DC4as_v5" \
80+
--security-type ConfidentialVM \
81+
--os-disk-security-encryption-type DiskwithVMGuestState \
82+
--os-disk-secure-vm-disk-encryption-set "/subscriptions/.../disk-encryption-sets/<des-name>" \
83+
--image "/subscriptions/.../images/<imageName>/versions/<version>" \
84+
--enable-vtpm true \
85+
--enable-secure-boot true \
86+
--vnet-name <virtual-network-name> \
87+
--subnet <subnet-name> \
88+
--lb "/subscriptions/.../loadBalancers/<lb-name>" \
89+
--specialized true \
90+
--instance-count 2 \
91+
--admin-username "azureuser" \
92+
--admin-password ""
93+
```
94+
95+
6. Access the virtual machine scale set from the portal.
96+
97+
You can access your cvm scale set and use the admin username and password set previously to log in. Please note that if you choose to update the admin credentials, do so directly in the scale set model using the cli.
98+
99+
> [!NOTE]
100+
> If you are looking to deploy cvm scaled scale using the custom hardened image, please note that some features related to auto scaling will be restricted. Will manual scaling rules continue to work as expected, the autoscaling ability will be limited due to the agentless custom image. More details on the restrictions can be found here for the [provisioning agent](/azure/virtual-machines/linux/disable-provisioning). Alternatively, you can navigate to the metrics tab on the azure portal and confirm the same.
101+
> However, you can continue to set up custom rules based on load balancer metrics such as SYN count, SNAT connection count, etc.
102+
103+
## Next Steps
104+
105+
In this article, you learned how to deploy a virtual machine scale set instance with a hardened linux image. For more information about CVM, see [DCasv5 and ECasv5 series confidential VMs](confidential-vm-overview.md).

0 commit comments

Comments
 (0)