Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
38 views
10 pages
Azure Win VM Terraform LAB
Uploaded by
Sanskar
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save azure-Win-VM-terraform-LAB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
38 views
10 pages
Azure Win VM Terraform LAB
Uploaded by
Sanskar
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save azure-Win-VM-terraform-LAB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 10
Search
Fullscreen
‘2124, 344 PM (Quickstart Use Teraform to create @ Windows VM - Azure Virtual Machines | Microsoft Leam Quickstart: Use Terraform to create a Windows VM Article + 07/21/2023 © Al-assisted content. This article was partially created with the help of Al. An author reviewed and revised the content as needed. Learn more Applies to: / Windows VMs This article shows you how to create a complete Windows environment and supporting resources with Terraform. Those resources include a virtual network, subnet, public IP address, and more. Terraform enables the definition, preview, and deployment of cloud infrastructure. Using Terraform, you create configuration files using HCL syntax. The HCL syntax allows you to specify the cloud provider - such as Azure - and the elements that make up your cloud infrastructure. After you create your configuration files, you create an execution plan that allows you to preview your infrastructure changes before they're deployed. Once you verify the changes, you apply the execution plan to deploy the infrastructure. In this article, you learn how to: Create a random value for the Azure resource group name using random_pet Create an Azure resource group using azurerm_resource_group Create a virtual network (VNET) using azurerm_virtual_network Create a subnet using azurerm_subnet Create a public IP using azurerm_public_ip Create a network security group using azurerm_network_security_ group Create a network interface using azurerm_network interface KSEE KEK Create an association between the network security group and the network interface using azurerm_network_interface_security_group_association Generate a random value for a unique storage account name using random _id Create a storage account for boot diagnostics using azurerm_storage_account Create a Windows VM with an IIS web server using 466 azurerm_windows_virtual_machine VY Create a Windows VM extension using azurerm_virtual_machine_extension Prerequisites ntips:leam microsoft comlen-usfazurevitual-machinesiwindowsiqulck-ceate-terratorm sno‘i204, 34 Pm ‘uickstat: Uso Terafom to croato a Windows VM- Azure Vitual Machines | Microsoft Leam ‘* Azure subscription: If you don’t have an Azure subscription, create a free account before you begin. ‘Install and configure Terraform Implement the Terraform code O Note The sample code for this article is located in the Azure Terraform GitHub repo. You can view the log file containing the test results from current and previous versions of Terraform See more articles and sample code showing how to use Terraform to manage Azure resources 1. Create a directory in which to test the sample Terraform code and make it the current directory. 2. Create a file named providers.t# and insert the following code: Terraform terraform { required_version required_providers { azurerm = { source "hashicorp/azurerm" version = "~>3.0" y random = { source = "hashicorp/random" version = "~>3.0" ? 3 y provider “azurerm™ { features {} } 3. Create a file named main.tf and insert the follo\ ntips:leam microsoft comlen-usfazurevitual-machinesiwindowsiqulck-ceate-terratorm 20‘uozi2a, 3:44 PM uicks Use Terratorm to era Windows VM- Azure Virtual Machines | Microsoft Learn Terraform resource “azurerm_resource_group" “rg” { location = var.resource_group_location name = "${randon_pet prefix. id}-re' # Create virtual network resource “azurerm_virtual_network" iny_terraform_network" { name "$({random_pet. prefix.id}-vnet™ address_space = ["10.0.0.0/16"] location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name ? # Create subnet resource “azurerm_subnet" "ny_terraform_subnet” { name $(random_pet .prefix.id}-subnet resource_group_name = azurerm_resource_group.rg.name virtual_network_name = azurerm_virtual_network.my_terraforn_network.name address_prefixes = ["10.0.1.0/24"] } # Create public IPs resource “azurerm_public_ip" “ny_terraform_public_ip" { name *${randon_pet..prefix.id}-public- ip location = azurerm_resource_group.rg-location resource_group_nane = azurerm_resource_group.rg-nane allocation_method = y # Create Network Security Group and rules resource “azurerm_network_security group” “my_terraform_nsg" { name "$(random_pet. prefix. id)-nsg' location = azurerm_resource_group.rg. location resource_group_name = azurerm_resource_group.rg.name security rule { name DF priority = 1000 direction "Inbound" access = "Allow" protocol =" source_port_range destination_port_range source_address_prefix destination_address_prefix + security_rule { name web" priority 1001 3380" hntps:ileam ierosof. conver-us/azurelirtualmachinesiwindowsiquickcreate-teraform 3it0122124, 344 PM ‘Quickstart Use Terraform to erat direction = access protocol source_port_range destination_port_range source_address_prefix destination_address_prefix Windows VM - Azure Virtual Machines | Microsoft Learn abound” # Create network interface resource “azurerm_network_interface" "ny terraform_ni name “$(random_pet.prefix.id}-nic location = azurerm_resource_group. rg. location Pesource_group_nane = azurerm_resource_group.rg.nane ip_configuration { subnet_id private_ip_address_allocation public_ip_address_id - azurerm_public_ip.my_terraform_public_ip.id 3 + iy_nic_configuratio azurerm_subnet.my_terraform_subnet.id “Dynamic” # Connect the security group to the network interface resource “azurerm_network_interface_security_group_association" t network_interface_id azurerm_network_interface.my_terraform_nic.id network_security_group_id azurerm_network_security_group.my_terraform_nsg.id y example" # Create storage account for boot diagnostics resource “azurerm_storage_account™ "ny_storage_account™ { name diags{random_id.randon_id.hex}" location azurerm_resource_group.rg.location resource group_nane = azurerm_resource_group.rg.nane account_tier = "Standard” account_replication_type = "LRS" # Create virtual machine resource “azurerm_windows_virtual_machine” name = "${var.prefix}-vm' admin_usernane = “azureuser" admin_password random_password.password.result location azurerm_resource_group.rg. location resource group_name = azurerm_resource_group.rg.name ntips:leam microsot.comlen-ustazurevitual-machinesiwindowsiqulck-create-terratorm 40‘uozi2a, 3:44 PM ‘Quickstart: Use Teraform to create a Windows VM - Azure Virtual Machines | Mierosoft Leam network_interface_ids = [azurerm_network_interface.my_terraform_nic.id] size "standard_pS1_v2" os_disk { name caching storage_account_type + source_image_reference { publisher = "MicrosoftWindowsServer” offer “WindowsServer” sku "2022-datacenter-azure-edition version = “latest” 3 boot_diagnostics { storage_account_uri azurerm_storage_account.my_storage_account.primary_blob_endpoint + } # Install IIS web server to the virtual machine resource “azurerm_virtual_machine_extension" "web_server_install” { name ‘$(randon_pet.pretix.id)-wsi virtual_machine_id = azurerm_windows_virtual_machine.main.id publisher Nicrosoft.Conpute” type ‘CustonScriptéxtension type_handler_version 1.8" auto_upgrade_minor_version = true settings = <
You might also like
Azure MS Docs PDF
PDF
No ratings yet
Azure MS Docs PDF
766 pages
Azure MS Docs PDF
PDF
No ratings yet
Azure MS Docs PDF
766 pages
70-412 Configuring Advanced Windows Server 2012 Servicesk
PDF
50% (2)
70-412 Configuring Advanced Windows Server 2012 Servicesk
524 pages
Azure DevOps RealTime Projects
PDF
No ratings yet
Azure DevOps RealTime Projects
63 pages
Azure Architecturing PDF
PDF
No ratings yet
Azure Architecturing PDF
113 pages
Ip Addressing and Subnetting
PDF
No ratings yet
Ip Addressing and Subnetting
38 pages
Building A Django Digital Clock App With CI - CD Using GitHub Actions and Deploying To AWS
PDF
No ratings yet
Building A Django Digital Clock App With CI - CD Using GitHub Actions and Deploying To AWS
12 pages
DOCKER
PDF
No ratings yet
DOCKER
94 pages
Windows Virtual Machines Overview - Azure - Microsoft Docs PDF
PDF
No ratings yet
Windows Virtual Machines Overview - Azure - Microsoft Docs PDF
1,071 pages
02 Active Directory - Domain Controller
PDF
No ratings yet
02 Active Directory - Domain Controller
113 pages
Implementing Virtual Machines
PDF
No ratings yet
Implementing Virtual Machines
26 pages
Aws Cloudformation
PDF
No ratings yet
Aws Cloudformation
12 pages
Top 40 Interview Questions On Azure 1721030940
PDF
No ratings yet
Top 40 Interview Questions On Azure 1721030940
6 pages
Getting Started Azure Powershell Bostonazuregroup
PDF
100% (1)
Getting Started Azure Powershell Bostonazuregroup
36 pages
AZ-104-microsoft Azure Administrator Syllabus
PDF
No ratings yet
AZ-104-microsoft Azure Administrator Syllabus
9 pages
Azure Fundamental
PDF
No ratings yet
Azure Fundamental
117 pages
WS-011 Windows Server 2019 Administration
PDF
No ratings yet
WS-011 Windows Server 2019 Administration
73 pages
Devops Notes Readthedocs Io en Latest
PDF
No ratings yet
Devops Notes Readthedocs Io en Latest
137 pages
Azure
PDF
No ratings yet
Azure
143 pages
AWS ClassBook Lesson02
PDF
100% (1)
AWS ClassBook Lesson02
26 pages
Azure Topics
PDF
No ratings yet
Azure Topics
108 pages
Terraform On Azure Cloud v9
PDF
No ratings yet
Terraform On Azure Cloud v9
369 pages
Devops Engineer: Master'S Program
PDF
No ratings yet
Devops Engineer: Master'S Program
26 pages
AZ-900 Study Guide
PDF
No ratings yet
AZ-900 Study Guide
3 pages
The Docker Handbook: by Anand Nevase
PDF
No ratings yet
The Docker Handbook: by Anand Nevase
57 pages
Advanced Admin-AOS v4 7
PDF
No ratings yet
Advanced Admin-AOS v4 7
63 pages
SRV Inst U
PDF
No ratings yet
SRV Inst U
402 pages
Microsoft Azure-Case Study Document
PDF
No ratings yet
Microsoft Azure-Case Study Document
8 pages
Implementing Microsoft Azure Infrastructure Solutions: Exam 70-533
PDF
No ratings yet
Implementing Microsoft Azure Infrastructure Solutions: Exam 70-533
99 pages
Create A Gateway Load Balancer Using The Azure CLI
PDF
No ratings yet
Create A Gateway Load Balancer Using The Azure CLI
9 pages
6427 A Lab Manual
PDF
No ratings yet
6427 A Lab Manual
170 pages
Windows Azure Platform 2010-04-20 Dominick Baier and Christian Weyer
PDF
No ratings yet
Windows Azure Platform 2010-04-20 Dominick Baier and Christian Weyer
24 pages
Create A Gateway Load Balancer Using Azure PowerShell
PDF
No ratings yet
Create A Gateway Load Balancer Using Azure PowerShell
9 pages
TN Nutanix Calm
PDF
No ratings yet
TN Nutanix Calm
23 pages
Azure DDoS Network Protection
PDF
No ratings yet
Azure DDoS Network Protection
9 pages
Deploying Web Apps in Enterprise Scenarios
PDF
No ratings yet
Deploying Web Apps in Enterprise Scenarios
269 pages
00 Course Intro
PDF
No ratings yet
00 Course Intro
19 pages
Exchange 2010 To 2013 Migration Guide
PDF
No ratings yet
Exchange 2010 To 2013 Migration Guide
38 pages
Create A Load Balancer With More Than One Availability Set in The Backend Pool Using The Azure Portal
PDF
No ratings yet
Create A Load Balancer With More Than One Availability Set in The Backend Pool Using The Azure Portal
21 pages
AZ-104-MicrosoftAzureAdministrator LAB 02b-Manage Governance Via Azure Policy
PDF
No ratings yet
AZ-104-MicrosoftAzureAdministrator LAB 02b-Manage Governance Via Azure Policy
9 pages
Lab 01. Create VM Via Portal (v2)
PDF
No ratings yet
Lab 01. Create VM Via Portal (v2)
9 pages
Lab Answer Key - Module 6 - Planning and Implementing Storage, Backup, and Recovery Services
PDF
No ratings yet
Lab Answer Key - Module 6 - Planning and Implementing Storage, Backup, and Recovery Services
12 pages
Lab 03b - Manage Azure Resources by Using ARM Templates
PDF
No ratings yet
Lab 03b - Manage Azure Resources by Using ARM Templates
3 pages
Running Kubernetes in Azure
PDF
No ratings yet
Running Kubernetes in Azure
45 pages
Mod 4 - Lab - Configure Azure DNS
PDF
No ratings yet
Mod 4 - Lab - Configure Azure DNS
6 pages
Basic Disk Vs Dynamic Disk
PDF
No ratings yet
Basic Disk Vs Dynamic Disk
12 pages
Microsoft 10972 Administering The Web Server IIS Role of Windows Server
PDF
No ratings yet
Microsoft 10972 Administering The Web Server IIS Role of Windows Server
5 pages
Terraform
PDF
No ratings yet
Terraform
6 pages
Powers Hell Cheat Sheet
PDF
No ratings yet
Powers Hell Cheat Sheet
1 page
Exchange Migration Wizard
PDF
No ratings yet
Exchange Migration Wizard
22 pages
Devops Syllabus
PDF
No ratings yet
Devops Syllabus
4 pages
Create A Single Virtual Machine Inbound NAT Rule Using The Azure Portal
PDF
No ratings yet
Create A Single Virtual Machine Inbound NAT Rule Using The Azure Portal
13 pages
Microsoft Azure Fundamentals Course
PDF
No ratings yet
Microsoft Azure Fundamentals Course
2 pages
Azure Administrator Learning Path (March 2019)
PDF
No ratings yet
Azure Administrator Learning Path (March 2019)
1 page
Introduction To Cloud Formation On AWS
PDF
No ratings yet
Introduction To Cloud Formation On AWS
10 pages
ADFS Install
PDF
No ratings yet
ADFS Install
101 pages
Azure VM Overview
PDF
No ratings yet
Azure VM Overview
9 pages
Vnet Terraform Lab
PDF
No ratings yet
Vnet Terraform Lab
7 pages
Understand Cloud Infrastructure Solutions and How They Are Delivered Using Terraform
PDF
No ratings yet
Understand Cloud Infrastructure Solutions and How They Are Delivered Using Terraform
4 pages
Microsoft Azure Beginner SOP Managing Azure Resources With Terraform
PDF
No ratings yet
Microsoft Azure Beginner SOP Managing Azure Resources With Terraform
6 pages
Terraform Associate
PDF
No ratings yet
Terraform Associate
2 pages
Identity Integrations
PDF
No ratings yet
Identity Integrations
7 pages
Zero Trust Principles To An Azure Virtual WAN
PDF
No ratings yet
Zero Trust Principles To An Azure Virtual WAN
17 pages
Introduction To Azure Blob Storage
PDF
No ratings yet
Introduction To Azure Blob Storage
6 pages
Azure Blob Storage Client Library For Java
PDF
No ratings yet
Azure Blob Storage Client Library For Java
16 pages
Create A Gateway Load Balancer Using The Azure Portal
PDF
No ratings yet
Create A Gateway Load Balancer Using The Azure Portal
16 pages
Load Balance VMs Within An Availability Zone by Using The Azure Portal
PDF
No ratings yet
Load Balance VMs Within An Availability Zone by Using The Azure Portal
15 pages
Azure Blob Storage Client Library For Python
PDF
No ratings yet
Azure Blob Storage Client Library For Python
13 pages
Create A Multiple Virtual Machine Inbound NAT Rule Using The Azure Portal
PDF
No ratings yet
Create A Multiple Virtual Machine Inbound NAT Rule Using The Azure Portal
13 pages
Create An Internal Load Balancer Via CLI
PDF
No ratings yet
Create An Internal Load Balancer Via CLI
12 pages
Azure Blob Storage Client Library For C++
PDF
No ratings yet
Azure Blob Storage Client Library For C++
11 pages
Use Azure Storage Explorer To Create A Blob
PDF
No ratings yet
Use Azure Storage Explorer To Create A Blob
8 pages
Azure Win VM Portal LAB
PDF
No ratings yet
Azure Win VM Portal LAB
8 pages
DNS Name Resolution
PDF
No ratings yet
DNS Name Resolution
7 pages
Azure Linux VM Portal LAB
PDF
No ratings yet
Azure Linux VM Portal LAB
7 pages
Configure Outbound Connectivity With A Gateway Load Balancer
PDF
No ratings yet
Configure Outbound Connectivity With A Gateway Load Balancer
7 pages
Create An Internal Load Balancer Via Bicep
PDF
No ratings yet
Create An Internal Load Balancer Via Bicep
7 pages
Create, Download, and List Blobs With Azure CLI
PDF
No ratings yet
Create, Download, and List Blobs With Azure CLI
6 pages
Blob Storage Feature Support in Azure Storage Accounts
PDF
No ratings yet
Blob Storage Feature Support in Azure Storage Accounts
6 pages
Virtual Machine With A Static Public IP Address
PDF
No ratings yet
Virtual Machine With A Static Public IP Address
4 pages
Migrate From Inbound NAT Pools To NAT Rules
PDF
No ratings yet
Migrate From Inbound NAT Pools To NAT Rules
4 pages
Recover Deleted Storage Account
PDF
No ratings yet
Recover Deleted Storage Account
3 pages
What Is Azure Blob Storage
PDF
No ratings yet
What Is Azure Blob Storage
2 pages
Create A Fully Qualified Domain Name For A VM
PDF
No ratings yet
Create A Fully Qualified Domain Name For A VM
1 page
Integrate With Zero Trust Solutions
PDF
No ratings yet
Integrate With Zero Trust Solutions
1 page