Skip to content

Commit b97a644

Browse files
authored
Merge pull request #16423 from ronmiab/rb-kyle-terraform
Added Terraform template tab and content per PM request
2 parents 3be6ed6 + 3102b3d commit b97a644

File tree

4 files changed

+85
-17
lines changed

4 files changed

+85
-17
lines changed

azure-local/manage/create-arc-virtual-machines.md

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.date: 11/05/2024
1414

1515
[!INCLUDE [hci-applies-to-23h2](../includes/hci-applies-to-23h2.md)]
1616

17-
This article describes how to create an Arc VM starting with the VM images that you've created on your Azure Local instance. You can create Arc VMs using the Azure CLI, Azure portal, or Azure Resource Manager template.
17+
This article describes how to create an Arc virtual machine (VM) starting with the VM images that you created on your Azure Local instance. You can create Arc VMs using the Azure CLI, Azure portal, or Azure Resource Manager template.
1818

1919
## About Azure Local resource
2020

@@ -36,7 +36,7 @@ Before you create an Azure Arc-enabled VM, make sure that the following prerequi
3636

3737
- If using a client to connect to your Azure Local, see [Connect to Azure Local via Azure CLI client](./azure-arc-vm-management-prerequisites.md#azure-command-line-interface-cli-requirements).
3838

39-
- Access to a network interface that you have created on a logical network associated with your Azure Local. You can choose a network interface with static IP or one with a dynamic IP allocation. For more information, see how to [Create network interfaces](./create-network-interfaces.md).
39+
- Access to a network interface that you created on a logical network associated with your Azure Local. You can choose a network interface with static IP or one with a dynamic IP allocation. For more information, see how to [Create network interfaces](./create-network-interfaces.md).
4040

4141
# [Azure portal](#tab/azureportal)
4242

@@ -56,6 +56,26 @@ Before you create an Azure Arc-enabled VM, make sure that the following prerequi
5656
- Access to a logical network that you associate with the VM on your Azure Local. For more information, see how to [Create logical network](./create-logical-networks.md).
5757
- [Download the sample Bicep template](https://aka.ms/hci-vmbiceptemplate)
5858

59+
# [Terraform template](#tab/terraformtemplate)
60+
61+
[!INCLUDE[hci-vm-prerequisites](../includes/hci-vm-prerequisites.md)]
62+
63+
- Access to a logical network that you associate with the VM of your Azure Local. For more information, see [Create logical networks](../manage/create-logical-networks.md).
64+
- Make sure Terraform is installed and up to date on your machine.
65+
- To verify your Terraform version, run the `terraform -v` command.
66+
67+
Here's an example of sample output:
68+
```output
69+
PS C:\Users\username\terraform-azurenn-avm-res-azurestackhci-virtualmachineinstance> terraform -v
70+
Terraform vi.9.8 on windows_amd64
71+
+ provider registry.terraform.io/azure/azapi vl.15.0
72+
+ provider registry.terraform.io/azure/modtm V0.3.2
73+
+ provider registry.terraform.io/hashicorp/azurerm v3.116.0
74+
+ provider registry.terraform.io/hashicorp/random V3.6.3
75+
```
76+
- Make sure Git is installed and up to date on your machine.
77+
- To verify your version of Git, run the `git --version` command.
78+
5979
---
6080
6181
## Create Arc VMs
@@ -72,7 +92,7 @@ Follow these steps on the client running az CLI that is connected to your Azure
7292
7393
### Create a Windows VM
7494
75-
Depending on the type of the network interface that you created, you can create a VM that has network interface with static IP or one with a dynamic IP allocation.
95+
Depending on the type of the network interface that you created, you can create a VM that has network interface with static IP or one with a dynamic IP allocation.
7696
7797
> [!NOTE]
7898
> If you need more than one network interface with static IPs for your VM, create the interface(s) now before you create the VM. Adding a network interface with static IP, after the VM is provisioned, is not supported.
@@ -122,9 +142,6 @@ Here we create a VM that uses specific memory and processor counts on a specifie
122142
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" --storage-path-id $storagePathId
123143
```
124144

125-
126-
127-
128145
The VM is successfully created when the `provisioningState` shows as `succeeded`in the output.
129146

130147
> [!NOTE]
@@ -134,7 +151,7 @@ In this example, the storage path was specified using the `--storage-path-id` fl
134151

135152
If the flag isn't specified, the workload (VM, VM image, non-OS data disk) is automatically placed in a high availability storage path.
136153

137-
### Create a Linux VM
154+
### Create a Linux VM
138155

139156
To create a Linux VM, use the same command that you used to create the Windows VM.
140157

@@ -170,12 +187,12 @@ You can input the following parameters for `proxy-server-configuration`:
170187
<!--| **proxyServerUsername** |Username for proxy authentication. The username and password are combined in this URL format: `http://username:[email protected]:3128`. An example is: `GusPinto`|
171188
| **proxyServerPassword** |Password for proxy authentication. The username and password are combined in a URL format similar to the following: `http://username:[email protected]:3128`. An example is: `UseAStrongerPassword!` |-->
172189

173-
174190
Here's a sample command:
175191

176192
```azurecli
177193
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" --storage-path-id $storagePathId --proxy-configuration http_proxy="http://ubuntu:[email protected]:3128" https_proxy="http://ubuntu:[email protected]: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"
178194
```
195+
179196
For proxy authentication, you can pass the username and password combined in a URL as follows:`"http://username:[email protected]:3128"`.
180197

181198
<!--Depending on the PowerShell version you're running on your VM, you may need to enable the proxy settings for your VM.
@@ -264,7 +281,6 @@ Follow these steps in Azure portal for your Azure Local.
264281
> [!NOTE]
265282
> For proxy authentication, you can pass the username and password combined in a URL as follows: `http://username:[email protected]:3128`.
266283
267-
268284
1. Set the local VM administrator account credentials used when connecting to your VM via RDP. In the **Administrator account** section, input the following parameters:
269285

270286
:::image type="content" source="./media/create-arc-virtual-machines/create-virtual-machines-administrator-account-domain-join.png" alt-text="Screenshot of guest management enabled inVM extensions on Basics tab." lightbox="./media/create-arc-virtual-machines/create-virtual-machines-administrator-account-domain-join.png":::
@@ -323,7 +339,6 @@ Follow these steps in Azure portal for your Azure Local.
323339

324340
1. Select **Create**. It should take a few minutes to provision the VM.
325341

326-
327342
# [Azure Resource Manager template](#tab/armtemplate)
328343

329344
Follow these steps to deploy the Resource Manager template:
@@ -608,7 +623,7 @@ Follow these steps to deploy the Resource Manager template:
608623
}
609624
]
610625
}
611-
```
626+
```
612627

