{"id":15780025,"url":"https://github.com/rgl/azure-windows-vm","last_synced_at":"2026-01-08T07:54:30.742Z","repository":{"id":139750294,"uuid":"162916094","full_name":"rgl/azure-windows-vm","owner":"rgl","description":"an example azure windows virtual machine","archived":false,"fork":false,"pushed_at":"2024-09-21T14:29:12.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-04T18:40:42.336Z","etag":null,"topics":["azure","example","terraform","windows"],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-23T18:49:59.000Z","updated_at":"2024-09-21T14:29:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"3bafe887-fac9-4ae4-8f29-70143708c796","html_url":"https://github.com/rgl/azure-windows-vm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fazure-windows-vm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fazure-windows-vm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fazure-windows-vm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fazure-windows-vm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/azure-windows-vm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229578484,"owners_count":18095304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","example","terraform","windows"],"created_at":"2024-10-04T18:40:23.150Z","updated_at":"2026-01-08T07:54:30.692Z","avatar_url":"https://github.com/rgl.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"an example azure ubuntu virtual machine\n\n![](architecture.png)\n\n# Usage (on a Ubuntu Desktop)\n\nInstall the tools:\n\n```bash\n./provision-tools.sh\n```\n\nLogin into azure:\n\n```bash\naz login\n```\n\nList the subscriptions:\n\n```bash\naz account list --all\naz account show\n```\n\nSet the subscription:\n\n```bash\nexport ARM_SUBSCRIPTION_ID=\"\u003cYOUR-SUBSCRIPTION-ID\u003e\"\naz account set --subscription \"$ARM_SUBSCRIPTION_ID\"\n```\n\nReview `main.tf` and maybe change the `location` variable.\n\nInitialize terraform:\n\n```bash\nmake terraform-init\n```\n\nLaunch the example:\n\n```bash\nmake terraform-apply\n```\n\nAt VM initialization time a Custom Script Extension will run the `provision.ps1` script to customize the VM and launch the example web application.\n\nGet the initialization script status:\n\n```bash\naz vm get-instance-view \\\n    --resource-group rgl-windows-vm-example \\\n    --name app \\\n    --query instanceView.extensions\n```\n\nAfter VM initialization is done (the log is stored at `c:\\AzureData\\provision-log.txt`), test the `app` endpoint:\n\n```bash\nwhile ! wget -qO- \"http://$(terraform output --raw app_ip_address)/test\"; do sleep 3; done\nwhile ! wget -qO- \"http://[$(terraform output --raw app_ipv6_ip_address)]/test\"; do sleep 3; done\n```\n\nYou can also list all resources:\n\n```bash\naz resource list \\\n    --resource-group rgl-windows-vm-example \\\n    --output table\n```\n\nYou can execute commands:\n\n```bash\n# NB unfortunately, run-command is somewhat limited. for example, it only\n#    outputs last 4k of the command output.\n#    see https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command#restrictions\naz vm run-command invoke \\\n    --resource-group rgl-windows-vm-example \\\n    --name app \\\n    --command-id RunPowerShellScript \\\n    --scripts 'whoami /all' \\\n    \u003e output.json \\\n    \u0026\u0026 jq -r '.value[].message' output.json \\\n    \u0026\u0026 rm output.json\naz vm run-command invoke \\\n    --resource-group rgl-windows-vm-example \\\n    --name app \\\n    --command-id RunPowerShellScript \\\n    --scripts 'param([string]$name)' 'Write-Host \"Hello $name!\"' \\\n    --parameters 'name=Rui' \\\n    \u003e output.json \\\n    \u0026\u0026 jq -r '.value[].message' output.json \\\n    \u0026\u0026 rm output.json\n```\n\nAccess using RDP, either using Remmina or FreeRDP:\n\n```bash\nremmina --connect \"rdp://rgl@$(terraform output --raw app_ip_address)\"\nxfreerdp \"/v:$(terraform output --raw app_ip_address)\" /u:rgl /size:1440x900 +clipboard\n```\n\nInside the RDP session, open a PowerShell session, and poke around:\n\n```powershell\nipconfig /all\nroute print\nping -6 -n 3 2606:4700:4700::1111    # cloudflare dns.\nping -6 -n 3 2606:4700:4700::1001    # cloudflare dns.\nping -6 -n 3 ff02::1                 # all nodes.   # NB does not work in azure.\nping -6 -n 3 ff02::2                 # all routers. # NB does not work in azure.\nping -4 -n 3 ip6.me\nping -6 -n 3 ip6.me\nResolve-DnsName ip6.me\nResolve-DnsName ip6.me -Server 2606:4700:4700::1111\ncurl.exe -4 https://ip6.me/api/ # get the vm public ipv4 address.\ncurl.exe -6 https://ip6.me/api/ # get the vm public ipv6 address.\ncurl.exe http://ip6only.me/api/ # get the vm public ipv6 address.\ncurl.exe http://10.1.1.4/test   # try the app private ipv4 endpoint.\ncurl.exe http://[fd00::4]/test  # try the app private ipv6 endpoint.\n$ipv6_public_test_url=\"http://[$(((curl.exe -6 -s https://ip6.me/api/) -split ',')[1])]/test\"\ncurl.exe \"$ipv6_public_test_url\" # try the app public ipv6 endpoint.\necho @\"\ngo to https://dnschecker.org/server-headers-check.php and test the app ipv6 url:\n$ipv6_public_test_url\n\"@\nexit\n```\n\nDestroy the example:\n\n```bash\nmake terraform-destroy\n```\n\n# Reference\n\n* [Azure virtual machine extensions and features](https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/overview)\n* [Azure Virtual Machine Agent overview](https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/agent-windows)\n* [Custom Script Extension for Windows](https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fazure-windows-vm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fazure-windows-vm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fazure-windows-vm/lists"}