Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.37 KB

File metadata and controls

37 lines (27 loc) · 1.37 KB

Windows VM on Azure with SSH (demo)

Terraform configuration to deploy a Windows VM in Azure with SSH enabled and auth via a given key.

This is for demonstration purposes only, do not use in any production or production-like environment.

The VM's NIC will have a security group restricting inbound access to the public IP address the deployment is made from.

Usage

  1. Supply SSH pubkey
# Tip: You can use `ssh-add -L` to retrieve a list of keys loaded in your SSH agent
export TF_VAR_ssh_pubkey="ssh-ed25519 PASTE_YOUR_PUBKEY"
  1. Supply Azure subscription ID
# Tip: You can copy "id" from `az account show` output once auth'd via Azure CLI
export ARM_SUBSCRIPTION_ID="PASTE_SUBSCRIPTION_ID"
  1. terraform apply (use -var=shell=cmd or -var=shell=powershell depending on what shell to set as default for OpenSSH)
  2. ssh $(terraform output -raw ssh)

After accepting the host key fingerprint you should see roughly the following prompt:

Microsoft Windows [Version 10.0.26100.6899]
(c) Microsoft Corporation. All rights reserved.

azure@vm C:\Users\azure>

Read More