Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable scheduled shutdown of Guacamole Windows VMs #4211

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENHANCEMENTS:
* Enabled Structured Azure Firewall logs for TRE firewall. [#4430](https://github.com/microsoft/AzureTRE/issues/4430)
* Deny public access to TRE management storage account, and add private endpoint for TRE core [#4353](https://github.com/microsoft/AzureTRE/issues/4353)
* Added anonymous access enablement for Nexus by default issue. [#4387](https://github.com/microsoft/AzureTRE/pull/4387)
* Add shutdown schedule to Windows VMs ([#4211](https://github.com/microsoft/AzureTRE/pull/4211))
* Update mysql commands in control_tre script. [#4438](https://github.com/microsoft/AzureTRE/pull/4438)
* Organize how we pass config.yaml settings to bundles. [#4436](https://github.com/microsoft/AzureTRE/pull/4436)
* Add documentation for make commands ([[#4296](https://github.com/microsoft/AzureTRE/issues/4296)])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
schemaVersion: 1.0.0
name: tre-service-guacamole-windowsvm
version: 1.2.14
version: 1.2.15
description: "An Azure TRE User Resource Template for Guacamole (Windows 10)"
dockerfile: Dockerfile.tmpl
registry: azuretre
Expand Down Expand Up @@ -120,13 +120,27 @@ parameters:
type: string
- name: arm_environment
type: string
- name: enable_shutdown_schedule
type: boolean
default: false
description: "Enable automatic shutdown schedule for the VM"
- name: shutdown_time
default: ""
type: string
description: "Time of day to shutdown the VM (HHmm format)"
pattern: "^([01]?[0-9]|2[0-3])[0-5][0-9]$"
- name: shutdown_timezone
type: string
description: "Timezone for the shutdown schedule"
default: "UTC"
- name: enable_cmk_encryption
type: boolean
default: false
- name: key_store_id
type: string
default: ""


outputs:
- name: ip
type: string
Expand Down Expand Up @@ -172,6 +186,9 @@ install:
shared_storage_access: ${ bundle.parameters.shared_storage_access }
shared_storage_name: ${ bundle.parameters.shared_storage_name }
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_shutdown_schedule: ${ bundle.parameters.enable_shutdown_schedule }
shutdown_time: ${ bundle.parameters.shutdown_time }
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
owner_id: ${ bundle.parameters.owner_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
Expand Down Expand Up @@ -205,6 +222,9 @@ upgrade:
shared_storage_access: ${ bundle.parameters.shared_storage_access }
shared_storage_name: ${ bundle.parameters.shared_storage_name }
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_shutdown_schedule: ${ bundle.parameters.enable_shutdown_schedule }
shutdown_time: ${ bundle.parameters.shutdown_time }
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
owner_id: ${ bundle.parameters.owner_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
Expand Down Expand Up @@ -250,6 +270,9 @@ uninstall:
shared_storage_access: ${ bundle.parameters.shared_storage_access }
shared_storage_name: ${ bundle.parameters.shared_storage_name }
image_gallery_id: ${ bundle.parameters.image_gallery_id }
enable_shutdown_schedule: ${ bundle.parameters.enable_shutdown_schedule }
shutdown_time: ${ bundle.parameters.shutdown_time }
shutdown_timezone: ${ bundle.parameters.shutdown_timezone }
owner_id: ${ bundle.parameters.owner_id }
enable_cmk_encryption: ${ bundle.parameters.enable_cmk_encryption }
key_store_id: ${ bundle.parameters.key_store_id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,81 @@
"title": "Shared storage",
"default": true,
"description": "Enable access to shared storage"
},
"enable_shutdown_schedule": {
"$id": "#/properties/enable_shutdown_schedule",
"type": "boolean",
"title": "Enable Shutdown Schedule",
"default": false,
"description": "Enable automatic shutdown schedule for the VM"
}
},
"uiSchema": {
"admin_username": {
"classNames": "tre-hidden"
"allOf": [
{
"if": {
"properties": {
"enable_shutdown_schedule": {
"const": true
}
},
"required": [
"enable_shutdown_schedule"
]
},
"then": {
"properties": {
"shutdown_time": {
"type": "string",
"title": "Shutdown Time",
"description": "Time of day to shutdown the VM (HHmm format), e.g. 1800",
"pattern": "^([01]?[0-9]|2[0-3])[0-5][0-9]$",
"default": "1800"
},
"shutdown_timezone": {
"type": "string",
"title": "Shutdown Timezone",
"description": "Timezone for the shutdown schedule",
"default": "UTC",
"enum": [
"UTC -12",
"UTC -11",
"UTC -10",
"UTC -9",
"UTC -8",
"UTC -7",
"UTC -6",
"UTC -5",
"UTC -4",
"UTC -3",
"UTC -2",
"UTC -1",
"UTC",
"UTC +1",
"UTC +2",
"UTC +3",
"UTC +4",
"UTC +5",
"UTC +6",
"UTC +7",
"UTC +8",
"UTC +9",
"UTC +10",
"UTC +11",
"UTC +12"
]
}
},
"required": [
"shutdown_time",
"shutdown_timezone"
]
}
}
]
},
"uiSchema": {
"admin_username": {
"classNames": "tre-hidden"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ variable "image_gallery_id" {
type = string
default = ""
}
variable "enable_shutdown_schedule" {
type = bool
default = false
}
variable "shutdown_time" {
type = string
}
variable "shutdown_timezone" {
type = string
default = "UTC"
}
variable "owner_id" {
type = string
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,16 @@ resource "azurerm_key_vault_secret" "windowsvm_password" {

lifecycle { ignore_changes = [tags] }
}

resource "azurerm_dev_test_global_vm_shutdown_schedule" "shutdown_schedule" {
count = var.enable_shutdown_schedule ? 1 : 0

location = data.azurerm_resource_group.ws.location
virtual_machine_id = azurerm_windows_virtual_machine.windowsvm.id
daily_recurrence_time = var.shutdown_time
timezone = var.shutdown_timezone
enabled = var.enable_shutdown_schedule
notification_settings {
enabled = false
}
}
Loading