Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Deploy an Azure Linux VM with Terraform and Remote State

A practical guide to provisioning an Azure Linux VM with Terraform and storing shared state in a protected Azure Storage blob.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy an Azure Linux virtual machine by defining its network and compute resources with Terraform’s AzureRM provider, then store the configuration’s state in a private Azure Storage blob using Terraform’s azurerm backend. The backend is separate from the provider: each needs a valid way to access Azure. This guide uses SSH public-key authentication, reviews a saved plan before applying it, and covers state security, verification, and cleanup.

What you need to decide first

Before writing configuration, choose the Azure region, VM size, Linux image, and resource names. Decide whether the VM needs a public IP and which inbound traffic is genuinely required. A typical deployment includes a resource group, virtual network, subnet, network security group (NSG), public IP if needed, network interface, Linux VM, OS disk, SSH public key, and boot diagnostics.

As an Amazon Associate I earn from qualifying purchases.

The example image in Microsoft’s Linux VM Terraform quickstart is Canonical Ubuntu Server 22.04. Confirm that the selected image reference is available in your target region when you deploy; image availability and version behavior can change. Azure Linux 4.0 is another option, but Microsoft’s Azure Linux 4.0 VM article, last updated August 19, 2026, marks it as preview for evaluation and testing, not as a production-ready choice.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the Azure Storage backend

Create a dedicated storage account and private blob container for Terraform state before initializing the workload configuration. Record the state resource group, storage account name, container name, and blob key; the backend configuration needs these values. Keep state storage separate from the VM’s resources so that destroying the VM configuration does not also remove the state needed to manage it.

#1 Best Overall
Sale
GMKtec G3S Mini PC Intel N95 Processor (Up to 3.4GHz) 8GB RAM 256GB M.2 SSD
  • 12th Intel Alder Lake N95 Processor – The GMKtec G3 S Mini PC is powered by the 12th Gen Intel N95 processor with 4 cores, 4 threads, 6MB cache and a burst frequency up to 3.4GHz. Compared with N100/N5105/N5100/N5095, the N95 delivers up to 36% overall performance improvement. Perfect for routine tasks, office work, and home entertainment, this compact mini desktop is more convenient than traditional bulky PCs.
  • 8GB RAM & 256GB SSD Storage – Pre-installed with 8GB DDR4 memory and a fast 256GB M.2 2242 SSD, the G3 S mini desktop offers quicker startup, smoother multitasking, and faster file transfers. Enjoy seamless performance whether you’re working on multiple applications, browsing, or streaming content.
  • Rich Interfaces & Connectivity – The G3 S mini computer comes equipped with USB 3.2 (up to 10Gbps), dual HDMI 2.0 (4K@60Hz), and a 3.5mm audio jack. With support for WiFi 5, Bluetooth 5.0, and Gigabit Ethernet (RJ45 1000MbE), it connects easily with monitors, projectors, printers, office equipment, and other peripherals, making it versatile for both home and business use.
  • Dual 4K Display Support – Featuring upgraded Intel UHD Graphics (up to 1000MHz), the G3 S supports 4K video playback and AV1 decoding for a smooth viewing experience. With dual HDMI outputs, you can connect two 4K@60Hz displays simultaneously, enabling efficient multitasking for work and entertainment.
  • GMKTEC WARRANTY - GMKtec offers a 3-year limited warranty (1 year replacement + 2 years parts replacement) for each mini PC, starting from the date of the purchase effective on all sales starting Oct. 2026. All defects due to design and workmanship are covered. With a professional after sales team always ready to attend to your needs, you can simply relax and enjoy your mini PC

Terraform’s AzureRM provider and its backend are distinct. The provider authenticates to create or update Azure resources; the backend separately needs permission and connectivity to read and write the state blob. For interactive local work, Microsoft documents Azure CLI authentication in its Terraform on Azure documentation. For non-interactive runs, choose an appropriate service principal or managed identity; Microsoft’s managed identity guidance discusses this route. Grant only the permissions needed for the workflow. A Contributor assignment at subscription scope is an example in that guidance, not a universal requirement.

A backend block can be configured in the Terraform root module, for example:

terraform {
  backend "azurerm" {
    resource_group_name  = "<state-resource-group>"
    storage_account_name = "<storage-account-name>"
    container_name       = "<private-container-name>"
    key                  = "linux-vm.tfstate"
  }
}

Replace each angle-bracketed value with the actual backend detail. Follow Microsoft’s Azure Storage state guide for the authentication method and backend setup appropriate to your environment. Avoid putting a backend access key in a configuration file or committing it to source control. Microsoft recommends passing an access key through an environment variable rather than writing it to disk, and describes protecting a key with Key Vault.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Define the VM and its supporting resources

Declare Terraform and AzureRM provider requirements, configure the provider for the chosen subscription and region, and model the VM along with the network resources it depends on. Microsoft’s quickstart is a useful resource-structure example, but its AzureRM ~> 3.0 constraint is not a current version recommendation. Check the AzureRM Linux virtual machine resource reference and the Registry for a compatible current provider constraint before adopting it. Commit the project’s .terraform.lock.hcl file so that the selected provider versions are recorded for subsequent runs.