613628
1. Select **Save**.
614629

@@ -634,11 +649,28 @@ Follow these steps to deploy the Resource Manager template:
634649

635650
:::code language="bicep" source="~/../quickstart-templates/quickstarts/microsoft.azurestackhci/vm-windows-disks-and-adjoin/main.bicep":::
636651

652+
# [Terraform template](#tab/terraformtemplate)
653+
654+
You can use the Azure Verified Module (AVM) that contains the Terraform template for creating Virtual Machines. This module ensures your Terraform templates meet Microsoft's rigorous standards for quality, security, and operational excellence, enabling you to seamlessly deploy and manage on Azure. With this template, you can create one or multiple Virtual Machines on your cluster.
655+
656+
### Steps to use the Terraform template
657+
658+
1. Download the Terraform template from [Azure verified module](https://registry.terraform.io/modules/Azure/avm-res-azurestackhci-virtualmachineinstance/azurerm/0.1.2).
659+
2. Navigate to the **examples** folder in the repository, and look for the following subfolders:
660+
- **default**: Creates one virtual machine instance.
661+
- **multi**: Creates multiple virtual machine instances.
662+
3. Choose the appropriate folder for your deployment.
663+
4. To initialize Terraform in your folder from step 2, run the `terraform init` command.
664+
5. To apply the configuration that deploys virtual machines, run the `terraform apply` command.
665+
6. After the deployment is complete, verify your virtual machines via the Azure portal. Navigate to **Resources** > **Virtual machines**.
666+
667+
:::image type="content" source="./media/create-arc-virtual-machines/terraform-virtual-machines.png" alt-text="Screenshot of select Virtual Machine after deployment." lightbox="./media/create-arc-virtual-machines/terraform-virtual-machines.png":::
668+
637669
---
638670

639671
## Use managed identity to authenticate Arc VMs
640672

641-
When the Arc 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 Arc VMs.
673+
When the Arc 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 Arc VMs.
642674

643675
The Arc 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 Arc VMs can use a system-assigned managed identity to access the Azure Key Vault.
644676

azure-local/manage/create-logical-networks.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Create logical networks for Azure Local
3-
description: Learn how to create logical networks on Azure Local. The Arc VM running on your system used this logical network.
3+
description: Learn how to create logical networks on Azure Local. The Arc virtual machine (VM) running on your system used this logical network.
44
author: alkohli
55
ms.author: alkohli
66
ms.topic: how-to
@@ -24,7 +24,7 @@ Before you begin, make sure to complete the following prerequisites:
2424

2525
- Make sure to review and [complete the prerequisites](./azure-arc-vm-management-prerequisites.md). If using a client to connect to your Azure Local, see [Connect to the system remotely](./azure-arc-vm-management-prerequisites.md#connect-to-the-system-remotely).
2626

27-
- Make sure you have an external VM switch that can be accessed by all the machines in your Azure Local. By default, an external switch is created during the deployment of your Azure Local that you can use to associate with the logical network you will create.
27+
- Make sure that all the machines in your Azure Local can access and external virtual machine (VM) switch. By default, an external switch is created during the deployment of your Azure Local that you can use to associate with the logical network you create.
2828

2929
Run the following command to get the name of the external VM switch on your system.
3030

@@ -48,8 +48,27 @@ Before you begin, make sure to complete the following prerequisites:
4848

4949
The prerequisites for the Azure portal are the same as those for the Azure CLI. See [Azure CLI](./create-logical-networks.md?tabs=azurecli#tabpanel_1_azurecli).
5050

51+
# [Terraform template](#tab/terraformtemplate)
52+
53+
- Make sure Terraform is installed and up to date on your machine.
54+
- To verify your version of Terraform, run the `terraform -v` command.
55+
56+
Here's an example of sample output:
57+
```output
58+
PS C:\Users\username\terraform-azurenn-avm-res-azurestackhci-virtualmachineinstance> terraform -v
59+
Terraform vi.9.8 on windows_amd64
60+
+ provider registry.terraform.io/azure/azapi vl.15.0
61+
+ provider registry.terraform.io/azure/modtm V0.3.2
62+
+ provider registry.terraform.io/hashicorp/azurerm v3.116.0
63+
+ provider registry.terraform.io/hashicorp/random V3.6.3
64+
```
65+
66+
- Make sure Git is installed and up to date on your machine.
67+
- To verify your version of Git, run the `git --version` command.
68+
5169
---
5270
71+
5372
## Create the logical network
5473
5574
You can create a logical network using either the Azure Command-Line Interface (CLI) or by using the Azure portal.
@@ -72,7 +91,6 @@ In this release, you can create virtual machines using a static IP only via the
7291
7392
Create a static logical network when you want to create virtual machines with network interfaces on these logical networks. Follow these steps in Azure CLI to configure a static logical network:
7493
75-
7694
1. Set the parameters. Here's an example:
7795
7896
```azurecli
@@ -334,16 +352,34 @@ These steps are the same for both static and DHCP network deployments.
334352
335353
:::image type="content" source="./media/create-logical-networks/deployment-in-progress.png" alt-text="Screenshot indicating that the deployment job is in progress." lightbox="./media/create-logical-networks/deployment-in-progress.png":::
336354
337-
1. Verify the deployment job has successfully completed and then select either **Pin to dashboard** or **Go to resource group**:
355+
1. Verify the deployment job completed successfully and then select either **Pin to dashboard** or **Go to resource group**:
338356
339357
:::image type="content" source="./media/create-logical-networks/deployment-succeeded.png" alt-text="Screenshot of successful completion of the deployment job." lightbox="./media/create-logical-networks/deployment-succeeded.png":::
340358
341359
1. In the resource group, select **Overview** and then verify the logical network is created and listed on the **Resources** tab:
342360
343361
:::image type="content" source="./media/create-logical-networks/verify-network-created.png" alt-text="Screenshot of the newly created logical network." lightbox="./media/create-logical-networks/verify-network-created.png":::
344362
345-
---
363+
# [Terraform template](#tab/terraformtemplate)
364+
365+
You can use the Azure Verified Module (AVM) that contains the Terraform template for creating Logical Networks. This module ensures your Terraform templates meet Microsoft's rigorous standards for quality, security, and operational excellence, enabling you to seamlessly deploy and manage on Azure. With this template, you can create one or multiple Logical Networks on your cluster.
366+
367+
### Steps to use the Terraform template
346368
369+
1. Download the Terraform template from [Azure verified module](https://registry.terraform.io/modules/Azure/avm-res-azurestackhci-logicalnetwork/azurerm/0.4.0).
370+
2. Navigate to the **examples** folder in the repository, and look for the following subfolders:
371+
- **default**: Creates one logical network with a static IP configuration.
372+
- **static**: Creates one logical network with a static IP configuration.
373+
- **dhcp**: Creates one logical network with a dynamic IP configuration.
374+
- **multi**: Creates multiple logical network instances.
375+
3. Choose the appropriate folder for your deployment.
376+
4. To initialize Terraform in your folder from step 2, run the `terraform init` command.
377+
5. To apply the configuration that deploys logical networks, run the `terraform apply` command.
378+
6. After the deployment is complete, verify your logical networks via the Azure portal. Navigate to **Resources** > **Logical networks**.
379+
380+
:::image type="content" source="./media/create-logical-networks/terraform-logical-networks.png" alt-text="Screenshot of select Logical networks after deployment." lightbox="./media/create-logical-networks/terraform-logical-networks.png":::
381+
382+
---
347383
348384
## Next steps
349385
114 KB
Loading
82.7 KB
Loading

0 commit comments

Comments
 (0)