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.
- 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"- 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"terraform apply(use-var=shell=cmdor-var=shell=powershelldepending on what shell to set as default for OpenSSH)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>