Rank #2
NIMO AI NAS, Agentic Computer Mini PC and AI Server, Intel Core Ultra 5 320 (up to 4.6 GHz, beat AI 5 340) up to 132TB ZFS Hybrid Storage, for 24hr AI Agent
  • High-Performance NAS with Powerful Procesor: Intel Core 5 320 is ideal for small offices, & More. You can enjoy smooth performance and seamless collaboration, while making use of advanced features like Docker and virtual machines. It works semalessly across every device inluding Windows, macOS, Linux, iOS, Android or Google services and so on.
  • Better Way to Store Than External Drives: NAS offers centralized storage, automatic backups, remote access, and a wide range of RAID options for easy data recovery even if a drive fails. Massive Storage Capacity: Never worry about storage limits again. With up 144TB capacity, you can store 50 million 1MB photos or 98K 1.5GB movies,5 million 30MB songs! *Hard Drives not included.
  • Secure Private Cloud: Retain 100% data ownership with advanced encryption to protect your files. Flexible permission management makes it easy to protect your privacy when collaborating with others.
  • AI-Powered Photo Album: Automatically organizes your photos by recognizing faces, scenes, objects, and locations. It can also instantly remove duplicates, freeing up storage space and saving you time.
  • User-Friendly App: Simple setup and easy file-sharing on Windows, macOS, Android, iOS, web browsers, and smart TVs, giving you secure access from any device.

Use an SSH public key for the standard login path: provide an administrator username and the public-key data to the Linux VM resource, and keep the matching private key under the operator’s control. The provider reference says password authentication defaults to disabled. It also warns that administrator login and password arguments are kept in raw Terraform state as plain text. Avoid password-based access unless a specific requirement calls for it, and treat any credentials in state as sensitive.

Build ingress into the NSG deliberately. If direct SSH access is required, allow TCP port 22 only from the intended source range rather than opening it to all addresses. If administration will use another approved access method, do not expose SSH publicly just because a public IP is present. The quickstart’s resource layout is a starting point, not a reason to permit broader inbound access than your use case requires.

Initialize, plan, and apply

  1. Save the configuration. Put the backend block, provider requirements, provider configuration, and VM resources in the Terraform root module. Keep credentials out of the files.
  2. Initialize the backend and providers. From that directory, run terraform init. Terraform configures the Azure Storage backend and installs the selected provider. If you change backend settings later, initialize again and follow Terraform’s migration prompt carefully rather than assuming state has moved.
  3. Review an exact saved plan. Run terraform plan -out=tfplan. Inspect the proposed changes, including public IP and NSG ingress, before proceeding. Applying the saved plan ensures Terraform executes the plan you reviewed rather than generating a new one.
  4. Apply the reviewed plan. Run terraform apply tfplan and wait for Terraform to report completion. Protect the plan file as well as state: plans can also contain sensitive values.
  5. Verify the deployment. Use Azure CLI or another Azure management interface to confirm that the VM and expected network resources exist in the intended resource group and region. Test access only through the route and source ranges you deliberately configured.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Protect state while collaborating

Remote state is useful for a shared workflow because team members and automation can use the same state rather than relying on one person’s local file. Microsoft states in its Azure Storage state guide that “Azure Storage blobs are automatically locked before any operation that writes state.” This prevents concurrent state writes from corrupting the state file. Microsoft also says blob data is encrypted at rest and describes Terraform retrieving state into memory rather than writing it to local disk in this backend pattern.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Those protections do not make state safe for unrestricted access. State can include secrets and resource arguments, and the AzureRM VM reference specifically notes that administrator credentials are stored as plain text in raw state. Restrict access to the storage account and container to the identities that need it. Restrict network access with a storage firewall, service endpoint, or private endpoint where appropriate. Encryption at rest and write locking do not replace authorization to read the blob.

Rank #3
AMD Ryzen™ AI Halo - Personal AI Desktop Computer - Developer Platform - Linux OS
  • Built for Local AI Development: AMD Ryzen AI Halo is designed for local AI development and inference, featuring 128GB unified memory and support for up to 200B parameter models to build and run intensive AI workloads locally.
  • 128GB Unified Memory: Features 128GB LPDDR5x unified memory at 8000 MT/s with 256 GB/s memory bandwidth, providing a shared memory pool across the CPU, GPU, and NPU to support larger AI models.
  • AMD Ryzen AI Max+ 395 Processor: Features 16 cores, 32 threads, and Zen 5 architecture, paired with AMD Radeon 8060S integrated graphics featuring 40 RDNA 3.5 compute units and an AMD XDNA 2 NPU with up to 50 TOPS.
  • Linux AI Developer Platform: Purpose-built for Linux-based AI development with full AMD ROCm software support and preloaded tools, models, and workflows optimized for local AI development.
  • Compact, Connected Design: Includes a 2TB M.2 SSD, 10GbE LAN, Wi-Fi 7, Bluetooth 5.4, USB-C connectivity, and HDMI 2.1b.

Compared with local state, Azure Storage remote state supports shared access and locking, while local files are more exposed to accidental deletion and difficult team handoffs. Neither approach removes the need to protect sensitive state or preserve recovery access. Keep the backend’s administrative and recovery path separate from routine VM cleanup.

Review costs and destroy only when intended

Terraform’s VM creation flow does not show cost information in the way the Azure portal does. There is no reliable fixed deployment total: charges depend on region, VM size, disks, networking choices, and how long resources remain allocated. Check current Azure pricing for the configuration you plan to run.

When the VM is temporary, use Terraform’s destroy plan workflow and inspect it before deletion:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
terraform plan -destroy -out=destroy.tfplan
terraform apply destroy.tfplan

This removes resources managed by the current state. Do not apply a destroy plan unless you intend to remove those resources, and do not remove the backend storage while it is still needed to manage or recover that state.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.