From 9d668e36f2d75ba8cb1e8b20e6c69cb926c0484c Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 24 Oct 2026 02:14:24 +0100 Subject: [PATCH 01/33] Use VM size defaults that Switzerland North offers A deployment with the code defaults fails in Switzerland North. Azure returns NotAvailableForSubscription there for Standard_B2s, Standard_B2ms and Standard_B4ms (az vm list-skus --all), and Standard_DS2_v3 does not exist. Each default moves to the size with the same vCPU count, memory and Hyper-V generations: - resource processor and admin VM: Standard_B2s -> Standard_B2ls_v2 - Nexus: Standard_B2ms -> Standard_B2s_v2, and Standard_B4s_v2 is a new choice beside Standard_B4ms - AML compute instance bundle: Standard_DS2_v3 -> Standard_D2_v3, the value that its schema already uses The schemas keep the old sizes, so existing services stay valid. The resource processor scale set uses automatic upgrades, so a deployment that does not set resource_processor_vmss_sku gets the new size at the next core deployment. A unit test keeps each default the same in each file that sets it. --- .../devcontainer_run_command/action.yml | 2 +- CHANGELOG.md | 1 + config.sample.yaml | 2 +- config_schema.json | 2 +- core/terraform/variables.tf | 2 +- docs/tre-admins/environment-variables.md | 2 +- .../cicd-pre-deployment-steps.md | 2 +- .../setup-instructions/workflows.md | 2 +- e2e_tests/unit_tests/test_vm_size_defaults.py | 48 +++++++++++++++++++ .../shared_services/admin-vm/porter.yaml | 4 +- .../admin-vm/template_schema.json | 3 +- .../sonatype-nexus-vm/porter.yaml | 4 +- .../sonatype-nexus-vm/template_schema.json | 4 +- .../sonatype-nexus-vm/terraform/variables.tf | 2 +- .../user_resources/aml_compute/porter.yaml | 4 +- 15 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 e2e_tests/unit_tests/test_vm_size_defaults.py diff --git a/.github/actions/devcontainer_run_command/action.yml b/.github/actions/devcontainer_run_command/action.yml index d416d09ae3..8ec6987513 100644 --- a/.github/actions/devcontainer_run_command/action.yml +++ b/.github/actions/devcontainer_run_command/action.yml @@ -339,7 +339,7 @@ runs: -e UI_SITE_NAME="${{ inputs.UI_SITE_NAME }}" \ -e UI_FOOTER_TEXT="${{ inputs.UI_FOOTER_TEXT }}" \ -e TF_VAR_resource_processor_vmss_sku="${{ (inputs.RESOURCE_PROCESSOR_VMSS_SKU != '' - && inputs.RESOURCE_PROCESSOR_VMSS_SKU) || 'Standard_B2s' }}" \ + && inputs.RESOURCE_PROCESSOR_VMSS_SKU) || 'Standard_B2ls_v2' }}" \ -e TF_VAR_resource_processor_number_processes_per_instance="${{ (inputs.RESOURCE_PROCESSOR_NUMBER_PROCESSES_PER_INSTANCE != '' && inputs.RESOURCE_PROCESSOR_NUMBER_PROCESSES_PER_INSTANCE) || 5 }}" \ -e FIREWALL_SKU=${{ inputs.FIREWALL_SKU != '' && inputs.FIREWALL_SKU || 'Standard' }} \ diff --git a/CHANGELOG.md b/CHANGELOG.md index decc945754..3dca3cf2ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ BUG FIXES: The workspace start script gives the OIDC source the current client secret at each start, and it stops Gitea one time when the OIDC settings change. The web app reads the client secret through a Key Vault reference. (`tre-workspace-service-gitea` 2.0.0, `tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) +* Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/config.sample.yaml b/config.sample.yaml index 5872dc08ed..5805d61112 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -34,7 +34,7 @@ tre: tre_address_space: 10.0.0.0/12 core_app_service_plan_sku: P1v2 - resource_processor_vmss_sku: Standard_B2s + resource_processor_vmss_sku: Standard_B2ls_v2 enable_swagger: true enable_airlock_malware_scanning: true # WARNING: Disabling legacy airlock deletes all v1 storage accounts and their data on core redeployment. diff --git a/config_schema.json b/config_schema.json index 82a042aa3d..b22cc358bd 100644 --- a/config_schema.json +++ b/config_schema.json @@ -135,7 +135,7 @@ "type": "string" }, "resource_processor_vmss_sku": { - "description": "VMSS SKU for the Resource Processor scale set (e.g., Standard_B2s).", + "description": "VMSS SKU for the Resource Processor scale set (e.g., Standard_B2ls_v2).", "type": "string" }, "user_management_enabled": { diff --git a/core/terraform/variables.tf b/core/terraform/variables.tf index a539a98960..3d00351ba9 100644 --- a/core/terraform/variables.tf +++ b/core/terraform/variables.tf @@ -120,7 +120,7 @@ variable "resource_processor_type" { variable "resource_processor_vmss_sku" { type = string - default = "Standard_B2s" + default = "Standard_B2ls_v2" description = "The SKU of the resource processor VMSS." } diff --git a/docs/tre-admins/environment-variables.md b/docs/tre-admins/environment-variables.md index 3154669b4b..430edd6750 100644 --- a/docs/tre-admins/environment-variables.md +++ b/docs/tre-admins/environment-variables.md @@ -41,7 +41,7 @@ | `RESOURCE_PROCESSOR_VMSS_SKU` | The SKU of the VMMS to use for the resource processing VM. | | `CORE_APP_SERVICE_PLAN_SKU` | The SKU of AppService plans created for the core infrastructure. | | `WORKSPACE_APP_SERVICE_PLAN_SKU` | Optional. The SKU used for AppService plan used in E2E tests unless otherwise specified. Default value is `P1v2`. | -| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2s`. | +| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2ls_v2`. | | `RESOURCE_PROCESSOR_NUMBER_PROCESSES_PER_INSTANCE` | Optional. The number of processes to instantiate when the Resource Processor starts. Equates to the number of parallel deployment operations possible in your TRE. Defaults to `5`. | | `FIREWALL_SKU` | Optional. The SKU of the Azure Firewall instance. Default value is `Standard`. Allowed values [`Basic`, `Standard`, `Premium`]. See [Azure Firewall SKU feature comparison](https://learn.microsoft.com/en-us/azure/firewall/choose-firewall-sku). | | `APP_GATEWAY_SKU` | Optional. The SKU of the Application Gateway. Default value is `Standard_v2`. Allowed values [`Standard_v2`, `WAF_v2`] | diff --git a/docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md b/docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md index 68e8aa7ad7..cf1982ec54 100644 --- a/docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md +++ b/docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md @@ -100,7 +100,7 @@ Configure the following **variables** in your github environment: | `TRE_ADDRESS_SPACE` | Optional. The address space for the whole TRE environment virtual network where workspaces networks will be created (can include the core network as well). Default value is `10.0.0.0/16` | | `CORE_APP_SERVICE_PLAN_SKU` | Optional. The SKU used for AppService plan for core infrastructure. Default value is `P1v2`. | | `WORKSPACE_APP_SERVICE_PLAN_SKU` | Optional. The SKU used for AppService plan used in E2E tests. Default value is `P1v2`. | -| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2s`. | +| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2ls_v2`. | | `RESOURCE_PROCESSOR_NUMBER_PROCESSES_PER_INSTANCE` | Optional. The number of processes to instantiate when the Resource Processor starts. Equates to the number of parallel deployment operations possible in your TRE. Defaults to `5`. | | `ENABLE_SWAGGER` | Optional. Determines whether the Swagger interface for the API will be available. Default value is `false`. | | `FIREWALL_SKU` | Optional. The SKU of the Azure Firewall instance. Default value is `Standard`. Allowed values [`Basic`, `Standard`, `Premium`]. See [Azure Firewall SKU feature comparison](https://learn.microsoft.com/en-us/azure/firewall/choose-firewall-sku). | diff --git a/docs/tre-admins/setup-instructions/workflows.md b/docs/tre-admins/setup-instructions/workflows.md index 07c86a9756..15ecefec48 100644 --- a/docs/tre-admins/setup-instructions/workflows.md +++ b/docs/tre-admins/setup-instructions/workflows.md @@ -295,7 +295,7 @@ Configure variables used in the deployment workflow: | `TRE_ADDRESS_SPACE` | Optional. The address space for the whole TRE environment virtual network where workspaces networks will be created (can include the core network as well). Default value is `10.0.0.0/16` | | `CORE_APP_SERVICE_PLAN_SKU` | Optional. The SKU used for AppService plan for core infrastructure. Default value is `P1v2`. | | `WORKSPACE_APP_SERVICE_PLAN_SKU` | Optional. The SKU used for AppService plan used in E2E tests. Default value is `P1v2`. | -| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2s`. | +| `RESOURCE_PROCESSOR_VMSS_SKU` | Optional. The SKU of the resource processor VMSS. Defaults to `Standard_B2ls_v2`. | | `RESOURCE_PROCESSOR_NUMBER_PROCESSES_PER_INSTANCE` | Optional. The number of processes to instantiate when the Resource Processor starts. Equates to the number of parallel deployment operations possible in your TRE. Defaults to `5`. | | `ENABLE_SWAGGER` | Optional. Determines whether the Swagger interface for the API will be available. Default value is `false`. | | `FIREWALL_SKU` | Optional. The SKU of the Azure Firewall instance. Default value is `Standard`. Allowed values [`Basic`, `Standard`, `Premium`]. See [Azure Firewall SKU feature comparison](https://learn.microsoft.com/en-us/azure/firewall/choose-firewall-sku). | diff --git a/e2e_tests/unit_tests/test_vm_size_defaults.py b/e2e_tests/unit_tests/test_vm_size_defaults.py new file mode 100644 index 0000000000..4e72a9afc5 --- /dev/null +++ b/e2e_tests/unit_tests/test_vm_size_defaults.py @@ -0,0 +1,48 @@ +"""Check that each VM size default is the same in every file that sets it.""" + +import json +from pathlib import Path +import re +import unittest + +import yaml + +ROOT = Path(__file__).resolve().parents[2] + + +def terraform_default(path, name): + block = (ROOT / path).read_text().split(f'variable "{name}" {{', 1)[1].split("\n}", 1)[0] + return re.search(r'default\s*=\s*"([^"]+)"', block).group(1) + + +class VMSizeDefaultTests(unittest.TestCase): + def test_resource_processor_default_is_the_same_in_each_file(self): + default = terraform_default("core/terraform/variables.tf", "resource_processor_vmss_sku") + sample = yaml.safe_load((ROOT / "config.sample.yaml").read_text()) + self.assertEqual(sample["tre"]["resource_processor_vmss_sku"], default) + action = (ROOT / ".github/actions/devcontainer_run_command/action.yml").read_text() + self.assertIn(f"&& inputs.RESOURCE_PROCESSOR_VMSS_SKU) || '{default}' }}}}", action) + for doc in ( + "docs/tre-admins/environment-variables.md", + "docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md", + "docs/tre-admins/setup-instructions/workflows.md", + ): + with self.subTest(doc=doc): + self.assertIn(f"Defaults to `{default}`.", (ROOT / doc).read_text()) + + def test_bundle_defaults_match_their_schema(self): + cases = ( + ("templates/shared_services/admin-vm", "admin_jumpbox_vm_sku"), + ("templates/shared_services/sonatype-nexus-vm", "vm_size"), + ("templates/workspace_services/azureml/user_resources/aml_compute", "vm_size"), + ) + for folder, name in cases: + with self.subTest(bundle=folder): + porter = yaml.safe_load((ROOT / folder / "porter.yaml").read_text()) + parameter = next(p for p in porter["parameters"] if p["name"] == name) + schema = json.loads((ROOT / folder / "template_schema.json").read_text())["properties"][name] + self.assertEqual(parameter["default"], schema["default"]) + self.assertIn(schema["default"], schema["enum"]) + nexus = terraform_default("templates/shared_services/sonatype-nexus-vm/terraform/variables.tf", "vm_size") + schema = json.loads((ROOT / "templates/shared_services/sonatype-nexus-vm/template_schema.json").read_text()) + self.assertEqual(nexus, schema["properties"]["vm_size"]["default"]) diff --git a/templates/shared_services/admin-vm/porter.yaml b/templates/shared_services/admin-vm/porter.yaml index c808ff4866..df674d729e 100644 --- a/templates/shared_services/admin-vm/porter.yaml +++ b/templates/shared_services/admin-vm/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-shared-service-admin-vm -version: 0.5.7 +version: 0.5.8 description: "An admin vm shared service" dockerfile: Dockerfile.tmpl registry: azuretre @@ -60,7 +60,7 @@ parameters: - name: admin_jumpbox_vm_sku env: ADMIN_JUMPBOX_VM_SKU type: string - default: Standard_B2s + default: Standard_B2ls_v2 - name: enable_cmk_encryption type: boolean default: false diff --git a/templates/shared_services/admin-vm/template_schema.json b/templates/shared_services/admin-vm/template_schema.json index a32086d0e8..8e1b2880f7 100644 --- a/templates/shared_services/admin-vm/template_schema.json +++ b/templates/shared_services/admin-vm/template_schema.json @@ -18,12 +18,13 @@ "admin_jumpbox_vm_sku": { "type": "string", "enum": [ + "Standard_B2ls_v2", "Standard_B2s", "Standard_D2s_v3", "Standard_D2s_v4", "Standard_D2s_v5" ], - "default": "Standard_B2s", + "default": "Standard_B2ls_v2", "title": "VM SKU", "description": "The SKU of the VM that will be deployed." } diff --git a/templates/shared_services/sonatype-nexus-vm/porter.yaml b/templates/shared_services/sonatype-nexus-vm/porter.yaml index 2c32e4586e..34e14084e8 100644 --- a/templates/shared_services/sonatype-nexus-vm/porter.yaml +++ b/templates/shared_services/sonatype-nexus-vm/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-shared-service-sonatype-nexus -version: 3.11.4 +version: 3.11.5 description: "A Sonatype Nexus shared service" dockerfile: Dockerfile.tmpl registry: azuretre @@ -66,7 +66,7 @@ parameters: default: "" - name: vm_size type: string - default: "Standard_B2ms" + default: "Standard_B2s_v2" description: "The size of the VM to be deployed" - name: accept_nexus_eula type: boolean diff --git a/templates/shared_services/sonatype-nexus-vm/template_schema.json b/templates/shared_services/sonatype-nexus-vm/template_schema.json index 4da2699064..0edf736ab3 100644 --- a/templates/shared_services/sonatype-nexus-vm/template_schema.json +++ b/templates/shared_services/sonatype-nexus-vm/template_schema.json @@ -52,8 +52,10 @@ "type": "string", "title": "VM Size", "description": "The size of the VM to be deployed", - "default": "Standard_B2ms", + "default": "Standard_B2s_v2", "enum": [ + "Standard_B2s_v2", + "Standard_B4s_v2", "Standard_B2ms", "Standard_B4ms", "Standard_D2s_v3", diff --git a/templates/shared_services/sonatype-nexus-vm/terraform/variables.tf b/templates/shared_services/sonatype-nexus-vm/terraform/variables.tf index ae7ea599f3..26ee014790 100644 --- a/templates/shared_services/sonatype-nexus-vm/terraform/variables.tf +++ b/templates/shared_services/sonatype-nexus-vm/terraform/variables.tf @@ -23,7 +23,7 @@ variable "key_store_id" { variable "vm_size" { type = string description = "The size of the VM to be deployed" - default = "Standard_B2ms" + default = "Standard_B2s_v2" } variable "mgmt_acr_name" { diff --git a/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml b/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml index ecf738b05e..f229ab0bfb 100644 --- a/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml +++ b/templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-user-resource-aml-compute-instance -version: 0.5.15 +version: 0.5.16 description: "Azure Machine Learning Compute Instance" registry: azuretre dockerfile: Dockerfile.tmpl @@ -30,7 +30,7 @@ parameters: type: string - name: vm_size type: string - default: "Standard_DS2_v3" + default: "Standard_D2_v3" - name: user_object_id type: string - name: tfstate_resource_group_name From 41c52169261f0d2cfe2f6093a89f52f57c6a109c Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 22:43:38 +0000 Subject: [PATCH 02/33] Wrap a long CHANGELOG entry The Markdown lint rejects a line with more than 400 characters. The entry now continues on lines that start with two spaces, as an earlier entry in the file does. The rendered text does not change. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dca3cf2ee..2356755bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,9 @@ BUG FIXES: * Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) +* Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. + Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. + (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) From d38e0d1a2d33df9bcd50b41171a31dcfb92f2bfd Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 17:55:57 +0000 Subject: [PATCH 03/33] Use the Ubuntu archive key and HTTPS for the Ubuntu packages The Guacamole Linux VM gives its three Ubuntu apt sources the option `signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg`. The other apt sources of the VM already name their key. Nexus gets the `ubuntu` and `ubuntu-security` packages from `https://archive.ubuntu.com` and `https://security.ubuntu.com`, the same as its other proxies. The Nexus firewall rule already allows port 443 for these hosts. An upgrade does not change the apt sources of an existing VM, because the bundle ignores changes to `custom_data`. The Nexus document gives the manual step. Versions: `tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3. --- CHANGELOG.md | 1 + devops/tests/test_nexus_repos.py | 20 +++++++++++++++++++ docs/tre-templates/shared-services/nexus.md | 11 ++++++++-- .../nexus_repos_config/ubuntu_proxy_conf.json | 2 +- .../ubuntu_security_proxy_conf.json | 2 +- .../guacamole-azure-linuxvm/porter.yaml | 2 +- .../terraform/apt_sources_config.yml | 6 +++--- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2356755bf3..599c063b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ BUG FIXES: * Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) +* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/devops/tests/test_nexus_repos.py b/devops/tests/test_nexus_repos.py index 83cd7cf70a..93fbbc78f0 100644 --- a/devops/tests/test_nexus_repos.py +++ b/devops/tests/test_nexus_repos.py @@ -334,5 +334,25 @@ def test_cloud_init_status_controls_extension_result(self): self.assertEqual(result.returncode, expected, result.stdout + result.stderr) +class UbuntuSourceTests(unittest.TestCase): + def test_nexus_proxies_use_https(self): + for path in sorted((NEXUS / "nexus_repos_config").glob("*.json")): + remote = json.loads(path.read_text()).get("proxy", {}).get("remoteUrl") + if remote: + with self.subTest(config=path.name): + self.assertTrue(remote.startswith("https://"), remote) + + def test_linux_vm_apt_sources_name_their_key(self): + sources = re.findall( + r"^\s*deb (\[[^\]]*\]) (\S+)", (LINUXVM / "apt_sources_config.yml").read_text(), re.MULTILINE + ) + self.assertLessEqual({"$PRIMARY", "$SECURITY"}, {source for _, source in sources}) + for options, source in sources: + with self.subTest(source=source): + self.assertRegex(options, r"^\[signed-by=/[^\]\s]+\]$") + if source in ("$PRIMARY", "$SECURITY"): + self.assertEqual(options, "[signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg]") + + if __name__ == "__main__": unittest.main() diff --git a/docs/tre-templates/shared-services/nexus.md b/docs/tre-templates/shared-services/nexus.md index 6b1a8570f1..c99d98e4ad 100644 --- a/docs/tre-templates/shared-services/nexus.md +++ b/docs/tre-templates/shared-services/nexus.md @@ -58,6 +58,13 @@ This VM bundle requests the `$RELEASE-security` suite and waits for cloud-init t For existing Linux VMs, set the security source suite to the VM's release plus `-security`, for example `jammy-security`. Bundle upgrades do not change existing apt sources or rerun cloud-init. Already-failed VMs need a separate repair or replacement. +## Ubuntu archive key and HTTPS + +Nexus bundle `3.11.3` gets the `ubuntu` and `ubuntu-security` packages over HTTPS, the same as the other proxies. An upgrade updates the remote URL of the two repositories in place. + +Guacamole Linux VM bundle `1.4.10` gives the three Ubuntu lines the option `signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg`, so apt uses the Ubuntu archive key for these sources. +Bundle upgrades do not change the apt sources of an existing VM. For an existing Linux VM, set the options of the three Ubuntu lines in `/etc/apt/sources.list` to `[signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg]`. + ## Validate Linux VM provisioning Run the `linux_vm` E2E test explicitly to check Ubuntu 22.04 bootstrap through Nexus. @@ -122,8 +129,8 @@ Nexus Shared Service requires access to resources outside of the Azure TRE VNET. | Docker | raw | [https://download.docker.com/linux/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/docker/` | Install Docker via apt on Linux systems. A raw proxy passes through any Ubuntu release, so one repo serves all supported distributions. | | Docker GPG | raw | [https://download.docker.com/linux/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/docker-public-key/` | Provide public key to sign apt source for above Docker apt. | | Docker Hub | docker | [https://registry-1.docker.io] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/docker-hub/` | Provide docker access to public images repo. | -| Ubuntu Packages | raw | [http://archive.ubuntu.com/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/ubuntu/` | Ubuntu apt packages. A raw proxy passes through any Ubuntu release, so one repo serves all supported distributions. | -| Ubuntu Security | raw | [http://security.ubuntu.com/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/ubuntu-security/` | Ubuntu security apt packages. A raw proxy passes through any Ubuntu release, so one repo serves all supported distributions. | +| Ubuntu Packages | raw | [https://archive.ubuntu.com/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/ubuntu/` | Ubuntu apt packages. A raw proxy passes through any Ubuntu release, so one repo serves all supported distributions. | +| Ubuntu Security | raw | [https://security.ubuntu.com/ubuntu/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/ubuntu-security/` | Ubuntu security apt packages. A raw proxy passes through any Ubuntu release, so one repo serves all supported distributions. | | Almalinux | yum | [https://repo.almalinux.org] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/almalinux` | Install Almalinux packages | | R-Proxy | r | [https://cran.r-project.org/] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/r-proxy` | Provide access to CRAN packages for R | | R-Studio Download | raw | [https://download1.rstudio.org] | `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com/repository/r-studio-download` | Provide access to download R Studio | diff --git a/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_proxy_conf.json b/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_proxy_conf.json index 77a36b72f9..f009db6c6e 100644 --- a/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_proxy_conf.json +++ b/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_proxy_conf.json @@ -6,7 +6,7 @@ "strictContentTypeValidation": false }, "proxy": { - "remoteUrl": "http://archive.ubuntu.com/ubuntu/", + "remoteUrl": "https://archive.ubuntu.com/ubuntu/", "contentMaxAge": 1440, "metadataMaxAge": 1440 }, diff --git a/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_security_proxy_conf.json b/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_security_proxy_conf.json index cd30ba7d90..7d0c7235ec 100644 --- a/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_security_proxy_conf.json +++ b/templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_security_proxy_conf.json @@ -6,7 +6,7 @@ "strictContentTypeValidation": false }, "proxy": { - "remoteUrl": "http://security.ubuntu.com/ubuntu/", + "remoteUrl": "https://security.ubuntu.com/ubuntu/", "contentMaxAge": 1440, "metadataMaxAge": 1440 }, diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml index 7bf342ff5c..d82e9f32ae 100644 --- a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml +++ b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-service-guacamole-linuxvm -version: 1.4.9 +version: 1.4.10 description: "An Azure TRE User Resource Template for Guacamole (Linux)" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/apt_sources_config.yml b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/apt_sources_config.yml index 58ce121d77..d315c1d5b0 100644 --- a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/apt_sources_config.yml +++ b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/apt_sources_config.yml @@ -11,9 +11,9 @@ apt: - default uri: "${nexus_proxy_url}/repository/ubuntu-security/" sources_list: | - deb [trusted=yes] $PRIMARY $RELEASE main restricted universe multiverse - deb [trusted=yes] $PRIMARY $RELEASE-updates main restricted universe multiverse - deb [trusted=yes] $SECURITY $RELEASE-security main restricted universe multiverse + deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] $PRIMARY $RELEASE main restricted universe multiverse + deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] $PRIMARY $RELEASE-updates main restricted universe multiverse + deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] $SECURITY $RELEASE-security main restricted universe multiverse deb [signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] ${nexus_proxy_url}/repository/microsoft-apt/ubuntu/${apt_sku}/prod $RELEASE main deb [signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] ${nexus_proxy_url}/repository/microsoft-apt/repos/edge stable main deb [signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] ${nexus_proxy_url}/repository/microsoft-apt/repos/vscode stable main From cdbb7f0a3094081306a37ebddaeb6ccf9b5c03f4 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 21:14:49 +0000 Subject: [PATCH 04/33] Create the Gitea storage network rules with the account The Gitea storage account got its network rules from the separate resource `azurerm_storage_account_network_rules`. That resource set the rules after the account create and changed them again before the account delete. The account now has an inline `network_rules` block, as the Airlock storage accounts have. A `removed` block with `destroy = false` makes an upgrade remove the old resource from the Terraform state without a destroy. Version: `tre-workspace-service-gitea` 1.3.8. --- CHANGELOG.md | 1 + templates/workspace_services/gitea/porter.yaml | 2 +- .../gitea/terraform/storage.tf | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 599c063b06..4fe7ef4ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ BUG FIXES: Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) +* Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/templates/workspace_services/gitea/porter.yaml b/templates/workspace_services/gitea/porter.yaml index 8dfa72c65d..22eca9b5d0 100644 --- a/templates/workspace_services/gitea/porter.yaml +++ b/templates/workspace_services/gitea/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-service-gitea -version: 2.0.0 +version: 2.0.1 description: "A Gitea workspace service" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspace_services/gitea/terraform/storage.tf b/templates/workspace_services/gitea/terraform/storage.tf index fbd6eecf18..139983295e 100644 --- a/templates/workspace_services/gitea/terraform/storage.tf +++ b/templates/workspace_services/gitea/terraform/storage.tf @@ -12,6 +12,11 @@ resource "azurerm_storage_account" "gitea" { # changing this value is destructive, hence attribute is in lifecycle.ignore_changes block below infrastructure_encryption_enabled = true + network_rules { + default_action = "Deny" + bypass = ["AzureServices"] + } + dynamic "identity" { for_each = var.enable_cmk_encryption ? [1] : [] content { @@ -31,11 +36,14 @@ resource "azurerm_storage_account" "gitea" { lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] } } -resource "azurerm_storage_account_network_rules" "stgrules" { - storage_account_id = azurerm_storage_account.gitea.id +# Before version 1.3.8, a separate resource managed the network rules. A destroy of that resource +# changes the rules of the account, so Terraform only removes it from the state. +removed { + from = azurerm_storage_account_network_rules.stgrules - default_action = "Deny" - bypass = ["AzureServices"] + lifecycle { + destroy = false + } } resource "azurerm_private_endpoint" "stgfilepe" { From 4a666669a4d5747fe3e7fd686ad8288c6cec4034 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 21:15:56 +0000 Subject: [PATCH 05/33] Create the workspace storage network rules with the account The workspace storage account got its network rules from the separate resource `azurerm_storage_account_network_rules`. That resource set the rules after the account create and changed them again before the account delete. The account now has an inline `network_rules` block with the same values. The share and the `datalake` container no longer depend on the separate resource. A `removed` block with `destroy = false` makes an upgrade remove the old resource from the Terraform state without a destroy. Version: `tre-workspace-base` 2.12.3. --- CHANGELOG.md | 1 + templates/workspaces/base/porter.yaml | 2 +- .../workspaces/base/terraform/storage.tf | 24 ++++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fe7ef4ff0..642439cb9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ BUG FIXES: (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) +* Create the network rules of the workspace storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index b973e35c0b..7c50c2efbd 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 2.12.4 +version: 2.12.5 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/terraform/storage.tf b/templates/workspaces/base/terraform/storage.tf index 53c45fd79e..47f8de5cf0 100644 --- a/templates/workspaces/base/terraform/storage.tf +++ b/templates/workspaces/base/terraform/storage.tf @@ -32,6 +32,12 @@ resource "azurerm_storage_account" "stg" { lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] } + # When deploying from a local machine we need to "allow" + network_rules { + default_action = var.enable_local_debugging ? "Allow" : "Deny" + bypass = ["AzureServices"] + } + blob_properties { delete_retention_policy { days = 7 @@ -62,8 +68,7 @@ resource "azapi_resource" "shared_storage" { } depends_on = [ - azurerm_private_endpoint.stgfilepe, - azurerm_storage_account_network_rules.stgrules + azurerm_private_endpoint.stgfilepe ] } @@ -73,17 +78,18 @@ resource "azurerm_storage_container" "stgcontainer" { container_access_type = "private" depends_on = [ - azurerm_private_endpoint.stgblobpe, - azurerm_storage_account_network_rules.stgrules + azurerm_private_endpoint.stgblobpe ] } -resource "azurerm_storage_account_network_rules" "stgrules" { - storage_account_id = azurerm_storage_account.stg.id +# Before version 2.12.3, a separate resource managed the network rules. A destroy of that resource +# changes the rules of the account, so Terraform only removes it from the state. +removed { + from = azurerm_storage_account_network_rules.stgrules - # When deploying from a local machine we need to "allow" - default_action = var.enable_local_debugging ? "Allow" : "Deny" - bypass = ["AzureServices"] + lifecycle { + destroy = false + } } resource "azurerm_private_endpoint" "stgfilepe" { From 2738e4a6680be1acd6641c07a0331c6999e33e2c Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 21:21:12 +0000 Subject: [PATCH 06/33] Create the Airlock export in-progress network rules with the account The Airlock export in-progress storage account got its network rules from the separate resource `azurerm_storage_account_network_rules`. The account now has an inline `network_rules` block with the same values, as the four other Airlock storage accounts have. A `removed` block with `destroy = false` makes an upgrade remove the old resource from the Terraform state without a destroy. A new test makes sure that no template declares the separate resource and that each `removed` block for it keeps the rules. Version: `tre-workspace-base` 2.12.3, the same version as the earlier commit. --- CHANGELOG.md | 2 +- devops/tests/test_storage_network_rules.py | 36 +++++++++++++++++++ .../terraform/airlock/storage_accounts.tf | 26 +++++++++----- 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 devops/tests/test_storage_network_rules.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 642439cb9d..6edefb7a83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,7 @@ BUG FIXES: (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) -* Create the network rules of the workspace storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3) +* Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/devops/tests/test_storage_network_rules.py b/devops/tests/test_storage_network_rules.py new file mode 100644 index 0000000000..b017e41361 --- /dev/null +++ b/devops/tests/test_storage_network_rules.py @@ -0,0 +1,36 @@ +"""Make sure that the template storage accounts keep their network rules inline.""" + +from pathlib import Path +import re +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +RULES = "azurerm_storage_account_network_rules" +REMOVED = re.compile(r"^removed \{\n(.*?)^\}", re.MULTILINE | re.DOTALL) + + +def terraform_files(): + return sorted((ROOT / "templates").rglob("*.tf")) + + +class StorageNetworkRulesTests(unittest.TestCase): + def test_no_separate_network_rules_resource(self): + found = [str(path.relative_to(ROOT)) for path in terraform_files() if f'resource "{RULES}"' in path.read_text()] + self.assertEqual(found, []) + + def test_removed_network_rules_are_not_destroyed(self): + blocks = [ + (path, block) + for path in terraform_files() + for block in REMOVED.findall(path.read_text()) + if f"from = {RULES}." in block + ] + self.assertEqual(len(blocks), 3) + for path, block in blocks: + with self.subTest(path=str(path.relative_to(ROOT))): + self.assertRegex(block, r"lifecycle \{\s*destroy = false\s*\}") + + +if __name__ == "__main__": + unittest.main() diff --git a/templates/workspaces/base/terraform/airlock/storage_accounts.tf b/templates/workspaces/base/terraform/airlock/storage_accounts.tf index 96eb207048..b09e0d57ee 100644 --- a/templates/workspaces/base/terraform/airlock/storage_accounts.tf +++ b/templates/workspaces/base/terraform/airlock/storage_accounts.tf @@ -166,6 +166,16 @@ resource "azurerm_storage_account" "sa_export_inprogress" { # This is true ONLY when Hierarchical Namespace is DISABLED is_hns_enabled = false + network_rules { + # The Airlock processor is unable to copy blobs from the export-inprogress storage account when the only method of access from the Airlock processor is a private endpoint in the core VNet, + # so we need to allow the Airlock processor subnet to access this storage account without using a private endpoint. + # https://github.com/microsoft/AzureTRE/issues/2098 + virtual_network_subnet_ids = [var.airlock_processor_subnet_id] + + default_action = var.enable_local_debugging ? "Allow" : "Deny" + bypass = ["AzureServices"] + } + dynamic "identity" { for_each = var.enable_cmk_encryption ? [1] : [] content { @@ -195,16 +205,14 @@ resource "azurerm_storage_account" "sa_export_inprogress" { lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] } } -resource "azurerm_storage_account_network_rules" "sa_export_inprogress_rules" { - storage_account_id = azurerm_storage_account.sa_export_inprogress.id +# Before version 2.12.3, a separate resource managed the network rules. A destroy of that resource +# changes the rules of the account, so Terraform only removes it from the state. +removed { + from = azurerm_storage_account_network_rules.sa_export_inprogress_rules - # The Airlock processor is unable to copy blobs from the export-inprogress storage account when the only method of access from the Airlock processor is a private endpoint in the core VNet, - # so we need to allow the Airlock processor subnet to access this storage account without using a private endpoint. - # https://github.com/microsoft/AzureTRE/issues/2098 - virtual_network_subnet_ids = [var.airlock_processor_subnet_id] - - default_action = var.enable_local_debugging ? "Allow" : "Deny" - bypass = ["AzureServices"] + lifecycle { + destroy = false + } } resource "azurerm_private_endpoint" "export_inprogress_pe" { From c3711190459c555f1168084052aefa3e7a629566 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 21:36:30 +0000 Subject: [PATCH 07/33] Change the versions of the workspace bundles that use the base The unrestricted and Airlock import review workspace bundles build from the base workspace Terraform. The earlier commits changed that Terraform, so these bundles get new versions too. Versions: `tre-workspace-unrestricted` 0.15.2 and `tre-workspace-airlock-import-review` 0.18.2. --- CHANGELOG.md | 2 +- templates/workspaces/airlock-import-review/porter.yaml | 2 +- templates/workspaces/unrestricted/porter.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6edefb7a83..46f6133e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,7 @@ BUG FIXES: (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) -* Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3) +* Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/templates/workspaces/airlock-import-review/porter.yaml b/templates/workspaces/airlock-import-review/porter.yaml index aa37846ef0..6ee71d7595 100644 --- a/templates/workspaces/airlock-import-review/porter.yaml +++ b/templates/workspaces/airlock-import-review/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-airlock-import-review -version: 0.18.3 +version: 0.18.4 description: "A workspace to do Airlock Data Import Reviews for Azure TRE" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/unrestricted/porter.yaml b/templates/workspaces/unrestricted/porter.yaml index 805be3a171..0bb4572863 100644 --- a/templates/workspaces/unrestricted/porter.yaml +++ b/templates/workspaces/unrestricted/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-unrestricted -version: 0.15.3 +version: 0.15.4 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre From 54cfeb34612e0c8bfaa3479d8b5cc02b356418b1 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 22:43:38 +0000 Subject: [PATCH 08/33] Wrap a long CHANGELOG entry The Markdown lint rejects a line with more than 400 characters. The entry now continues on lines that start with two spaces, as an earlier entry in the file does. The rendered text does not change. --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f6133e87..ebc467de63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,8 @@ BUG FIXES: (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) -* Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) +* Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. + (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) From d031de9236b22a27563f205e0b87747eaf5fe1dc Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 25 Oct 2026 18:05:58 +0000 Subject: [PATCH 09/33] Turn off the shell command trace in two Guacamole scripts The Guacamole Linux VM setup script `vm_config.sh` turned on `set -o xtrace`. The comment above that line says to turn it on for debugging only, so the line is a comment again. The Guacamole server start script `start-guacamole.sh` traced the oauth2-proxy start command. It no longer does. A new test makes sure that no template shell script turns on the command trace. Versions: `tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8 (image 0.10.3). --- CHANGELOG.md | 1 + devops/tests/test_template_scripts.py | 22 +++++++++++++++++++ .../docker/start-guacamole.sh | 2 -- .../guacamole-server/docker/version.txt | 2 +- .../workspace_services/guacamole/porter.yaml | 2 +- .../terraform/vm_config.sh | 2 +- 6 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 devops/tests/test_template_scripts.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc467de63..1887ed680f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ BUG FIXES: * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) +* Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py new file mode 100644 index 0000000000..d99df6f68f --- /dev/null +++ b/devops/tests/test_template_scripts.py @@ -0,0 +1,22 @@ +"""Make sure that the template shell scripts do not trace their commands.""" + +from pathlib import Path +import re +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +TRACE = re.compile(r"^\s*set\s+(-[a-zA-Z]*x[a-zA-Z]*|-o\s+xtrace)\b", re.MULTILINE) + + +class TemplateScriptTests(unittest.TestCase): + def test_scripts_do_not_trace_commands(self): + scripts = sorted((ROOT / "templates").rglob("*.sh")) + self.assertTrue(scripts) + for script in scripts: + with self.subTest(script=str(script.relative_to(ROOT))): + self.assertIsNone(TRACE.search(script.read_text())) + + +if __name__ == "__main__": + unittest.main() diff --git a/templates/workspace_services/guacamole/guacamole-server/docker/start-guacamole.sh b/templates/workspace_services/guacamole/guacamole-server/docker/start-guacamole.sh index 21dd16f91e..51fd7e4617 100755 --- a/templates/workspace_services/guacamole/guacamole-server/docker/start-guacamole.sh +++ b/templates/workspace_services/guacamole/guacamole-server/docker/start-guacamole.sh @@ -49,7 +49,6 @@ start_oauth() { cookiesecret=$(dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d '\n' | tr '+/' '-_') log "starting oauth2-proxy" - set -x "${OAUTH2_PROXY_HOME}/oauth2-proxy" \ --provider oidc \ --skip-provider-button \ @@ -74,7 +73,6 @@ start_oauth() { --oidc-email-claim "preferred_username" \ --scope "openid offline_access ${AUDIENCE}/user_impersonation profile" & oauth_pid=$! - set +x } start_tomcat diff --git a/templates/workspace_services/guacamole/guacamole-server/docker/version.txt b/templates/workspace_services/guacamole/guacamole-server/docker/version.txt index 17c1a6260b..b2385cb400 100644 --- a/templates/workspace_services/guacamole/guacamole-server/docker/version.txt +++ b/templates/workspace_services/guacamole/guacamole-server/docker/version.txt @@ -1 +1 @@ -__version__ = "0.10.2" +__version__ = "0.10.3" diff --git a/templates/workspace_services/guacamole/porter.yaml b/templates/workspace_services/guacamole/porter.yaml index df7342852d..511904e86a 100644 --- a/templates/workspace_services/guacamole/porter.yaml +++ b/templates/workspace_services/guacamole/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-service-guacamole -version: 0.14.7 +version: 0.14.8 description: "An Azure TRE service for Guacamole" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh index 15be1b9a42..b880b68550 100755 --- a/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh +++ b/templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh @@ -4,7 +4,7 @@ set -o errexit set -o pipefail set -o nounset # Uncomment this line to see each command for debugging (careful: this will show secrets!) -set -o xtrace +# set -o xtrace # Remove apt sources not included in sources.list file sudo rm -f /etc/apt/sources.list.d/* From d1df0fd0974879057f21edd572c301f0e0658ebc Mon Sep 17 00:00:00 2001 From: Jay W Date: Tue, 27 Oct 2026 12:53:12 +0000 Subject: [PATCH 10/33] Limit the core storage account to its private endpoints The core storage account `stg` accepted traffic from all networks. It now accepts traffic only through its private endpoints and from trusted Azure services, the same as the other core storage accounts. The users of the account change as follows: - The Airlock notifier Logic App keeps its runtime state in queues and tables, so the core gets private endpoints for these two services. The Logic App reaches its content share through the virtual network. The platform cannot create a content share through the endpoints, so Terraform creates a new content share before the Logic App. - Nexus keeps its boot diagnostics in managed storage. - The shared Gitea service needs no change. It creates and mounts its share through the private endpoint. An earlier notifier version cannot reach the account. The CHANGELOG and the notifier document tell operators to upgrade the notifier directly after the core. Static tests cover the network rules, the four private endpoints, the notifier settings and the Nexus boot diagnostics. Versions: `core` 0.18.16, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.3. --- CHANGELOG.md | 3 + core/terraform/storage.tf | 61 +++++++++++++++++++ devops/tests/test_core_storage_network.py | 47 ++++++++++++++ .../shared-services/airlock-notifier.md | 8 +++ .../airlock_notifier/porter.yaml | 2 +- .../terraform/airlock_notifier.tf | 11 ++++ .../sonatype-nexus-vm/terraform/data.tf | 5 -- .../sonatype-nexus-vm/terraform/locals.tf | 1 - .../sonatype-nexus-vm/terraform/vm.tf | 5 +- 9 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 devops/tests/test_core_storage_network.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 1887ed680f..8034b148e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048)) * `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost. Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) +* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.16. Earlier notifier versions cannot reach the core storage account, so they stop sending notifications until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). ENHANCEMENTS: * Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150)) @@ -65,6 +66,8 @@ BUG FIXES: * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) +* Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. + (`core` 0.18.16, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.3) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/core/terraform/storage.tf b/core/terraform/storage.tf index 1994d84b5c..844ed6cab6 100644 --- a/core/terraform/storage.tf +++ b/core/terraform/storage.tf @@ -14,6 +14,12 @@ resource "azurerm_storage_account" "stg" { # changing this value is destructive, hence attribute is in lifecycle.ignore_changes block below infrastructure_encryption_enabled = true + # Shared services reach the account through the private endpoints below. + network_rules { + default_action = var.enable_local_debugging ? "Allow" : "Deny" + bypass = ["AzureServices"] + } + dynamic "identity" { for_each = var.enable_cmk_encryption ? [1] : [] content { @@ -87,3 +93,58 @@ resource "azurerm_private_endpoint" "filepe" { azurerm_private_endpoint.blobpe ] } + +# The Airlock notifier Logic App keeps its runtime state in queues and tables. +resource "azurerm_private_endpoint" "queuepe" { + name = "pe-queue-${var.tre_id}" + location = azurerm_resource_group.core.location + resource_group_name = azurerm_resource_group.core.name + subnet_id = module.network.shared_subnet_id + tags = local.tre_core_tags + + lifecycle { ignore_changes = [tags] } + + private_dns_zone_group { + name = "private-dns-zone-group-queuecore" + private_dns_zone_ids = [module.network.queue_core_dns_zone_id] + } + + private_service_connection { + name = "psc-queuestg-${var.tre_id}" + private_connection_resource_id = azurerm_storage_account.stg.id + is_manual_connection = false + subresource_names = ["queue"] + } + + # private endpoints in serial + depends_on = [ + azurerm_private_endpoint.filepe + ] +} + +resource "azurerm_private_endpoint" "tablepe" { + name = "pe-table-${var.tre_id}" + location = azurerm_resource_group.core.location + resource_group_name = azurerm_resource_group.core.name + subnet_id = module.network.shared_subnet_id + tags = local.tre_core_tags + + lifecycle { ignore_changes = [tags] } + + private_dns_zone_group { + name = "private-dns-zone-group-tablecore" + private_dns_zone_ids = [module.network.table_core_dns_zone_id] + } + + private_service_connection { + name = "psc-tablestg-${var.tre_id}" + private_connection_resource_id = azurerm_storage_account.stg.id + is_manual_connection = false + subresource_names = ["table"] + } + + # private endpoints in serial + depends_on = [ + azurerm_private_endpoint.queuepe + ] +} diff --git a/devops/tests/test_core_storage_network.py b/devops/tests/test_core_storage_network.py new file mode 100644 index 0000000000..b7422f8a31 --- /dev/null +++ b/devops/tests/test_core_storage_network.py @@ -0,0 +1,47 @@ +"""Make sure that the core storage account and its users work through the private endpoints.""" + +from pathlib import Path +import re +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +CORE_STORAGE = ROOT / "core/terraform/storage.tf" +NOTIFIER = ROOT / "templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf" +NEXUS_VM = ROOT / "templates/shared_services/sonatype-nexus-vm/terraform/vm.tf" + + +def block(source, header): + return source.split(header + " {", 1)[1].split("\n}", 1)[0] + + +class CoreStorageNetworkTests(unittest.TestCase): + def test_core_storage_denies_other_networks(self): + account = block(CORE_STORAGE.read_text(), 'resource "azurerm_storage_account" "stg"') + rules = block(account, " network_rules") + self.assertIn('default_action = var.enable_local_debugging ? "Allow" : "Deny"', rules) + self.assertIn('bypass = ["AzureServices"]', rules) + + def test_core_storage_has_an_endpoint_for_each_service(self): + # A Standard Logic App uses blobs, files, queues and tables of its storage account. + source = CORE_STORAGE.read_text() + services = re.findall(r'subresource_names\s*=\s*\["(\w+)"\]', source) + self.assertEqual(sorted(service.lower() for service in services), ["blob", "file", "queue", "table"]) + self.assertEqual(source.count("private_connection_resource_id = azurerm_storage_account.stg.id"), 4) + + def test_notifier_uses_its_content_share_through_the_network(self): + source = NOTIFIER.read_text() + logic_app = block(source, 'resource "azurerm_logic_app_standard" "logic_app"') + self.assertIn('resource "azurerm_storage_share" "logic_app_content"', source) + self.assertIn("storage_account_share_name = azurerm_storage_share.logic_app_content.name", logic_app) + self.assertRegex(logic_app, r'"WEBSITE_CONTENTOVERVNET"\s*=\s*"1"') + self.assertRegex(logic_app, r"vnet_route_all_enabled\s*=\s*true") + + def test_nexus_boot_diagnostics_use_managed_storage(self): + vm = NEXUS_VM.read_text() + self.assertIn("boot_diagnostics {}", vm) + self.assertNotIn("storage_account_uri", vm) + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/tre-templates/shared-services/airlock-notifier.md b/docs/tre-templates/shared-services/airlock-notifier.md index bb800168e4..1cf4db6dc1 100644 --- a/docs/tre-templates/shared-services/airlock-notifier.md +++ b/docs/tre-templates/shared-services/airlock-notifier.md @@ -15,3 +15,11 @@ In the future, the SMTP connection should transition into a ['Built-in connector As an alternative to the SMTP connector, you can modify the Logic app to use other email and messaging platforms as connectors, like [Office 365](https://docs.microsoft.com/en-us/azure/connectors/connectors-create-api-office365-outlook), [Outlook.com](https://docs.microsoft.com/en-us/azure/connectors/connectors-create-api-outlook), [MailChimp](https://docs.microsoft.com/en-us/connectors/mailchimp/), [Mandrill](https://docs.microsoft.com/en-us/connectors/mandrill/). + +## Storage and network + +The Logic App keeps its runtime state and its files in the core storage account `stg`. This account accepts traffic only through its private endpoints and from trusted Azure services. The Logic App uses virtual network integration and the app setting `WEBSITE_CONTENTOVERVNET` to reach the blob, file, queue and table endpoints of the account. + +Terraform creates the content share `airlock-notifier-content-` before the Logic App. Before version 1.0.15, the platform created the content share `airlock-notifier-app--content` outside Terraform. The upgrade to 1.0.15 deploys the workflow to the new share. After the upgrade, you can delete the earlier share. + +If you upgrade the core to version 0.18.16 or later, upgrade the notifier to 1.0.15 directly after the core. Earlier versions of the notifier cannot reach the storage account, and they stop sending notifications until the upgrade. diff --git a/templates/shared_services/airlock_notifier/porter.yaml b/templates/shared_services/airlock_notifier/porter.yaml index 40e1a583de..5ec902b60c 100644 --- a/templates/shared_services/airlock_notifier/porter.yaml +++ b/templates/shared_services/airlock_notifier/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-shared-service-airlock-notifier -version: 1.0.14 +version: 1.0.15 description: "A shared service notifying on Airlock Operations" registry: azuretre dockerfile: Dockerfile.tmpl diff --git a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf index 7680d67562..234c7b0dbe 100644 --- a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf +++ b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf @@ -35,6 +35,14 @@ resource "azurerm_role_assignment" "servicebus_logic_app" { principal_id = azurerm_logic_app_standard.logic_app.identity[0].principal_id } +# The core storage account accepts traffic only through its private endpoints, so the platform +# cannot create the content share of the Logic App. Terraform creates it through the endpoint. +resource "azurerm_storage_share" "logic_app_content" { + name = lower("airlock-notifier-content-${var.tre_id}") + storage_account_name = data.azurerm_storage_account.storage.name + quota = 50 +} + resource "azurerm_logic_app_standard" "logic_app" { name = "airlock-notifier-app-${var.tre_id}" location = data.azurerm_resource_group.core.location @@ -42,10 +50,13 @@ resource "azurerm_logic_app_standard" "logic_app" { app_service_plan_id = azurerm_service_plan.notifier_plan.id storage_account_name = data.azurerm_storage_account.storage.name storage_account_access_key = data.azurerm_storage_account.storage.primary_access_key + storage_account_share_name = azurerm_storage_share.logic_app_content.name virtual_network_subnet_id = data.azurerm_subnet.airlock_notification.id version = "~4" bundle_version = "[1.*, 2.0.0)" app_settings = { + # The runtime reaches its content share through the virtual network. + "WEBSITE_CONTENTOVERVNET" = "1" "FUNCTIONS_WORKER_RUNTIME" = "node" "WEBSITE_NODE_DEFAULT_VERSION" = "~20" "serviceBus_connectionString" = data.azurerm_servicebus_namespace.core.default_primary_connection_string diff --git a/templates/shared_services/sonatype-nexus-vm/terraform/data.tf b/templates/shared_services/sonatype-nexus-vm/terraform/data.tf index b47d05e891..f16460c32a 100644 --- a/templates/shared_services/sonatype-nexus-vm/terraform/data.tf +++ b/templates/shared_services/sonatype-nexus-vm/terraform/data.tf @@ -19,11 +19,6 @@ data "azurerm_key_vault_certificate" "nexus_cert" { key_vault_id = data.azurerm_key_vault.kv.id } -data "azurerm_storage_account" "nexus" { - name = local.storage_account_name - resource_group_name = local.core_resource_group_name -} - data "azurerm_resource_group" "rg" { name = local.core_resource_group_name } diff --git a/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf b/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf index 860e557d22..e1aba1d093 100644 --- a/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf +++ b/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf @@ -5,7 +5,6 @@ locals { nexus_allowed_fqdns_list = distinct(compact(split(",", replace(local.nexus_allowed_fqdns, " ", "")))) workspace_vm_allowed_fqdns = "*.o.lencr.org,*.c.lencr.org,*.i.lencr.org" workspace_vm_allowed_fqdns_list = distinct(compact(split(",", replace(local.workspace_vm_allowed_fqdns, " ", "")))) - storage_account_name = lower(replace("stg-${var.tre_id}", "-", "")) tre_shared_service_tags = { tre_id = var.tre_id tre_shared_service_id = var.tre_resource_id diff --git a/templates/shared_services/sonatype-nexus-vm/terraform/vm.tf b/templates/shared_services/sonatype-nexus-vm/terraform/vm.tf index e16812e050..177e3b08e0 100644 --- a/templates/shared_services/sonatype-nexus-vm/terraform/vm.tf +++ b/templates/shared_services/sonatype-nexus-vm/terraform/vm.tf @@ -149,9 +149,8 @@ resource "azurerm_linux_virtual_machine" "nexus" { identity_ids = [azurerm_user_assigned_identity.nexus_msi.id] } - boot_diagnostics { - storage_account_uri = data.azurerm_storage_account.nexus.primary_blob_endpoint - } + # Azure keeps the boot diagnostics in a managed storage account. + boot_diagnostics {} depends_on = [ azurerm_role_assignment.keyvault_nexus_secret_role From 4dc93ec5f0a0c7cd40040cdc1bfe8eb4be8448bc Mon Sep 17 00:00:00 2001 From: Jay W Date: Tue, 27 Oct 2026 16:54:04 +0000 Subject: [PATCH 11/33] Update the Airlock notifier Logic App in one request The upgrade of a notifier from 1.0.14 failed after the core change. AzureRM 3.117.0 updates a Logic App in two requests. The first request has only the basic app settings. It has the new content share but not WEBSITE_CONTENTOVERVNET, so the platform tries to reach the share over the public network. The core account denies this, and the update fails with "This request is not authorized to perform this operation". A create sends all app settings in one request, so a new install worked. The notifier now uses AzureRM 4.57.0, the same version as the core. This version updates the Logic App in one request with all its app settings. Terraform creates the content share through Azure Resource Manager. --- CHANGELOG.md | 1 + devops/tests/test_core_storage_network.py | 7 +++++ .../terraform/.terraform.lock.hcl | 30 +++++++++---------- .../terraform/airlock_notifier.tf | 8 ++--- .../airlock_notifier/terraform/providers.tf | 2 +- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8034b148e0..7e374dadff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ BUG FIXES: (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. + The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. (`core` 0.18.16, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.3) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) diff --git a/devops/tests/test_core_storage_network.py b/devops/tests/test_core_storage_network.py index b7422f8a31..1e0ce189a1 100644 --- a/devops/tests/test_core_storage_network.py +++ b/devops/tests/test_core_storage_network.py @@ -8,6 +8,7 @@ ROOT = Path(__file__).resolve().parents[2] CORE_STORAGE = ROOT / "core/terraform/storage.tf" NOTIFIER = ROOT / "templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf" +NOTIFIER_PROVIDERS = ROOT / "templates/shared_services/airlock_notifier/terraform/providers.tf" NEXUS_VM = ROOT / "templates/shared_services/sonatype-nexus-vm/terraform/vm.tf" @@ -37,6 +38,12 @@ def test_notifier_uses_its_content_share_through_the_network(self): self.assertRegex(logic_app, r'"WEBSITE_CONTENTOVERVNET"\s*=\s*"1"') self.assertRegex(logic_app, r"vnet_route_all_enabled\s*=\s*true") + def test_notifier_updates_the_logic_app_in_one_request(self): + # AzureRM 3.x first sends a Logic App update with only the basic app settings, without WEBSITE_CONTENTOVERVNET. + # The platform then tries to reach the content share over the public network, and the core account denies it. + major = re.search(r'version\s*=\s*"=\s*(\d+)\.', NOTIFIER_PROVIDERS.read_text()).group(1) + self.assertGreaterEqual(int(major), 4) + def test_nexus_boot_diagnostics_use_managed_storage(self): vm = NEXUS_VM.read_text() self.assertIn("boot_diagnostics {}", vm) diff --git a/templates/shared_services/airlock_notifier/terraform/.terraform.lock.hcl b/templates/shared_services/airlock_notifier/terraform/.terraform.lock.hcl index 6e8b87ea6b..a174e9aebb 100644 --- a/templates/shared_services/airlock_notifier/terraform/.terraform.lock.hcl +++ b/templates/shared_services/airlock_notifier/terraform/.terraform.lock.hcl @@ -2,21 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.117.0" - constraints = "3.117.0" + version = "4.57.0" + constraints = "4.57.0" hashes = [ - "h1:Ynfg+Iy7x6K8M6W1AhqXCe3wkoiqIQhROlca7C3KC3w=", - "zh:2e25f47492366821a786762369f0e0921cc9452d64bfd5075f6fdfcf1a9c6d70", - "zh:41eb34f2f7469bf3eb1019dfb0e7fc28256f809824016f4f8b9d691bf473b2ac", - "zh:48bb9c87b3d928da1abc1d3db75453c9725de4674c612daf3800160cc7145d30", - "zh:5d6b0de0bbd78943fcc65c53944ef4496329e247f434c6eab86ed051c5cea67b", - "zh:78c9f6fdb1206a89cf0e6706b4f46178169a93b6c964a4cad8a321058ccbd9b4", - "zh:793b702c352589d4360b580d4a1cf654a7439d2ad6bdb7bfea91de07bc4b0fac", - "zh:7ed687ff0a5509463a592f97431863574fe5cc80a34e395be06766215b8c6285", - "zh:955ba18789bd15592824eb426a8d0f38595bd09fffc6939c1c58933489c1a71e", - "zh:bf5949a55be0714cd9c8815d472eae4baa48ba06d0f6bf2b96775869acda8a54", - "zh:da5d31f635abd2c645ffc76d6176d73f646128e73720cc368247cc424975c127", - "zh:eed5a66d59883c9c56729b0a964a2b60d758ea7489ef3e920a6fbd48518ce5f5", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + "h1:NhgHn/RyZRDXMa7pEQlGv/9B+wjk48E+lvgq4asFKHs=", + "zh:05e1cc7fee7829919b772ca6ce893d9c2abb3535ebff172df38f7358cdaf8f9e", + "zh:30122203abc381660582f989c9e53874bd9ff93e25476a5536ea0ae37dd51f4b", + "zh:4a90f008f7707d95f8f9aca90f140a9ca0e9506b0a6d436fe516de4026cacd86", + "zh:6d9e114b8aed06454b71fe91a0591cc6a16cd7acde3cb36a96e4aeaec06a315a", + "zh:7145c50facd9d40615fc63561ec21962feae3fa262239f9f1f1339581226104b", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:95f60557f1bc4210ecc3c11e2f86fe983ed7e4af19036616b605887c1195f2ac", + "zh:9722b3ab879a3457588af5f0dcd65e997263affe4b829e60ecd59dbef6239e70", + "zh:b891f295b018d058e8c6f841d923d5b30ba13b8208f2c20aacc70ba48c5cc0da", + "zh:cb7ff113ca0bd91ab76f9f7a492d6ce9c911d6c4deb8c8e263e38322b5ff861e", + "zh:ec2950bf003d29bee3fa87ab073d57fe14a4da52e9fc646fec27798b700cc8af", + "zh:f69899d9e1d570a560cfa97aebec3edc2b106f2ebc15dfdee473294dd8756deb", ] } diff --git a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf index 234c7b0dbe..3acc0df777 100644 --- a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf +++ b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf @@ -36,11 +36,11 @@ resource "azurerm_role_assignment" "servicebus_logic_app" { } # The core storage account accepts traffic only through its private endpoints, so the platform -# cannot create the content share of the Logic App. Terraform creates it through the endpoint. +# cannot create the content share of the Logic App. Terraform creates it through Azure Resource Manager. resource "azurerm_storage_share" "logic_app_content" { - name = lower("airlock-notifier-content-${var.tre_id}") - storage_account_name = data.azurerm_storage_account.storage.name - quota = 50 + name = lower("airlock-notifier-content-${var.tre_id}") + storage_account_id = data.azurerm_storage_account.storage.id + quota = 50 } resource "azurerm_logic_app_standard" "logic_app" { diff --git a/templates/shared_services/airlock_notifier/terraform/providers.tf b/templates/shared_services/airlock_notifier/terraform/providers.tf index 48acc73073..917afb5802 100644 --- a/templates/shared_services/airlock_notifier/terraform/providers.tf +++ b/templates/shared_services/airlock_notifier/terraform/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.117.0" + version = "= 4.57.0" } } backend "azurerm" {} From c3c3c095efb1e41fc567c6425e369140b034b899 Mon Sep 17 00:00:00 2001 From: Jay W Date: Tue, 27 Oct 2026 22:39:47 +0000 Subject: [PATCH 12/33] Describe what an earlier notifier does after the core change In two live runs, an earlier notifier still answered about 30 minutes after the core storage account changed to Deny. The upgrade note now says that Azure mounts the content share of an earlier notifier over the public network, so a restart or a configuration change of its Logic App can fail until the upgrade. --- CHANGELOG.md | 2 ++ docs/tre-templates/shared-services/airlock-notifier.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e374dadff..d8953a80f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Setting to `false` will delete existing airlock storage accounts and must only b * `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost. Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.16. Earlier notifier versions cannot reach the core storage account, so they stop sending notifications until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). +* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.16. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. + A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). ENHANCEMENTS: * Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150)) diff --git a/docs/tre-templates/shared-services/airlock-notifier.md b/docs/tre-templates/shared-services/airlock-notifier.md index 1cf4db6dc1..e4cdae85d6 100644 --- a/docs/tre-templates/shared-services/airlock-notifier.md +++ b/docs/tre-templates/shared-services/airlock-notifier.md @@ -22,4 +22,4 @@ The Logic App keeps its runtime state and its files in the core storage account Terraform creates the content share `airlock-notifier-content-` before the Logic App. Before version 1.0.15, the platform created the content share `airlock-notifier-app--content` outside Terraform. The upgrade to 1.0.15 deploys the workflow to the new share. After the upgrade, you can delete the earlier share. -If you upgrade the core to version 0.18.16 or later, upgrade the notifier to 1.0.15 directly after the core. Earlier versions of the notifier cannot reach the storage account, and they stop sending notifications until the upgrade. +If you upgrade the core to version 0.18.16 or later, upgrade the notifier to 1.0.15 directly after the core. Azure mounts the content share of earlier notifier versions over the public network, and the storage account no longer accepts this traffic. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. From 982ac1061ed34019b36b78e5b1f9251feec57195 Mon Sep 17 00:00:00 2001 From: Jay W Date: Fri, 30 Oct 2026 23:01:52 +0000 Subject: [PATCH 13/33] Use one version bump for each component The earlier commits changed some versions more than once. Set one patch bump from main for each component: core 0.18.17, Nexus 3.11.5, Gitea 2.0.1, base workspace 2.12.5, unrestricted 0.15.4 and Airlock import review 0.18.4. Remove the two CHANGELOG entries that later commits replaced. --- CHANGELOG.md | 14 ++++++-------- core/version.txt | 2 +- .../shared-services/airlock-notifier.md | 2 +- docs/tre-templates/shared-services/nexus.md | 2 +- .../workspace_services/gitea/terraform/storage.tf | 2 +- .../base/terraform/airlock/storage_accounts.tf | 2 +- templates/workspaces/base/terraform/storage.tf | 2 +- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8953a80f5..e1481de5a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,7 @@ Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048)) * `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost. Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) -* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.16. Earlier notifier versions cannot reach the core storage account, so they stop sending notifications until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). -* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.16. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. +* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.17. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). ENHANCEMENTS: @@ -59,18 +58,17 @@ BUG FIXES: The workspace start script gives the OIDC source the current client secret at each start, and it stops Gitea one time when the OIDC settings change. The web app reads the client secret through a Key Vault reference. (`tre-workspace-service-gitea` 2.0.0, `tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) -* Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) * Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. - (`core` 0.18.16, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.3, `tre-user-resource-aml-compute-instance` 0.5.16) -* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.3) -* Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 1.3.8) + (`core` 0.18.17, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) +* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) +* Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 2.0.1) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. - (`tre-workspace-base` 2.12.3, `tre-workspace-unrestricted` 0.15.2, `tre-workspace-airlock-import-review` 0.18.2) + (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. - (`core` 0.18.16, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.3) + (`core` 0.18.17, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/core/version.txt b/core/version.txt index c1c747e2aa..6e7cb3b8f3 100644 --- a/core/version.txt +++ b/core/version.txt @@ -1 +1 @@ -__version__ = "0.18.16" +__version__ = "0.18.17" diff --git a/docs/tre-templates/shared-services/airlock-notifier.md b/docs/tre-templates/shared-services/airlock-notifier.md index e4cdae85d6..00f7b4e530 100644 --- a/docs/tre-templates/shared-services/airlock-notifier.md +++ b/docs/tre-templates/shared-services/airlock-notifier.md @@ -22,4 +22,4 @@ The Logic App keeps its runtime state and its files in the core storage account Terraform creates the content share `airlock-notifier-content-` before the Logic App. Before version 1.0.15, the platform created the content share `airlock-notifier-app--content` outside Terraform. The upgrade to 1.0.15 deploys the workflow to the new share. After the upgrade, you can delete the earlier share. -If you upgrade the core to version 0.18.16 or later, upgrade the notifier to 1.0.15 directly after the core. Azure mounts the content share of earlier notifier versions over the public network, and the storage account no longer accepts this traffic. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. +If you upgrade the core to version 0.18.17 or later, upgrade the notifier to 1.0.15 directly after the core. Azure mounts the content share of earlier notifier versions over the public network, and the storage account no longer accepts this traffic. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. diff --git a/docs/tre-templates/shared-services/nexus.md b/docs/tre-templates/shared-services/nexus.md index c99d98e4ad..b0890b7ca9 100644 --- a/docs/tre-templates/shared-services/nexus.md +++ b/docs/tre-templates/shared-services/nexus.md @@ -60,7 +60,7 @@ Bundle upgrades do not change existing apt sources or rerun cloud-init. Already- ## Ubuntu archive key and HTTPS -Nexus bundle `3.11.3` gets the `ubuntu` and `ubuntu-security` packages over HTTPS, the same as the other proxies. An upgrade updates the remote URL of the two repositories in place. +Nexus bundle `3.11.5` gets the `ubuntu` and `ubuntu-security` packages over HTTPS, the same as the other proxies. An upgrade updates the remote URL of the two repositories in place. Guacamole Linux VM bundle `1.4.10` gives the three Ubuntu lines the option `signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg`, so apt uses the Ubuntu archive key for these sources. Bundle upgrades do not change the apt sources of an existing VM. For an existing Linux VM, set the options of the three Ubuntu lines in `/etc/apt/sources.list` to `[signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg]`. diff --git a/templates/workspace_services/gitea/terraform/storage.tf b/templates/workspace_services/gitea/terraform/storage.tf index 139983295e..5ac618eeaf 100644 --- a/templates/workspace_services/gitea/terraform/storage.tf +++ b/templates/workspace_services/gitea/terraform/storage.tf @@ -36,7 +36,7 @@ resource "azurerm_storage_account" "gitea" { lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] } } -# Before version 1.3.8, a separate resource managed the network rules. A destroy of that resource +# Before version 2.0.1, a separate resource managed the network rules. A destroy of that resource # changes the rules of the account, so Terraform only removes it from the state. removed { from = azurerm_storage_account_network_rules.stgrules diff --git a/templates/workspaces/base/terraform/airlock/storage_accounts.tf b/templates/workspaces/base/terraform/airlock/storage_accounts.tf index b09e0d57ee..18c9101ab6 100644 --- a/templates/workspaces/base/terraform/airlock/storage_accounts.tf +++ b/templates/workspaces/base/terraform/airlock/storage_accounts.tf @@ -205,7 +205,7 @@ resource "azurerm_storage_account" "sa_export_inprogress" { lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] } } -# Before version 2.12.3, a separate resource managed the network rules. A destroy of that resource +# Before version 2.12.5, a separate resource managed the network rules. A destroy of that resource # changes the rules of the account, so Terraform only removes it from the state. removed { from = azurerm_storage_account_network_rules.sa_export_inprogress_rules diff --git a/templates/workspaces/base/terraform/storage.tf b/templates/workspaces/base/terraform/storage.tf index 47f8de5cf0..e6d58a5a38 100644 --- a/templates/workspaces/base/terraform/storage.tf +++ b/templates/workspaces/base/terraform/storage.tf @@ -82,7 +82,7 @@ resource "azurerm_storage_container" "stgcontainer" { ] } -# Before version 2.12.3, a separate resource managed the network rules. A destroy of that resource +# Before version 2.12.5, a separate resource managed the network rules. A destroy of that resource # changes the rules of the account, so Terraform only removes it from the state. removed { from = azurerm_storage_account_network_rules.stgrules From b77258f35ad1c10575c60ca881ee0136975700b9 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 06:24:45 +0000 Subject: [PATCH 14/33] Keep the admin VM size on upgrade and add upgrade notes The API stores only the properties that a create request sends, and an upgrade sends only the template version. So an admin VM without a stored `admin_jumpbox_vm_sku` gets the new default on the upgrade. Azure does not resize a Windows VM between a size with a temporary disk and a size without one, so that upgrade fails. The admin VM now ignores a size change after the install. The size is not updateable, so only a new default can change it. The CHANGELOG also says: - what to do if the resize of the resource processor fails; - that a Nexus without a stored `vm_size` gets the new size and restarts; - that an uninstall uses the installed bundle version, so an operator upgrades a workspace and its Gitea services before the delete to keep the storage rules. --- CHANGELOG.md | 8 ++++++-- .../shared_services/admin-vm/terraform/admin-jumpbox.tf | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1481de5a0..36a7e3a0b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,11 +59,15 @@ BUG FIXES: * Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. - Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. + Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. If that resize fails, set `resource_processor_vmss_sku` to `Standard_B2s` and deploy the core again. + An upgrade keeps the size of an existing admin VM. If a Nexus service has no stored `vm_size`, for example a Nexus from before bundle 3.2.3, the upgrade resizes its VM to `Standard_B2s_v2` and restarts it. + The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.18.17, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) -* Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. (`tre-workspace-service-gitea` 2.0.1) +* Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. + An uninstall uses the installed bundle version, so upgrade the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. + An uninstall uses the installed bundle version, so upgrade a workspace and its Gitea services first to keep the rules during the delete. (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. diff --git a/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf b/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf index ce343e48f4..bcf03e681d 100644 --- a/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf +++ b/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf @@ -62,7 +62,9 @@ resource "azurerm_windows_virtual_machine" "jumpbox" { # ignore changes to secure_boot_enabled and vtpm_enabled as these are destructive # (may be allowed once https://github.com/hashicorp/terraform-provider-azurerm/issues/25808 is fixed) # - lifecycle { ignore_changes = [tags, secure_boot_enabled, vtpm_enabled] } + # The size is not updateable, so only a new default can change it. Azure does not resize a Windows VM + # between a size with a temporary disk and a size without one, so an upgrade keeps the installed size. + lifecycle { ignore_changes = [tags, secure_boot_enabled, vtpm_enabled, size] } } resource "azurerm_disk_encryption_set" "jumpbox_disk_encryption" { From da848a8a3257db0ea112a1146f4a396d013d55ce Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 06:24:54 +0000 Subject: [PATCH 15/33] Make the guard tests find more forms - The apt key test also reads a `deb` line without options, and it fails because such a line names no key. - The trace test reads the arguments of each `set` command up to `--`, a comment or the next command. It now also finds `-x` and `-o xtrace` after other options, for example `set -e -x`. - A new storage test makes sure that each storage account in the files with a `removed` block for the separate network rules has an inline `network_rules` block with a default action. Each test fails on a copy of the templates with the gap that it names. --- devops/tests/test_nexus_repos.py | 2 +- devops/tests/test_storage_network_rules.py | 14 ++++++++ devops/tests/test_template_scripts.py | 41 ++++++++++++++++++++-- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/devops/tests/test_nexus_repos.py b/devops/tests/test_nexus_repos.py index 93fbbc78f0..c52bf598e2 100644 --- a/devops/tests/test_nexus_repos.py +++ b/devops/tests/test_nexus_repos.py @@ -344,7 +344,7 @@ def test_nexus_proxies_use_https(self): def test_linux_vm_apt_sources_name_their_key(self): sources = re.findall( - r"^\s*deb (\[[^\]]*\]) (\S+)", (LINUXVM / "apt_sources_config.yml").read_text(), re.MULTILINE + r"^\s*deb\s+(?:(\[[^\]]*\])\s+)?(\S+)", (LINUXVM / "apt_sources_config.yml").read_text(), re.MULTILINE ) self.assertLessEqual({"$PRIMARY", "$SECURITY"}, {source for _, source in sources}) for options, source in sources: diff --git a/devops/tests/test_storage_network_rules.py b/devops/tests/test_storage_network_rules.py index b017e41361..dc07fb30cb 100644 --- a/devops/tests/test_storage_network_rules.py +++ b/devops/tests/test_storage_network_rules.py @@ -8,6 +8,8 @@ ROOT = Path(__file__).resolve().parents[2] RULES = "azurerm_storage_account_network_rules" REMOVED = re.compile(r"^removed \{\n(.*?)^\}", re.MULTILINE | re.DOTALL) +ACCOUNT = re.compile(r'^resource "azurerm_storage_account" "(\w+)" \{\n(.*?)^\}', re.MULTILINE | re.DOTALL) +INLINE_RULES = re.compile(r"^ network_rules \{\n(.*?)^ \}", re.MULTILINE | re.DOTALL) def terraform_files(): @@ -31,6 +33,18 @@ def test_removed_network_rules_are_not_destroyed(self): with self.subTest(path=str(path.relative_to(ROOT))): self.assertRegex(block, r"lifecycle \{\s*destroy = false\s*\}") + def test_accounts_with_removed_rules_set_them_inline(self): + paths = [path for path in terraform_files() if f"from = {RULES}." in path.read_text()] + self.assertEqual(len(paths), 3) + for path in paths: + accounts = ACCOUNT.findall(path.read_text()) + self.assertTrue(accounts, path) + for name, body in accounts: + with self.subTest(path=str(path.relative_to(ROOT)), account=name): + rules = INLINE_RULES.search(body) + self.assertIsNotNone(rules) + self.assertIn("default_action", rules.group(1)) + if __name__ == "__main__": unittest.main() diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index d99df6f68f..bc22337b52 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -6,16 +6,53 @@ ROOT = Path(__file__).resolve().parents[2] -TRACE = re.compile(r"^\s*set\s+(-[a-zA-Z]*x[a-zA-Z]*|-o\s+xtrace)\b", re.MULTILINE) +# The arguments of each set command, up to a comment or the next command on the line. +SET = re.compile(r"^\s*set\s+([^\n#;]*)", re.MULTILINE) + + +def turns_on_trace(text): + for match in SET.finditer(text): + args = match.group(1).split() + for index, arg in enumerate(args): + if arg == "--": + break + if re.fullmatch(r"-[a-zA-Z]*x[a-zA-Z]*", arg) or ( + arg == "-o" and args[index + 1 : index + 2] == ["xtrace"] + ): + return True + return False class TemplateScriptTests(unittest.TestCase): + def test_trace_forms(self): + for line in ( + "set -x", + "set -euxo pipefail", + "set -o xtrace", + "set -e -x", + "set -eu -o xtrace", + " set -o errexit -o xtrace", + ): + with self.subTest(line=line): + self.assertTrue(turns_on_trace(line)) + for line in ( + "set +x", + "set -euo pipefail", + "set -o pipefail", + "# set -o xtrace", + "set -e # -x", + "set -e; echo -x", + "set -- -x", + ): + with self.subTest(line=line): + self.assertFalse(turns_on_trace(line)) + def test_scripts_do_not_trace_commands(self): scripts = sorted((ROOT / "templates").rglob("*.sh")) self.assertTrue(scripts) for script in scripts: with self.subTest(script=str(script.relative_to(ROOT))): - self.assertIsNone(TRACE.search(script.read_text())) + self.assertFalse(turns_on_trace(script.read_text())) if __name__ == "__main__": From 4dbf84e1ae8d563e48e539a95fdb3abd330c0953 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 06:25:02 +0000 Subject: [PATCH 16/33] Run the guard tests when the files that they read change The `Lint` workflow ran the devops tests only for the `ci_cleanup` paths, and most template files that the new guard tests read are not in that list. A new `template_files` filter runs test_core_storage_network.py, test_storage_network_rules.py and test_template_scripts.py when a template Terraform or shell file or the core storage Terraform changes. If the `ci_cleanup` filter also matches, the full devops suite runs. The E2E helper tests now also run when a file that test_vm_size_defaults.py reads changes. --- .github/workflows/build_validation_develop.yml | 13 +++++++++++++ .github/workflows/e2e_helper_tests.yml | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/build_validation_develop.yml b/.github/workflows/build_validation_develop.yml index 38de2e8713..53ed341a19 100644 --- a/.github/workflows/build_validation_develop.yml +++ b/.github/workflows/build_validation_develop.yml @@ -101,6 +101,13 @@ jobs: - '.github/workflows/build_validation_develop.yml' - '.github/workflows/clean_validation_envs.yml' + # test_core_storage_network.py, test_storage_network_rules.py + # and test_template_scripts.py read these files. + template_files: + - 'core/terraform/storage.tf' + - 'templates/**/*.tf' + - 'templates/**/*.sh' + terraform_core: - core/**/terraform/**/*.tf @@ -141,6 +148,12 @@ jobs: if: ${{ steps.filter.outputs.ci_cleanup == 'true' }} run: python3 -m unittest discover -s devops/tests -v + - name: Test template files + if: ${{ steps.filter.outputs.template_files == 'true' && steps.filter.outputs.ci_cleanup != 'true' }} + run: | + python3 -m unittest -v devops/tests/test_core_storage_network.py \ + devops/tests/test_storage_network_rules.py devops/tests/test_template_scripts.py + - name: Test core outputs in the development-container base if: ${{ steps.filter.outputs.ci_cleanup == 'true' }} # Bookworm provides jq 1.6; the hosted runner has a newer jq version. diff --git a/.github/workflows/e2e_helper_tests.yml b/.github/workflows/e2e_helper_tests.yml index 2c4f0a5277..679068dab8 100644 --- a/.github/workflows/e2e_helper_tests.yml +++ b/.github/workflows/e2e_helper_tests.yml @@ -12,6 +12,15 @@ on: # yamllint disable-line rule:truthy # test_azure_monitor_contract.py reads these Terraform files. - 'core/terraform/azure-monitor/**' - 'templates/workspaces/base/terraform/azure-monitor/**' + # test_vm_size_defaults.py reads these files. + - 'core/terraform/variables.tf' + - 'config.sample.yaml' + - '.github/actions/devcontainer_run_command/action.yml' + - 'docs/tre-admins/environment-variables.md' + - 'docs/tre-admins/setup-instructions/cicd-pre-deployment-steps.md' + - 'docs/tre-admins/setup-instructions/workflows.md' + - 'templates/**/template_schema.json' + - 'templates/shared_services/sonatype-nexus-vm/terraform/variables.tf' - '.github/workflows/e2e_helper_tests.yml' permissions: From b07a7f4359c95de671eb32661e5de7b074991e47 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 20:15:58 +0000 Subject: [PATCH 17/33] Set core 0.19.0 for the core storage change The core storage account accepts only its private endpoints, and the Airlock notifier must be upgraded after the core. A new minor version shows this change to operators. --- CHANGELOG.md | 6 +++--- core/version.txt | 2 +- docs/tre-templates/shared-services/airlock-notifier.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36a7e3a0b3..a8ccdb9ac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048)) * `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost. Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) -* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.18.17. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. +* If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.19.0. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). ENHANCEMENTS: @@ -62,7 +62,7 @@ BUG FIXES: Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. If that resize fails, set `resource_processor_vmss_sku` to `Standard_B2s` and deploy the core again. An upgrade keeps the size of an existing admin VM. If a Nexus service has no stored `vm_size`, for example a Nexus from before bundle 3.2.3, the upgrade resizes its VM to `Standard_B2s_v2` and restarts it. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. - (`core` 0.18.17, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) + (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. An uninstall uses the installed bundle version, so upgrade the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) @@ -72,7 +72,7 @@ BUG FIXES: * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. - (`core` 0.18.17, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) + (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/core/version.txt b/core/version.txt index 6e7cb3b8f3..11ac8e1a9e 100644 --- a/core/version.txt +++ b/core/version.txt @@ -1 +1 @@ -__version__ = "0.18.17" +__version__ = "0.19.0" diff --git a/docs/tre-templates/shared-services/airlock-notifier.md b/docs/tre-templates/shared-services/airlock-notifier.md index 00f7b4e530..bed42081cf 100644 --- a/docs/tre-templates/shared-services/airlock-notifier.md +++ b/docs/tre-templates/shared-services/airlock-notifier.md @@ -22,4 +22,4 @@ The Logic App keeps its runtime state and its files in the core storage account Terraform creates the content share `airlock-notifier-content-` before the Logic App. Before version 1.0.15, the platform created the content share `airlock-notifier-app--content` outside Terraform. The upgrade to 1.0.15 deploys the workflow to the new share. After the upgrade, you can delete the earlier share. -If you upgrade the core to version 0.18.17 or later, upgrade the notifier to 1.0.15 directly after the core. Azure mounts the content share of earlier notifier versions over the public network, and the storage account no longer accepts this traffic. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. +If you upgrade the core to version 0.19.0 or later, upgrade the notifier to 1.0.15 directly after the core. Azure mounts the content share of earlier notifier versions over the public network, and the storage account no longer accepts this traffic. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. From 4f6f92b5f97d7def3c372eb9834182d5bf511260 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 22:45:08 +0000 Subject: [PATCH 18/33] Find more trace forms and the notifier provider version in the guard tests The trace test now finds a set command after a separator or a keyword, a flag group that ends in o before xtrace, and a shebang with -x. The notifier test now needs AzureRM 4.40.0 or later, the first version that updates the Logic App in one request. --- devops/tests/test_core_storage_network.py | 9 +++++---- devops/tests/test_template_scripts.py | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/devops/tests/test_core_storage_network.py b/devops/tests/test_core_storage_network.py index 1e0ce189a1..3e551a1cda 100644 --- a/devops/tests/test_core_storage_network.py +++ b/devops/tests/test_core_storage_network.py @@ -39,10 +39,11 @@ def test_notifier_uses_its_content_share_through_the_network(self): self.assertRegex(logic_app, r"vnet_route_all_enabled\s*=\s*true") def test_notifier_updates_the_logic_app_in_one_request(self): - # AzureRM 3.x first sends a Logic App update with only the basic app settings, without WEBSITE_CONTENTOVERVNET. - # The platform then tries to reach the content share over the public network, and the core account denies it. - major = re.search(r'version\s*=\s*"=\s*(\d+)\.', NOTIFIER_PROVIDERS.read_text()).group(1) - self.assertGreaterEqual(int(major), 4) + # AzureRM before 4.40.0 first sends a Logic App update with only the basic app settings, without + # WEBSITE_CONTENTOVERVNET. The platform then tries to reach the content share over the public network, and the + # core account denies it. + version = re.search(r'version\s*=\s*"=\s*(\d+)\.(\d+)\.(\d+)"', NOTIFIER_PROVIDERS.read_text()).groups() + self.assertGreaterEqual(tuple(map(int, version)), (4, 40, 0)) def test_nexus_boot_diagnostics_use_managed_storage(self): vm = NEXUS_VM.read_text() diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index bc22337b52..db804f4016 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -6,18 +6,22 @@ ROOT = Path(__file__).resolve().parents[2] -# The arguments of each set command, up to a comment or the next command on the line. -SET = re.compile(r"^\s*set\s+([^\n#;]*)", re.MULTILINE) +# The arguments of each set command, also after a separator or a keyword, up to a comment or the next command. +SET = re.compile(r"(?:^|[;&|]|\bthen\b|\bdo\b|\belse\b)[ \t]*set[ \t]+([^\n#;&|]*)", re.MULTILINE) +# A shebang line with a flag group that contains x. +SHEBANG = re.compile(r"\A#![^\n]*[ \t]-[a-zA-Z]*x") def turns_on_trace(text): + if SHEBANG.search(text): + return True for match in SET.finditer(text): args = match.group(1).split() for index, arg in enumerate(args): if arg == "--": break if re.fullmatch(r"-[a-zA-Z]*x[a-zA-Z]*", arg) or ( - arg == "-o" and args[index + 1 : index + 2] == ["xtrace"] + re.fullmatch(r"-[a-zA-Z]*o", arg) and args[index + 1 : index + 2] == ["xtrace"] ): return True return False @@ -32,6 +36,11 @@ def test_trace_forms(self): "set -e -x", "set -eu -o xtrace", " set -o errexit -o xtrace", + "set -euo xtrace", + "set -o pipefail; set -x", + "if true; then set -x; fi", + "true && set -x", + "#!/bin/bash -x\necho done", ): with self.subTest(line=line): self.assertTrue(turns_on_trace(line)) @@ -43,6 +52,9 @@ def test_trace_forms(self): "set -e # -x", "set -e; echo -x", "set -- -x", + "set -e; tar -xzf a.tgz", + "echo reset -x", + "#!/bin/bash\nset -e", ): with self.subTest(line=line): self.assertFalse(turns_on_trace(line)) From f8ba663074888a8d1058d570f042d166d88519e7 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sat, 31 Oct 2026 22:45:16 +0000 Subject: [PATCH 19/33] Name the Nexus upgrade and a completed upgrade in the upgrade notes Nexus before 3.11.5 keeps the boot diagnostics of its VM in the core storage account. A destroy plan does not use removed blocks, so the rules stay only after a completed upgrade. The code comments now say that an upgrade removes the old resource from the state. --- CHANGELOG.md | 5 +++-- templates/workspace_services/gitea/terraform/storage.tf | 2 +- .../workspaces/base/terraform/airlock/storage_accounts.tf | 2 +- templates/workspaces/base/terraform/storage.tf | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ccdb9ac1..6a01bd1e97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Setting to `false` will delete existing airlock storage accounts and must only b Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.19.0. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). + Also upgrade the Sonatype Nexus shared service to 3.11.5. Earlier versions keep the boot diagnostics of the Nexus VM in the core storage account. Until the upgrade, the boot diagnostics view of that VM does not load from outside the virtual network. ENHANCEMENTS: * Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150)) @@ -65,9 +66,9 @@ BUG FIXES: (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) * Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. - An uninstall uses the installed bundle version, so upgrade the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) + An uninstall uses the installed bundle version, so complete an upgrade of the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. - An uninstall uses the installed bundle version, so upgrade a workspace and its Gitea services first to keep the rules during the delete. + An uninstall uses the installed bundle version, so complete an upgrade of a workspace and its Gitea services first to keep the rules during the delete. (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. diff --git a/templates/workspace_services/gitea/terraform/storage.tf b/templates/workspace_services/gitea/terraform/storage.tf index 5ac618eeaf..b2385d3aa4 100644 --- a/templates/workspace_services/gitea/terraform/storage.tf +++ b/templates/workspace_services/gitea/terraform/storage.tf @@ -37,7 +37,7 @@ resource "azurerm_storage_account" "gitea" { } # Before version 2.0.1, a separate resource managed the network rules. A destroy of that resource -# changes the rules of the account, so Terraform only removes it from the state. +# changes the rules of the account, so an upgrade only removes it from the state. removed { from = azurerm_storage_account_network_rules.stgrules diff --git a/templates/workspaces/base/terraform/airlock/storage_accounts.tf b/templates/workspaces/base/terraform/airlock/storage_accounts.tf index 18c9101ab6..3857f453c8 100644 --- a/templates/workspaces/base/terraform/airlock/storage_accounts.tf +++ b/templates/workspaces/base/terraform/airlock/storage_accounts.tf @@ -206,7 +206,7 @@ resource "azurerm_storage_account" "sa_export_inprogress" { } # Before version 2.12.5, a separate resource managed the network rules. A destroy of that resource -# changes the rules of the account, so Terraform only removes it from the state. +# changes the rules of the account, so an upgrade only removes it from the state. removed { from = azurerm_storage_account_network_rules.sa_export_inprogress_rules diff --git a/templates/workspaces/base/terraform/storage.tf b/templates/workspaces/base/terraform/storage.tf index e6d58a5a38..9b07754055 100644 --- a/templates/workspaces/base/terraform/storage.tf +++ b/templates/workspaces/base/terraform/storage.tf @@ -83,7 +83,7 @@ resource "azurerm_storage_container" "stgcontainer" { } # Before version 2.12.5, a separate resource managed the network rules. A destroy of that resource -# changes the rules of the account, so Terraform only removes it from the state. +# changes the rules of the account, so an upgrade only removes it from the state. removed { from = azurerm_storage_account_network_rules.stgrules From 997b3a49c210a568dd01cb6a61fbdb60911ba52f Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 13:41:24 +0000 Subject: [PATCH 20/33] Add a report of VM sizes and their availability in Azure regions The script devops/scripts/vm_size_report.py finds each VM size that the repository uses. It checks each size against the VM SKU list of one or more regions. It checks Azure ML sizes against the Azure ML size list. The VM Size Availability workflow runs the script with workflow_dispatch. --- .github/workflows/vm_size_report.yml | 108 ++ CHANGELOG.md | 1 + devops/scripts/vm_size_catalogue.txt | 1499 +++++++++++++++++++++++ devops/scripts/vm_size_report.py | 368 ++++++ devops/tests/test_vm_size_report.py | 389 ++++++ devops/version.txt | 2 +- docs/tre-admins/vm-size-availability.md | 77 ++ mkdocs.yml | 1 + 8 files changed, 2444 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/vm_size_report.yml create mode 100644 devops/scripts/vm_size_catalogue.txt create mode 100644 devops/scripts/vm_size_report.py create mode 100644 devops/tests/test_vm_size_report.py create mode 100644 docs/tre-admins/vm-size-availability.md diff --git a/.github/workflows/vm_size_report.yml b/.github/workflows/vm_size_report.yml new file mode 100644 index 0000000000..81b6952cea --- /dev/null +++ b/.github/workflows/vm_size_report.yml @@ -0,0 +1,108 @@ +--- +name: VM Size Availability + +on: # yamllint disable-line rule:truthy + workflow_dispatch: + inputs: + region: + description: >- + Region: the Azure region to check. ci-location is the LOCATION variable of the CICD environment. + Select none to check only the regions in More regions. + type: choice + default: ci-location + options: + - ci-location + - switzerlandnorth + - switzerlandwest + - uksouth + - ukwest + - westeurope + - northeurope + - swedencentral + - norwayeast + - germanywestcentral + - francecentral + - italynorth + - polandcentral + - spaincentral + - eastus + - eastus2 + - centralus + - westus2 + - westus3 + - canadacentral + - australiaeast + - japaneast + - southeastasia + - centralindia + - southafricanorth + - brazilsouth + - uaenorth + - none + more_regions: + description: "More regions: other Azure regions to check, separated by commas. For example uksouth,eastus2" + type: string + required: false + default: "" + +permissions: + contents: read + +jobs: + report: + name: Report VM size availability + runs-on: ubuntu-latest + # The federated credential of the CI identity trusts this environment. + environment: CICD + timeout-minutes: 15 + permissions: + contents: read + # Log in to Azure with OIDC. + id-token: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + persist-credentials: false + + - name: Azure Login + uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + environment: ${{ (secrets.AZURE_ENVIRONMENT != '' && secrets.AZURE_ENVIRONMENT) || 'AzureCloud' }} + + - name: Report VM size availability + env: + REGION: ${{ inputs.region }} + MORE_REGIONS: ${{ inputs.more_regions }} + CI_LOCATION: ${{ vars.LOCATION }} + LINK_BASE: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }} + run: | + case "$REGION" in + none) regions="$MORE_REGIONS" ;; + ci-location) + if [ -z "$CI_LOCATION" ]; then + echo "::error::The CICD environment has no LOCATION variable. Select a region." + exit 1 + fi + regions="$CI_LOCATION,$MORE_REGIONS" + ;; + *) regions="$REGION,$MORE_REGIONS" ;; + esac + if [ -z "${regions//[, ]/}" ]; then + echo "::error::Select a region, or type one or more regions in More regions." + exit 1 + fi + # The artifact is public on a public repository, so keep subscription data out of the report. + python3 devops/scripts/vm_size_report.py --region "$regions" --hide-subscription \ + --link-base "$LINK_BASE" --output vm-size-report.md + cat vm-size-report.md >> "$GITHUB_STEP_SUMMARY" + + - name: Upload the report + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: vm-size-report + path: vm-size-report.md + if-no-files-found: error + retention-days: 7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a01bd1e97..80f8a5669b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ See [Legacy Airlock & migration](docs/azure-tre-overview/airlock.md#legacy-airlo * Update template schemas to Draft 2020-12, preserve legacy input restrictions, and support local schema definitions in resource forms. (`API` 0.27.0, `ui` 0.9.0) ([#5005](https://github.com/microsoft/AzureTRE/pull/5005)) * Add weekly and manual builds for Dockerfiles and Porter bundles, with selected pull request builds. Retry a failed target once and report final results. ([#5088](https://github.com/microsoft/AzureTRE/issues/5088)) * Let a fork run CI in a shared subscription with the `CI_ENV_PREFIX` variable and a `ci_repository` tag, which scope cleanup and destruction. Keep a CI environment, for example for a demo, with a `ci_keep_until` tag. (`core` 0.18.15, `devops` 0.7.0, `build-scripts` 1.1.5) ([#5272](https://github.com/microsoft/AzureTRE/pull/5272)) +* Report the VM sizes that the repository uses and their availability in one or more Azure regions, for VMs and Azure ML compute, with `devops/scripts/vm_size_report.py` or the **VM Size Availability** workflow. See [VM size availability](docs/tre-admins/vm-size-availability.md). (`devops` 0.8.0) BUG FIXES: * Update Nexus from 3.94.0 to 3.94.3. The Nexus 3.94.3 image stops trusting the eMudhra certificate chains that Sonatype reports as compromised. (`tre-shared-service-sonatype-nexus` 3.11.3) ([#5276](https://github.com/microsoft/AzureTRE/issues/5276)) diff --git a/devops/scripts/vm_size_catalogue.txt b/devops/scripts/vm_size_catalogue.txt new file mode 100644 index 0000000000..cfe695e044 --- /dev/null +++ b/devops/scripts/vm_size_catalogue.txt @@ -0,0 +1,1499 @@ +# VM sizes that Azure listed in all regions on 2026-10-23. Refresh with: vm_size_report.py --refresh-catalogue +Standard_A1_v2 +Standard_A2_v2 +Standard_A2m_v2 +Standard_A4_v2 +Standard_A4m_v2 +Standard_A8_v2 +Standard_A8m_v2 +Standard_B12ms +Standard_B16als_v2 +Standard_B16as_v2 +Standard_B16ls_v2 +Standard_B16ms +Standard_B16pls_v2 +Standard_B16ps_v2 +Standard_B16s_v2 +Standard_B1ls +Standard_B1ms +Standard_B1s +Standard_B20ms +Standard_B2als_v2 +Standard_B2as_v2 +Standard_B2ats_v2 +Standard_B2ls_v2 +Standard_B2ms +Standard_B2pls_v2 +Standard_B2ps_v2 +Standard_B2pts_v2 +Standard_B2s +Standard_B2s_v2 +Standard_B2ts_v2 +Standard_B32als_v2 +Standard_B32as_v2 +Standard_B32ls_v2 +Standard_B32s_v2 +Standard_B4als_v2 +Standard_B4as_v2 +Standard_B4ls_v2 +Standard_B4ms +Standard_B4pls_v2 +Standard_B4ps_v2 +Standard_B4s_v2 +Standard_B8als_v2 +Standard_B8as_v2 +Standard_B8ls_v2 +Standard_B8ms +Standard_B8pls_v2 +Standard_B8ps_v2 +Standard_B8s_v2 +Standard_D1 +Standard_D11 +Standard_D11_v2 +Standard_D11_v2_Promo +Standard_D12 +Standard_D128ads_v7 +Standard_D128alds_v7 +Standard_D128als_v7 +Standard_D128as_v7 +Standard_D128ds_v6 +Standard_D128ds_v7 +Standard_D128lds_v6 +Standard_D128lds_v7 +Standard_D128ls_v6 +Standard_D128ls_v7 +Standard_D128nds_v6 +Standard_D128nlds_v6 +Standard_D128nls_v6 +Standard_D128ns_v6 +Standard_D128s_v6 +Standard_D128s_v7 +Standard_D12_v2 +Standard_D12_v2_Promo +Standard_D13 +Standard_D13_v2 +Standard_D13_v2_Promo +Standard_D14 +Standard_D14_v2 +Standard_D14_v2_Promo +Standard_D15_v2 +Standard_D160ads_v7 +Standard_D160alds_v7 +Standard_D160als_v7 +Standard_D160as_v7 +Standard_D16_v3 +Standard_D16_v4 +Standard_D16_v5 +Standard_D16a_v4 +Standard_D16ads_v5 +Standard_D16ads_v6 +Standard_D16ads_v7 +Standard_D16alds_v6 +Standard_D16alds_v7 +Standard_D16als_v6 +Standard_D16als_v7 +Standard_D16as_v4 +Standard_D16as_v5 +Standard_D16as_v6 +Standard_D16as_v7 +Standard_D16d_v4 +Standard_D16d_v5 +Standard_D16ds_v4 +Standard_D16ds_v5 +Standard_D16ds_v6 +Standard_D16ds_v7 +Standard_D16lds_v5 +Standard_D16lds_v6 +Standard_D16lds_v7 +Standard_D16ls_v5 +Standard_D16ls_v6 +Standard_D16ls_v7 +Standard_D16nds_v6 +Standard_D16nlds_v6 +Standard_D16nls_v6 +Standard_D16ns_v6 +Standard_D16pds_v5 +Standard_D16pds_v6 +Standard_D16plds_v5 +Standard_D16plds_v6 +Standard_D16pls_v5 +Standard_D16pls_v6 +Standard_D16ps_v5 +Standard_D16ps_v6 +Standard_D16s_v3 +Standard_D16s_v4 +Standard_D16s_v5 +Standard_D16s_v6 +Standard_D16s_v7 +Standard_D192ds_v6 +Standard_D192ds_v7 +Standard_D192lds_v7 +Standard_D192ls_v7 +Standard_D192s_v6 +Standard_D192s_v7 +Standard_D1_v2 +Standard_D2 +Standard_D248ds_v7 +Standard_D248lds_v7 +Standard_D248ls_v7 +Standard_D248s_v7 +Standard_D2_v2 +Standard_D2_v2_Promo +Standard_D2_v3 +Standard_D2_v4 +Standard_D2_v5 +Standard_D2a_v4 +Standard_D2ads_v5 +Standard_D2ads_v6 +Standard_D2ads_v7 +Standard_D2alds_v6 +Standard_D2alds_v7 +Standard_D2als_v6 +Standard_D2als_v7 +Standard_D2as_v4 +Standard_D2as_v5 +Standard_D2as_v6 +Standard_D2as_v7 +Standard_D2d_v4 +Standard_D2d_v5 +Standard_D2ds_v4 +Standard_D2ds_v5 +Standard_D2ds_v6 +Standard_D2ds_v7 +Standard_D2lds_v5 +Standard_D2lds_v6 +Standard_D2lds_v7 +Standard_D2ls_v5 +Standard_D2ls_v6 +Standard_D2ls_v7 +Standard_D2nds_v6 +Standard_D2nlds_v6 +Standard_D2nls_v6 +Standard_D2ns_v6 +Standard_D2pds_v5 +Standard_D2pds_v6 +Standard_D2plds_v5 +Standard_D2plds_v6 +Standard_D2pls_v5 +Standard_D2pls_v6 +Standard_D2ps_v5 +Standard_D2ps_v6 +Standard_D2s_v3 +Standard_D2s_v4 +Standard_D2s_v5 +Standard_D2s_v6 +Standard_D2s_v7 +Standard_D3 +Standard_D32_v3 +Standard_D32_v4 +Standard_D32_v5 +Standard_D32a_v4 +Standard_D32ads_v5 +Standard_D32ads_v6 +Standard_D32ads_v7 +Standard_D32alds_v6 +Standard_D32alds_v7 +Standard_D32als_v6 +Standard_D32als_v7 +Standard_D32as_v4 +Standard_D32as_v5 +Standard_D32as_v6 +Standard_D32as_v7 +Standard_D32d_v4 +Standard_D32d_v5 +Standard_D32ds_v4 +Standard_D32ds_v5 +Standard_D32ds_v6 +Standard_D32ds_v7 +Standard_D32lds_v5 +Standard_D32lds_v6 +Standard_D32lds_v7 +Standard_D32ls_v5 +Standard_D32ls_v6 +Standard_D32ls_v7 +Standard_D32nds_v6 +Standard_D32nlds_v6 +Standard_D32nls_v6 +Standard_D32ns_v6 +Standard_D32pds_v5 +Standard_D32pds_v6 +Standard_D32plds_v5 +Standard_D32plds_v6 +Standard_D32pls_v5 +Standard_D32pls_v6 +Standard_D32ps_v5 +Standard_D32ps_v6 +Standard_D32s_v3 +Standard_D32s_v4 +Standard_D32s_v5 +Standard_D32s_v6 +Standard_D32s_v7 +Standard_D372ds_v7 +Standard_D372s_v7 +Standard_D3_v2 +Standard_D3_v2_Promo +Standard_D4 +Standard_D48_v3 +Standard_D48_v4 +Standard_D48_v5 +Standard_D48a_v4 +Standard_D48ads_v5 +Standard_D48ads_v6 +Standard_D48ads_v7 +Standard_D48alds_v6 +Standard_D48alds_v7 +Standard_D48als_v6 +Standard_D48als_v7 +Standard_D48as_v4 +Standard_D48as_v5 +Standard_D48as_v6 +Standard_D48as_v7 +Standard_D48d_v4 +Standard_D48d_v5 +Standard_D48ds_v4 +Standard_D48ds_v5 +Standard_D48ds_v6 +Standard_D48ds_v7 +Standard_D48lds_v5 +Standard_D48lds_v6 +Standard_D48lds_v7 +Standard_D48ls_v5 +Standard_D48ls_v6 +Standard_D48ls_v7 +Standard_D48nds_v6 +Standard_D48nlds_v6 +Standard_D48nls_v6 +Standard_D48ns_v6 +Standard_D48pds_v5 +Standard_D48pds_v6 +Standard_D48plds_v5 +Standard_D48plds_v6 +Standard_D48pls_v5 +Standard_D48pls_v6 +Standard_D48ps_v5 +Standard_D48ps_v6 +Standard_D48s_v3 +Standard_D48s_v4 +Standard_D48s_v5 +Standard_D48s_v6 +Standard_D48s_v7 +Standard_D4_v2 +Standard_D4_v2_Promo +Standard_D4_v3 +Standard_D4_v4 +Standard_D4_v5 +Standard_D4a_v4 +Standard_D4ads_v5 +Standard_D4ads_v6 +Standard_D4ads_v7 +Standard_D4alds_v6 +Standard_D4alds_v7 +Standard_D4als_v6 +Standard_D4als_v7 +Standard_D4as_v4 +Standard_D4as_v5 +Standard_D4as_v6 +Standard_D4as_v7 +Standard_D4d_v4 +Standard_D4d_v5 +Standard_D4ds_v4 +Standard_D4ds_v5 +Standard_D4ds_v6 +Standard_D4ds_v7 +Standard_D4lds_v5 +Standard_D4lds_v6 +Standard_D4lds_v7 +Standard_D4ls_v5 +Standard_D4ls_v6 +Standard_D4ls_v7 +Standard_D4nds_v6 +Standard_D4nlds_v6 +Standard_D4nls_v6 +Standard_D4ns_v6 +Standard_D4pds_v5 +Standard_D4pds_v6 +Standard_D4plds_v5 +Standard_D4plds_v6 +Standard_D4pls_v5 +Standard_D4pls_v6 +Standard_D4ps_v5 +Standard_D4ps_v6 +Standard_D4s_v3 +Standard_D4s_v4 +Standard_D4s_v5 +Standard_D4s_v6 +Standard_D4s_v7 +Standard_D5_v2 +Standard_D5_v2_Promo +Standard_D64_v3 +Standard_D64_v4 +Standard_D64_v5 +Standard_D64a_v4 +Standard_D64ads_v5 +Standard_D64ads_v6 +Standard_D64ads_v7 +Standard_D64alds_v6 +Standard_D64alds_v7 +Standard_D64als_v6 +Standard_D64als_v7 +Standard_D64as_v4 +Standard_D64as_v5 +Standard_D64as_v6 +Standard_D64as_v7 +Standard_D64d_v4 +Standard_D64d_v5 +Standard_D64ds_v4 +Standard_D64ds_v5 +Standard_D64ds_v6 +Standard_D64ds_v7 +Standard_D64lds_v5 +Standard_D64lds_v6 +Standard_D64lds_v7 +Standard_D64ls_v5 +Standard_D64ls_v6 +Standard_D64ls_v7 +Standard_D64nds_v6 +Standard_D64nlds_v6 +Standard_D64nls_v6 +Standard_D64ns_v6 +Standard_D64pds_v5 +Standard_D64pds_v6 +Standard_D64plds_v5 +Standard_D64plds_v6 +Standard_D64pls_v5 +Standard_D64pls_v6 +Standard_D64ps_v5 +Standard_D64ps_v6 +Standard_D64s_v3 +Standard_D64s_v4 +Standard_D64s_v5 +Standard_D64s_v6 +Standard_D64s_v7 +Standard_D8_v3 +Standard_D8_v4 +Standard_D8_v5 +Standard_D8a_v4 +Standard_D8ads_v5 +Standard_D8ads_v6 +Standard_D8ads_v7 +Standard_D8alds_v6 +Standard_D8alds_v7 +Standard_D8als_v6 +Standard_D8als_v7 +Standard_D8as_v4 +Standard_D8as_v5 +Standard_D8as_v6 +Standard_D8as_v7 +Standard_D8d_v4 +Standard_D8d_v5 +Standard_D8ds_v4 +Standard_D8ds_v5 +Standard_D8ds_v6 +Standard_D8ds_v7 +Standard_D8lds_v5 +Standard_D8lds_v6 +Standard_D8lds_v7 +Standard_D8ls_v5 +Standard_D8ls_v6 +Standard_D8ls_v7 +Standard_D8nds_v6 +Standard_D8nlds_v6 +Standard_D8nls_v6 +Standard_D8ns_v6 +Standard_D8pds_v5 +Standard_D8pds_v6 +Standard_D8plds_v5 +Standard_D8plds_v6 +Standard_D8pls_v5 +Standard_D8pls_v6 +Standard_D8ps_v5 +Standard_D8ps_v6 +Standard_D8s_v3 +Standard_D8s_v4 +Standard_D8s_v5 +Standard_D8s_v6 +Standard_D8s_v7 +Standard_D96_v5 +Standard_D96a_v4 +Standard_D96ads_v5 +Standard_D96ads_v6 +Standard_D96ads_v7 +Standard_D96alds_v6 +Standard_D96alds_v7 +Standard_D96als_v6 +Standard_D96als_v7 +Standard_D96as_v4 +Standard_D96as_v5 +Standard_D96as_v6 +Standard_D96as_v7 +Standard_D96d_v5 +Standard_D96ds_v5 +Standard_D96ds_v6 +Standard_D96ds_v7 +Standard_D96lds_v5 +Standard_D96lds_v6 +Standard_D96lds_v7 +Standard_D96ls_v5 +Standard_D96ls_v6 +Standard_D96ls_v7 +Standard_D96nds_v6 +Standard_D96nlds_v6 +Standard_D96nls_v6 +Standard_D96ns_v6 +Standard_D96pds_v6 +Standard_D96plds_v6 +Standard_D96pls_v6 +Standard_D96ps_v6 +Standard_D96s_v5 +Standard_D96s_v6 +Standard_D96s_v7 +Standard_DC128eds_v6 +Standard_DC128es_v6 +Standard_DC16ads_cc_v5 +Standard_DC16ads_v5 +Standard_DC16ads_v6 +Standard_DC16as_cc_v5 +Standard_DC16as_v5 +Standard_DC16as_v6 +Standard_DC16ds_v3 +Standard_DC16eds_v6 +Standard_DC16es_v6 +Standard_DC16s_v3 +Standard_DC1ds_v3 +Standard_DC1s_v3 +Standard_DC24ds_v3 +Standard_DC24s_v3 +Standard_DC2ads_v5 +Standard_DC2ads_v6 +Standard_DC2as_v5 +Standard_DC2as_v6 +Standard_DC2ds_v3 +Standard_DC2eds_v6 +Standard_DC2es_v6 +Standard_DC2s_v3 +Standard_DC32ads_cc_v5 +Standard_DC32ads_v5 +Standard_DC32ads_v6 +Standard_DC32as_cc_v5 +Standard_DC32as_v5 +Standard_DC32as_v6 +Standard_DC32ds_v3 +Standard_DC32eds_v6 +Standard_DC32es_v6 +Standard_DC32s_v3 +Standard_DC48ads_cc_v5 +Standard_DC48ads_v5 +Standard_DC48ads_v6 +Standard_DC48as_cc_v5 +Standard_DC48as_v5 +Standard_DC48as_v6 +Standard_DC48ds_v3 +Standard_DC48eds_v6 +Standard_DC48es_v6 +Standard_DC48s_v3 +Standard_DC4ads_cc_v5 +Standard_DC4ads_v5 +Standard_DC4ads_v6 +Standard_DC4as_cc_v5 +Standard_DC4as_v5 +Standard_DC4as_v6 +Standard_DC4ds_v3 +Standard_DC4eds_v6 +Standard_DC4es_v6 +Standard_DC4s_v3 +Standard_DC64ads_cc_v5 +Standard_DC64ads_v5 +Standard_DC64ads_v6 +Standard_DC64as_cc_v5 +Standard_DC64as_v5 +Standard_DC64as_v6 +Standard_DC64eds_v6 +Standard_DC64es_v6 +Standard_DC8ads_cc_v5 +Standard_DC8ads_v5 +Standard_DC8ads_v6 +Standard_DC8as_cc_v5 +Standard_DC8as_v5 +Standard_DC8as_v6 +Standard_DC8ds_v3 +Standard_DC8eds_v6 +Standard_DC8es_v6 +Standard_DC8s_v3 +Standard_DC96ads_cc_v5 +Standard_DC96ads_v5 +Standard_DC96ads_v6 +Standard_DC96as_cc_v5 +Standard_DC96as_v5 +Standard_DC96as_v6 +Standard_DC96eds_v6 +Standard_DC96es_v6 +Standard_DS1 +Standard_DS11 +Standard_DS11-1_v2 +Standard_DS11_v2 +Standard_DS11_v2_Promo +Standard_DS12 +Standard_DS12-1_v2 +Standard_DS12-2_v2 +Standard_DS12_v2 +Standard_DS12_v2_Promo +Standard_DS13 +Standard_DS13-2_v2 +Standard_DS13-4_v2 +Standard_DS13_v2 +Standard_DS13_v2_Promo +Standard_DS14 +Standard_DS14-4_v2 +Standard_DS14-8_v2 +Standard_DS14_v2 +Standard_DS14_v2_Promo +Standard_DS15_v2 +Standard_DS1_v2 +Standard_DS2 +Standard_DS2_v2 +Standard_DS2_v2_Promo +Standard_DS3 +Standard_DS3_v2 +Standard_DS3_v2_Promo +Standard_DS4 +Standard_DS4_v2 +Standard_DS4_v2_Promo +Standard_DS5_v2 +Standard_DS5_v2_Promo +Standard_E104i_v5 +Standard_E104id_v5 +Standard_E104ids_v5 +Standard_E104is_v5 +Standard_E112iads_v5 +Standard_E112ias_v5 +Standard_E112ibds_v5 +Standard_E112ibs_v5 +Standard_E128-32ads_v7 +Standard_E128-32as_v7 +Standard_E128-32ds_v6 +Standard_E128-32s_v6 +Standard_E128-64ads_v7 +Standard_E128-64as_v7 +Standard_E128-64ds_v6 +Standard_E128-64s_v6 +Standard_E128ads_v7 +Standard_E128as_v7 +Standard_E128ds_v6 +Standard_E128ds_v7 +Standard_E128nds_v6 +Standard_E128ns_v6 +Standard_E128s_v6 +Standard_E128s_v7 +Standard_E16-4ads_v5 +Standard_E16-4ads_v7 +Standard_E16-4as_v4 +Standard_E16-4as_v5 +Standard_E16-4as_v7 +Standard_E16-4ds_v4 +Standard_E16-4ds_v5 +Standard_E16-4ds_v6 +Standard_E16-4s_v3 +Standard_E16-4s_v4 +Standard_E16-4s_v5 +Standard_E16-4s_v6 +Standard_E16-8ads_v5 +Standard_E16-8ads_v7 +Standard_E16-8as_v4 +Standard_E16-8as_v5 +Standard_E16-8as_v7 +Standard_E16-8ds_v4 +Standard_E16-8ds_v5 +Standard_E16-8ds_v6 +Standard_E16-8s_v3 +Standard_E16-8s_v4 +Standard_E16-8s_v5 +Standard_E16-8s_v6 +Standard_E160ads_v7 +Standard_E160as_v7 +Standard_E16_v3 +Standard_E16_v4 +Standard_E16_v5 +Standard_E16a_v4 +Standard_E16ads_v5 +Standard_E16ads_v6 +Standard_E16ads_v7 +Standard_E16as_v4 +Standard_E16as_v5 +Standard_E16as_v6 +Standard_E16as_v7 +Standard_E16bds_v5 +Standard_E16bs_v5 +Standard_E16d_v4 +Standard_E16d_v5 +Standard_E16ds_v4 +Standard_E16ds_v5 +Standard_E16ds_v6 +Standard_E16ds_v7 +Standard_E16nds_v6 +Standard_E16ns_v6 +Standard_E16pds_v5 +Standard_E16pds_v6 +Standard_E16ps_v5 +Standard_E16ps_v6 +Standard_E16s_v3 +Standard_E16s_v4 +Standard_E16s_v5 +Standard_E16s_v6 +Standard_E16s_v7 +Standard_E192ds_v7 +Standard_E192ids_v6 +Standard_E192is_v6 +Standard_E192s_v7 +Standard_E20_v3 +Standard_E20_v4 +Standard_E20_v5 +Standard_E20a_v4 +Standard_E20ads_v5 +Standard_E20ads_v6 +Standard_E20as_v4 +Standard_E20as_v5 +Standard_E20as_v6 +Standard_E20d_v4 +Standard_E20d_v5 +Standard_E20ds_v4 +Standard_E20ds_v5 +Standard_E20ds_v6 +Standard_E20ds_v7 +Standard_E20pds_v5 +Standard_E20ps_v5 +Standard_E20s_v3 +Standard_E20s_v4 +Standard_E20s_v5 +Standard_E20s_v6 +Standard_E20s_v7 +Standard_E248ds_v7 +Standard_E248s_v7 +Standard_E2_v3 +Standard_E2_v4 +Standard_E2_v5 +Standard_E2a_v4 +Standard_E2ads_v5 +Standard_E2ads_v6 +Standard_E2ads_v7 +Standard_E2as_v4 +Standard_E2as_v5 +Standard_E2as_v6 +Standard_E2as_v7 +Standard_E2bds_v5 +Standard_E2bs_v5 +Standard_E2d_v4 +Standard_E2d_v5 +Standard_E2ds_v4 +Standard_E2ds_v5 +Standard_E2ds_v6 +Standard_E2ds_v7 +Standard_E2nds_v6 +Standard_E2ns_v6 +Standard_E2pds_v5 +Standard_E2pds_v6 +Standard_E2ps_v5 +Standard_E2ps_v6 +Standard_E2s_v3 +Standard_E2s_v4 +Standard_E2s_v5 +Standard_E2s_v6 +Standard_E2s_v7 +Standard_E32-16ads_v5 +Standard_E32-16ads_v7 +Standard_E32-16as_v4 +Standard_E32-16as_v5 +Standard_E32-16as_v7 +Standard_E32-16ds_v4 +Standard_E32-16ds_v5 +Standard_E32-16ds_v6 +Standard_E32-16s_v3 +Standard_E32-16s_v4 +Standard_E32-16s_v5 +Standard_E32-16s_v6 +Standard_E32-8ads_v5 +Standard_E32-8ads_v7 +Standard_E32-8as_v4 +Standard_E32-8as_v5 +Standard_E32-8as_v7 +Standard_E32-8ds_v4 +Standard_E32-8ds_v5 +Standard_E32-8ds_v6 +Standard_E32-8s_v3 +Standard_E32-8s_v4 +Standard_E32-8s_v5 +Standard_E32-8s_v6 +Standard_E32_v3 +Standard_E32_v4 +Standard_E32_v5 +Standard_E32a_v4 +Standard_E32ads_v5 +Standard_E32ads_v6 +Standard_E32ads_v7 +Standard_E32as_v4 +Standard_E32as_v5 +Standard_E32as_v6 +Standard_E32as_v7 +Standard_E32bds_v5 +Standard_E32bs_v5 +Standard_E32d_v4 +Standard_E32d_v5 +Standard_E32ds_v4 +Standard_E32ds_v5 +Standard_E32ds_v6 +Standard_E32ds_v7 +Standard_E32nds_v6 +Standard_E32ns_v6 +Standard_E32pds_v5 +Standard_E32pds_v6 +Standard_E32ps_v5 +Standard_E32ps_v6 +Standard_E32s_v3 +Standard_E32s_v4 +Standard_E32s_v5 +Standard_E32s_v6 +Standard_E32s_v7 +Standard_E372ids_v7 +Standard_E372is_v7 +Standard_E4-2ads_v5 +Standard_E4-2ads_v7 +Standard_E4-2as_v4 +Standard_E4-2as_v5 +Standard_E4-2as_v7 +Standard_E4-2ds_v4 +Standard_E4-2ds_v5 +Standard_E4-2ds_v6 +Standard_E4-2s_v3 +Standard_E4-2s_v4 +Standard_E4-2s_v5 +Standard_E4-2s_v6 +Standard_E48_v3 +Standard_E48_v4 +Standard_E48_v5 +Standard_E48a_v4 +Standard_E48ads_v5 +Standard_E48ads_v6 +Standard_E48ads_v7 +Standard_E48as_v4 +Standard_E48as_v5 +Standard_E48as_v6 +Standard_E48as_v7 +Standard_E48bds_v5 +Standard_E48bs_v5 +Standard_E48d_v4 +Standard_E48d_v5 +Standard_E48ds_v4 +Standard_E48ds_v5 +Standard_E48ds_v6 +Standard_E48ds_v7 +Standard_E48nds_v6 +Standard_E48ns_v6 +Standard_E48pds_v6 +Standard_E48ps_v6 +Standard_E48s_v3 +Standard_E48s_v4 +Standard_E48s_v5 +Standard_E48s_v6 +Standard_E48s_v7 +Standard_E4_v3 +Standard_E4_v4 +Standard_E4_v5 +Standard_E4a_v4 +Standard_E4ads_v5 +Standard_E4ads_v6 +Standard_E4ads_v7 +Standard_E4as_v4 +Standard_E4as_v5 +Standard_E4as_v6 +Standard_E4as_v7 +Standard_E4bds_v5 +Standard_E4bs_v5 +Standard_E4d_v4 +Standard_E4d_v5 +Standard_E4ds_v4 +Standard_E4ds_v5 +Standard_E4ds_v6 +Standard_E4ds_v7 +Standard_E4nds_v6 +Standard_E4ns_v6 +Standard_E4pds_v5 +Standard_E4pds_v6 +Standard_E4ps_v5 +Standard_E4ps_v6 +Standard_E4s_v3 +Standard_E4s_v4 +Standard_E4s_v5 +Standard_E4s_v6 +Standard_E4s_v7 +Standard_E64-16ads_v5 +Standard_E64-16ads_v7 +Standard_E64-16as_v4 +Standard_E64-16as_v5 +Standard_E64-16as_v7 +Standard_E64-16ds_v4 +Standard_E64-16ds_v5 +Standard_E64-16ds_v6 +Standard_E64-16s_v3 +Standard_E64-16s_v4 +Standard_E64-16s_v5 +Standard_E64-16s_v6 +Standard_E64-32ads_v5 +Standard_E64-32ads_v7 +Standard_E64-32as_v4 +Standard_E64-32as_v5 +Standard_E64-32as_v7 +Standard_E64-32ds_v4 +Standard_E64-32ds_v5 +Standard_E64-32ds_v6 +Standard_E64-32s_v3 +Standard_E64-32s_v4 +Standard_E64-32s_v5 +Standard_E64-32s_v6 +Standard_E64_v3 +Standard_E64_v4 +Standard_E64_v5 +Standard_E64a_v4 +Standard_E64ads_v5 +Standard_E64ads_v6 +Standard_E64ads_v7 +Standard_E64as_v4 +Standard_E64as_v5 +Standard_E64as_v6 +Standard_E64as_v7 +Standard_E64bds_v5 +Standard_E64bs_v5 +Standard_E64d_v4 +Standard_E64d_v5 +Standard_E64ds_v4 +Standard_E64ds_v5 +Standard_E64ds_v6 +Standard_E64ds_v7 +Standard_E64nds_v6 +Standard_E64ns_v6 +Standard_E64pds_v6 +Standard_E64ps_v6 +Standard_E64s_v3 +Standard_E64s_v4 +Standard_E64s_v5 +Standard_E64s_v6 +Standard_E64s_v7 +Standard_E8-2ads_v5 +Standard_E8-2ads_v7 +Standard_E8-2as_v4 +Standard_E8-2as_v5 +Standard_E8-2as_v7 +Standard_E8-2ds_v4 +Standard_E8-2ds_v5 +Standard_E8-2ds_v6 +Standard_E8-2s_v3 +Standard_E8-2s_v4 +Standard_E8-2s_v5 +Standard_E8-2s_v6 +Standard_E8-4ads_v5 +Standard_E8-4ads_v7 +Standard_E8-4as_v4 +Standard_E8-4as_v5 +Standard_E8-4as_v7 +Standard_E8-4ds_v4 +Standard_E8-4ds_v5 +Standard_E8-4ds_v6 +Standard_E8-4s_v3 +Standard_E8-4s_v4 +Standard_E8-4s_v5 +Standard_E8-4s_v6 +Standard_E80ids_v4 +Standard_E80is_v4 +Standard_E8_v3 +Standard_E8_v4 +Standard_E8_v5 +Standard_E8a_v4 +Standard_E8ads_v5 +Standard_E8ads_v6 +Standard_E8ads_v7 +Standard_E8as_v4 +Standard_E8as_v5 +Standard_E8as_v6 +Standard_E8as_v7 +Standard_E8bds_v5 +Standard_E8bs_v5 +Standard_E8d_v4 +Standard_E8d_v5 +Standard_E8ds_v4 +Standard_E8ds_v5 +Standard_E8ds_v6 +Standard_E8ds_v7 +Standard_E8nds_v6 +Standard_E8ns_v6 +Standard_E8pds_v5 +Standard_E8pds_v6 +Standard_E8ps_v5 +Standard_E8ps_v6 +Standard_E8s_v3 +Standard_E8s_v4 +Standard_E8s_v5 +Standard_E8s_v6 +Standard_E8s_v7 +Standard_E96-24ads_v5 +Standard_E96-24ads_v6 +Standard_E96-24ads_v7 +Standard_E96-24as_v4 +Standard_E96-24as_v5 +Standard_E96-24as_v7 +Standard_E96-24ds_v5 +Standard_E96-24ds_v6 +Standard_E96-24s_v5 +Standard_E96-24s_v6 +Standard_E96-48ads_v5 +Standard_E96-48ads_v6 +Standard_E96-48ads_v7 +Standard_E96-48as_v4 +Standard_E96-48as_v5 +Standard_E96-48as_v7 +Standard_E96-48ds_v5 +Standard_E96-48ds_v6 +Standard_E96-48s_v5 +Standard_E96-48s_v6 +Standard_E96_v5 +Standard_E96a_v4 +Standard_E96ads_v5 +Standard_E96ads_v6 +Standard_E96ads_v7 +Standard_E96as_v4 +Standard_E96as_v5 +Standard_E96as_v6 +Standard_E96as_v7 +Standard_E96bds_v5 +Standard_E96bs_v5 +Standard_E96d_v5 +Standard_E96ds_v5 +Standard_E96ds_v6 +Standard_E96ds_v7 +Standard_E96ias_v4 +Standard_E96nds_v6 +Standard_E96ns_v6 +Standard_E96pds_v6 +Standard_E96ps_v6 +Standard_E96s_v5 +Standard_E96s_v6 +Standard_E96s_v7 +Standard_EC16ads_cc_v5 +Standard_EC16ads_v5 +Standard_EC16ads_v6 +Standard_EC16as_cc_v5 +Standard_EC16as_v5 +Standard_EC16as_v6 +Standard_EC16eds_v6 +Standard_EC16es_v6 +Standard_EC20ads_cc_v5 +Standard_EC20ads_v5 +Standard_EC20as_cc_v5 +Standard_EC20as_v5 +Standard_EC2ads_v5 +Standard_EC2ads_v6 +Standard_EC2as_v5 +Standard_EC2as_v6 +Standard_EC2eds_v6 +Standard_EC2es_v6 +Standard_EC32ads_cc_v5 +Standard_EC32ads_v5 +Standard_EC32ads_v6 +Standard_EC32as_cc_v5 +Standard_EC32as_v5 +Standard_EC32as_v6 +Standard_EC32eds_v6 +Standard_EC32es_v6 +Standard_EC48ads_cc_v5 +Standard_EC48ads_v5 +Standard_EC48ads_v6 +Standard_EC48as_cc_v5 +Standard_EC48as_v5 +Standard_EC48as_v6 +Standard_EC48eds_v6 +Standard_EC48es_v6 +Standard_EC4ads_cc_v5 +Standard_EC4ads_v5 +Standard_EC4ads_v6 +Standard_EC4as_cc_v5 +Standard_EC4as_v5 +Standard_EC4as_v6 +Standard_EC4eds_v6 +Standard_EC4es_v6 +Standard_EC64ads_cc_v5 +Standard_EC64ads_v5 +Standard_EC64ads_v6 +Standard_EC64as_cc_v5 +Standard_EC64as_v5 +Standard_EC64as_v6 +Standard_EC64eds_v6 +Standard_EC64es_v6 +Standard_EC8ads_cc_v5 +Standard_EC8ads_v5 +Standard_EC8ads_v6 +Standard_EC8as_cc_v5 +Standard_EC8as_v5 +Standard_EC8as_v6 +Standard_EC8eds_v6 +Standard_EC8es_v6 +Standard_EC96ads_cc_v5 +Standard_EC96ads_v5 +Standard_EC96ads_v6 +Standard_EC96as_cc_v5 +Standard_EC96as_v5 +Standard_EC96as_v6 +Standard_EC96iads_v5 +Standard_EC96ias_v5 +Standard_F1 +Standard_F16 +Standard_F16-4amds_v7 +Standard_F16-4ams_v7 +Standard_F16-8amds_v7 +Standard_F16-8ams_v7 +Standard_F16ads_v7 +Standard_F16alds_v7 +Standard_F16als_v6 +Standard_F16als_v7 +Standard_F16amds_v7 +Standard_F16ams_v6 +Standard_F16ams_v7 +Standard_F16as_v6 +Standard_F16as_v7 +Standard_F16s +Standard_F16s_v2 +Standard_F1ads_v7 +Standard_F1alds_v7 +Standard_F1als_v7 +Standard_F1amds_v7 +Standard_F1ams_v7 +Standard_F1as_v7 +Standard_F1s +Standard_F2 +Standard_F2-1amds_v7 +Standard_F2-1ams_v7 +Standard_F2ads_v7 +Standard_F2alds_v7 +Standard_F2als_v6 +Standard_F2als_v7 +Standard_F2amds_v7 +Standard_F2ams_v6 +Standard_F2ams_v7 +Standard_F2as_v6 +Standard_F2as_v7 +Standard_F2s +Standard_F2s_v2 +Standard_F32-16amds_v7 +Standard_F32-16ams_v7 +Standard_F32-8amds_v7 +Standard_F32-8ams_v7 +Standard_F32ads_v7 +Standard_F32alds_v7 +Standard_F32als_v6 +Standard_F32als_v7 +Standard_F32amds_v7 +Standard_F32ams_v6 +Standard_F32ams_v7 +Standard_F32as_v6 +Standard_F32as_v7 +Standard_F32s_v2 +Standard_F4 +Standard_F4-1amds_v7 +Standard_F4-1ams_v7 +Standard_F4-2amds_v7 +Standard_F4-2ams_v7 +Standard_F48ads_v7 +Standard_F48alds_v7 +Standard_F48als_v6 +Standard_F48als_v7 +Standard_F48amds_v7 +Standard_F48ams_v6 +Standard_F48ams_v7 +Standard_F48as_v6 +Standard_F48as_v7 +Standard_F48s_v2 +Standard_F4ads_v7 +Standard_F4alds_v7 +Standard_F4als_v6 +Standard_F4als_v7 +Standard_F4amds_v7 +Standard_F4ams_v6 +Standard_F4ams_v7 +Standard_F4as_v6 +Standard_F4as_v7 +Standard_F4s +Standard_F4s_v2 +Standard_F64-16amds_v7 +Standard_F64-16ams_v7 +Standard_F64-32amds_v7 +Standard_F64-32ams_v7 +Standard_F64ads_v7 +Standard_F64alds_v7 +Standard_F64als_v6 +Standard_F64als_v7 +Standard_F64amds_v7 +Standard_F64ams_v6 +Standard_F64ams_v7 +Standard_F64as_v6 +Standard_F64as_v7 +Standard_F64s_v2 +Standard_F72s_v2 +Standard_F8 +Standard_F8-2amds_v7 +Standard_F8-2ams_v7 +Standard_F8-4amds_v7 +Standard_F8-4ams_v7 +Standard_F80ads_v7 +Standard_F80alds_v7 +Standard_F80als_v7 +Standard_F80amds_v7 +Standard_F80ams_v7 +Standard_F80as_v7 +Standard_F8ads_v7 +Standard_F8alds_v7 +Standard_F8als_v6 +Standard_F8als_v7 +Standard_F8amds_v7 +Standard_F8ams_v6 +Standard_F8ams_v7 +Standard_F8as_v6 +Standard_F8as_v7 +Standard_F8s +Standard_F8s_v2 +Standard_FX12-6mds_v2 +Standard_FX12-6ms_v2 +Standard_FX12mds +Standard_FX12mds_v2 +Standard_FX12ms_v2 +Standard_FX16-4mds_v2 +Standard_FX16-4ms_v2 +Standard_FX16-8mds_v2 +Standard_FX16-8ms_v2 +Standard_FX16mds_v2 +Standard_FX16ms_v2 +Standard_FX24-12mds_v2 +Standard_FX24-12ms_v2 +Standard_FX24-6mds_v2 +Standard_FX24-6ms_v2 +Standard_FX24mds +Standard_FX24mds_v2 +Standard_FX24ms_v2 +Standard_FX2mds_v2 +Standard_FX2ms_v2 +Standard_FX32-16mds_v2 +Standard_FX32-16ms_v2 +Standard_FX32-8mds_v2 +Standard_FX32-8ms_v2 +Standard_FX32mds_v2 +Standard_FX32ms_v2 +Standard_FX36mds +Standard_FX4-2mds_v2 +Standard_FX4-2ms_v2 +Standard_FX48-12mds_v2 +Standard_FX48-12ms_v2 +Standard_FX48-24mds_v2 +Standard_FX48-24ms_v2 +Standard_FX48mds +Standard_FX48mds_v2 +Standard_FX48ms_v2 +Standard_FX4mds +Standard_FX4mds_v2 +Standard_FX4ms_v2 +Standard_FX64-16mds_v2 +Standard_FX64-16ms_v2 +Standard_FX64-32mds_v2 +Standard_FX64-32ms_v2 +Standard_FX64mds_v2 +Standard_FX64ms_v2 +Standard_FX8-2mds_v2 +Standard_FX8-2ms_v2 +Standard_FX8-4mds_v2 +Standard_FX8-4ms_v2 +Standard_FX8mds_v2 +Standard_FX8ms_v2 +Standard_FX96-24mds_v2 +Standard_FX96-24ms_v2 +Standard_FX96-48mds_v2 +Standard_FX96-48ms_v2 +Standard_FX96mds_v2 +Standard_FX96ms_v2 +Standard_G1 +Standard_G2 +Standard_G3 +Standard_G4 +Standard_G5 +Standard_GS1 +Standard_GS2 +Standard_GS3 +Standard_GS4 +Standard_GS4-4 +Standard_GS4-8 +Standard_GS5 +Standard_GS5-16 +Standard_GS5-8 +Standard_HB120-16rs_v2 +Standard_HB120-16rs_v3 +Standard_HB120-32rs_v2 +Standard_HB120-32rs_v3 +Standard_HB120-64rs_v2 +Standard_HB120-64rs_v3 +Standard_HB120-96rs_v2 +Standard_HB120-96rs_v3 +Standard_HB120rs_v2 +Standard_HB120rs_v3 +Standard_HB176-144rs_v4 +Standard_HB176-24rs_v4 +Standard_HB176-48rs_v4 +Standard_HB176-96rs_v4 +Standard_HB176rs_v4 +Standard_HB368-144rs_v5 +Standard_HB368-192rs_v5 +Standard_HB368-240rs_v5 +Standard_HB368-288rs_v5 +Standard_HB368-336rs_v5 +Standard_HB368-48rs_v5 +Standard_HB368-96rs_v5 +Standard_HB368rs_v5 +Standard_HC44-16rs +Standard_HC44-32rs +Standard_HC44rs +Standard_HX176-144rs +Standard_HX176-24rs +Standard_HX176-48rs +Standard_HX176-96rs +Standard_HX176rs +Standard_L128aos_v5 +Standard_L128as_v5 +Standard_L12aos_v4 +Standard_L12aos_v5 +Standard_L160iaos_v5 +Standard_L160ias_v5 +Standard_L16aos_v4 +Standard_L16aos_v5 +Standard_L16as_v3 +Standard_L16as_v4 +Standard_L16as_v5 +Standard_L16s +Standard_L16s_v2 +Standard_L16s_v3 +Standard_L16s_v4 +Standard_L24aos_v4 +Standard_L24aos_v5 +Standard_L2aos_v4 +Standard_L2aos_v5 +Standard_L2as_v4 +Standard_L2as_v5 +Standard_L2s_v4 +Standard_L32aos_v4 +Standard_L32aos_v5 +Standard_L32as_v3 +Standard_L32as_v4 +Standard_L32as_v5 +Standard_L32s +Standard_L32s_v2 +Standard_L32s_v3 +Standard_L32s_v4 +Standard_L48aos_v5 +Standard_L48as_v3 +Standard_L48as_v4 +Standard_L48as_v5 +Standard_L48s_v2 +Standard_L48s_v3 +Standard_L48s_v4 +Standard_L4aos_v4 +Standard_L4aos_v5 +Standard_L4as_v4 +Standard_L4as_v5 +Standard_L4s +Standard_L4s_v4 +Standard_L64aos_v5 +Standard_L64as_v3 +Standard_L64as_v4 +Standard_L64as_v5 +Standard_L64s_v2 +Standard_L64s_v3 +Standard_L64s_v4 +Standard_L80as_v3 +Standard_L80as_v4 +Standard_L80as_v5 +Standard_L80s_v2 +Standard_L80s_v3 +Standard_L80s_v4 +Standard_L8aos_v4 +Standard_L8aos_v5 +Standard_L8as_v3 +Standard_L8as_v4 +Standard_L8as_v5 +Standard_L8s +Standard_L8s_v2 +Standard_L8s_v3 +Standard_L8s_v4 +Standard_L96aos_v5 +Standard_L96as_v4 +Standard_L96as_v5 +Standard_L96s_v4 +Standard_M128 +Standard_M128-32ms +Standard_M128-64bds_3_v3 +Standard_M128-64bds_v3 +Standard_M128-64bs_v3 +Standard_M128-64ms +Standard_M128bds_3_v3 +Standard_M128bds_v3 +Standard_M128bs_v3 +Standard_M128dms_v2 +Standard_M128ds_v2 +Standard_M128m +Standard_M128ms +Standard_M128ms_v2 +Standard_M128s +Standard_M128s_v2 +Standard_M12ds_v3 +Standard_M12s_v3 +Standard_M16-4ms +Standard_M16-8ms +Standard_M16bds_v3 +Standard_M16bs_v3 +Standard_M16ms +Standard_M16s_v3 +Standard_M176-88bds_4_v3 +Standard_M176-88bds_v3 +Standard_M176-88bs_v3 +Standard_M176bds_4_v3 +Standard_M176bds_v3 +Standard_M176bs_v3 +Standard_M176ds_3_v3 +Standard_M176ds_4_v3 +Standard_M176s_3_v3 +Standard_M176s_4_v3 +Standard_M192idms_v2 +Standard_M192ids_v2 +Standard_M192ims_v2 +Standard_M192is_v2 +Standard_M208ms_v2 +Standard_M208s_v2 +Standard_M24ds_v3 +Standard_M24s_v3 +Standard_M32-16ms +Standard_M32-8ms +Standard_M32bds_v3 +Standard_M32bs_v3 +Standard_M32dms_v2 +Standard_M32ls +Standard_M32ms +Standard_M32ms_v2 +Standard_M32ts +Standard_M32ts_v3 +Standard_M416-208ms_v2 +Standard_M416-208s_v2 +Standard_M416bs_v3 +Standard_M416ds_10_v3 +Standard_M416ds_12_v3 +Standard_M416ds_6_v3 +Standard_M416ds_8_v3 +Standard_M416ds_9_v3 +Standard_M416ms_v2 +Standard_M416s_10_v2 +Standard_M416s_10_v3 +Standard_M416s_12_v3 +Standard_M416s_6_v3 +Standard_M416s_8_v2 +Standard_M416s_8_v3 +Standard_M416s_9_v2 +Standard_M416s_9_v3 +Standard_M416s_v2 +Standard_M48bds_v3 +Standard_M48bs_v3 +Standard_M48ds_1_v3 +Standard_M48s_1_v3 +Standard_M624ds_12_v3 +Standard_M624s_12_v3 +Standard_M64 +Standard_M64-16ms +Standard_M64-32bds_1_v3 +Standard_M64-32ms +Standard_M64bds_1_v3 +Standard_M64bds_v3 +Standard_M64bs_v3 +Standard_M64dms_v2 +Standard_M64ds_v2 +Standard_M64ls +Standard_M64m +Standard_M64ms +Standard_M64ms_v2 +Standard_M64s +Standard_M64s_v2 +Standard_M8-2ms +Standard_M8-4ms +Standard_M832ds_12_v3 +Standard_M832ids_16_v3 +Standard_M832is_16_v3 +Standard_M832s_12_v3 +Standard_M8ms +Standard_M96-48bds_2_v3 +Standard_M96bds_2_v3 +Standard_M96bds_v3 +Standard_M96bs_v3 +Standard_M96ds_1_v3 +Standard_M96ds_2_v3 +Standard_M96s_1_v3 +Standard_M96s_2_v3 +Standard_NC12s_v3 +Standard_NC144ds_xl_RTXPRO6000BSE_v6 +Standard_NC144lds_xl_RTXPRO6000BSE_v6 +Standard_NC16ads_A10_v4 +Standard_NC16as_T4_v3 +Standard_NC24ads_A100_v4 +Standard_NC24lds_xl_RTXPRO6000BSE_v6 +Standard_NC24rs_v3 +Standard_NC24s_v3 +Standard_NC288ds_xl_RTXPRO6000BSE_v6 +Standard_NC288lds_xl_RTXPRO6000BSE_v6 +Standard_NC32ads_A10_v4 +Standard_NC36ds_xl_RTXPRO6000BSE_v6 +Standard_NC36lds_xl_RTXPRO6000BSE_v6 +Standard_NC40ads_H100_v5 +Standard_NC48ads_A100_v4 +Standard_NC4as_T4_v3 +Standard_NC64as_T4_v3 +Standard_NC6s_v3 +Standard_NC72ds_xl_RTXPRO6000BSE_v6 +Standard_NC72lds_xl_RTXPRO6000BSE_v6 +Standard_NC80adis_H100_v5 +Standard_NC8ads_A10_v4 +Standard_NC8as_T4_v3 +Standard_NC96ads_A100_v4 +Standard_NCC40ads_H100_v5 +Standard_ND128isr_GB300_v6 +Standard_ND128isr_NDR_GB200_v6 +Standard_ND40rs_v2 +Standard_ND96amsr_A100_v4 +Standard_ND96asr_v4 +Standard_ND96is_MI300X_v5 +Standard_ND96isr_H100_v5 +Standard_ND96isr_H200_v5 +Standard_ND96isr_MI300X_v5 +Standard_NG16ads_V620_v1 +Standard_NG32adms_V620_v1 +Standard_NG32ads_V620_v1 +Standard_NG8ads_V620_v1 +Standard_NP10s +Standard_NP20s +Standard_NP40s +Standard_NV12ads_A10_v5 +Standard_NV12ads_V710_v5 +Standard_NV12s_v2 +Standard_NV12s_v3 +Standard_NV16as_v4 +Standard_NV18ads_A10_v5 +Standard_NV24ads_V710_v5 +Standard_NV24s_v2 +Standard_NV24s_v3 +Standard_NV32as_v4 +Standard_NV36adms_A10_v5 +Standard_NV36ads_A10_v5 +Standard_NV48s_v3 +Standard_NV4ads_V710_v5 +Standard_NV4as_v4 +Standard_NV6ads_A10_v5 +Standard_NV6s_v2 +Standard_NV72ads_A10_v5 +Standard_NV8ads_V710_v5 +Standard_NV8as_v4 +Standard_PB6s diff --git a/devops/scripts/vm_size_report.py b/devops/scripts/vm_size_report.py new file mode 100644 index 0000000000..cee485863e --- /dev/null +++ b/devops/scripts/vm_size_report.py @@ -0,0 +1,368 @@ +"""Report the VM sizes that the repository references and their availability in Azure regions. + +Examples: + python3 devops/scripts/vm_size_report.py --region switzerlandnorth + python3 devops/scripts/vm_size_report.py --region switzerlandnorth,uksouth --output vm-size-report.md + python3 devops/scripts/vm_size_report.py # no Azure login: catalogue check only + python3 devops/scripts/vm_size_report.py --refresh-catalogue # rewrite the catalogue of all VM sizes +""" + +import argparse +from collections import Counter, namedtuple +import datetime +import json +from pathlib import Path +import re +import subprocess +import sys +from urllib.parse import quote + +SCRIPT = Path(__file__).resolve() +CATALOGUE = SCRIPT.with_name("vm_size_catalogue.txt") +# The scan skips the files of this tool. The catalogue lists all sizes and the tests use example sizes. +OWN_FILES = {SCRIPT, CATALOGUE, SCRIPT.parents[1] / "tests" / "test_vm_size_report.py"} +# After the prefix, a VM size has a family that starts with a capital letter, and a vCPU count. +# This keeps out Standard_LRS, Standard_v2 and identifiers such as basic_workspace_request. +# The word boundary keeps out database SKUs such as GP_Standard_D2ds_v4, which are not VM SKUs. +VM_SIZE = re.compile(r"\b(?i:standard|basic)_[A-Z][A-Za-z]*[0-9][A-Za-z0-9_-]*") +REGION = re.compile(r"[a-z0-9]+") +# Keep only the fields that the report uses. The full output for all regions is too large. +SKU_FIELDS = ( + "[].{name: name, location: locations[0], restrictions: restrictions, " + "vCPUs: capabilities[?name=='vCPUs'].value | [0], memoryGB: capabilities[?name=='MemoryGB'].value | [0]}" +) +# Azure ML has its own list of sizes for each region, and does not use the VM restrictions of the subscription. +AML_API_VERSION = "2025-04-01" +AML_FIELDS = "value[].{name: name, vCPUs: vCPUs, memoryGB: memoryGB, computeTypes: supportedComputeTypes}" +# The services that use the sizes. The Azure ML keys are compute types. +SERVICES = {"vm": "VM", "AmlCompute": "AML cluster", "ComputeInstance": "AML instance"} +Reference = namedtuple("Reference", "path line size") +# The report shows the categories in this order, so that problems come first. +CATEGORIES = { + "unknown": ( + "❓", + "Unknown name", + "The name is not in the Azure catalogue. The size is retired or the name is wrong.", + ), + "blocked": ("⛔", "Blocked", "The region has the size, but the subscription cannot use it."), + "not offered": ("❌", "Not offered", "The region does not have the size."), + "zones blocked": ("⚠️", "Some zones blocked", "The subscription can use the size, but not in the zones shown."), + "not checked": ("➖", "Not checked", "The script could not get the Azure ML sizes of the region."), + "available": ("✅", "Available", "The subscription can use the size in the region."), + "listed": ("✔️", "In catalogue", "The name is in the Azure catalogue. No region was checked."), +} +KINDS = ("code", "sample", "test", "docs") + + +def az(args, subscription=None): + """Run an Azure CLI command and return its JSON output.""" + command = ["az", *args, "--output", "json"] + if subscription: + command += ["--subscription", subscription] + return json.loads(subprocess.run(command, check=True, capture_output=True, text=True).stdout) + + +def list_skus(region=None, subscription=None): + """Return the VM SKUs of one region, or of all regions. The restrictions apply to the subscription.""" + location = ["--location", region] if region else [] + return az( + ["vm", "list-skus", *location, "--resource-type", "virtualMachines", "--all", "--query", SKU_FIELDS], + subscription, + ) + + +def region_skus(regions, subscription=None): + """Return the SKUs of each region by lowercase name. One query for all regions is faster than one per region.""" + skus = list_skus(regions[0] if len(regions) == 1 else None, subscription) + result = {region: {} for region in regions} + for sku in skus: + location = (sku.get("location") or "").lower() + if location in result: + result[location][sku["name"].lower()] = sku + return result + + +def aml_sizes(region, subscription_id): + """Return the Azure ML sizes of a region by lowercase name, or None if Azure ML does not answer.""" + url = f"/subscriptions/{subscription_id}/providers/Microsoft.MachineLearningServices/locations/{region}/vmSizes" + try: + sizes = az(["rest", "--method", "get", "--url", f"{url}?api-version={AML_API_VERSION}", "--query", AML_FIELDS]) + except subprocess.CalledProcessError as error: + message = (error.stderr or "").strip()[:300] + print(f"Warning: the script could not get the Azure ML sizes of {region}: {message}", file=sys.stderr) + return None + return {size["name"].lower(): size for size in sizes} + + +def parse_regions(values): + """Return the regions from values such as "Switzerland North, uksouth", in order and without duplicates.""" + regions = [] + for value in values: + for item in value.split(","): + region = item.replace(" ", "").lower() + if region and region not in regions: + if not REGION.fullmatch(region): + raise ValueError(f"{item.strip()!r} is not an Azure region name.") + regions.append(region) + return regions + + +def refresh_catalogue(path, subscription=None): + """Write the names of the VM sizes that Azure lists in all regions, and return the number of names.""" + names = sorted({sku["name"] for sku in list_skus(subscription=subscription)}, key=str.lower) + if not names: + raise ValueError("Azure listed no VM sizes. The catalogue did not change.") + today = datetime.date.today().isoformat() + header = ( + f"# VM sizes that Azure listed in all regions on {today}. Refresh with: vm_size_report.py --refresh-catalogue\n" + ) + path.write_text(header + "\n".join(names) + "\n", encoding="utf-8") + return len(names) + + +def read_catalogue(path): + """Return the refresh date of the catalogue, and a map from the lowercase name to the name.""" + lines = [line.strip() for line in path.read_text(encoding="utf-8").splitlines()] + date = re.search(r"\d{4}-\d{2}-\d{2}", next((line for line in lines if line.startswith("#")), "")) + return (date.group() if date else None), {line.lower(): line for line in lines if line and not line.startswith("#")} + + +def reference_kind(path): + """Return the kind of file, so that the report can separate deployed values from examples.""" + parts = Path(path).parts + if parts[0] == "e2e_tests" or parts[-1].startswith("test_") or any(part.startswith("tests") for part in parts[:-1]): + return "test" + if parts[0] == "api_http_requests" or ".sample" in parts[-1]: + return "sample" + if parts[0] == "docs" or parts[-1].endswith(".md"): + return "docs" + return "code" + + +def reference_service(path): + """Return the service that uses the sizes in a file: "vm", or the Azure ML compute type.""" + parts = Path(path).parts + if "aml_compute" in parts or re.search(r"(^|_)aml[._]", parts[-1]): + return "ComputeInstance" + if "azureml" in parts: + return "AmlCompute" + return "vm" + + +def find_references(repo, exclude=()): + """Return the VM size references in the tracked text files, by lowercase size name.""" + files = subprocess.run(["git", "-C", str(repo), "ls-files", "-z"], check=True, capture_output=True, text=True) + references = {} + for name in filter(None, files.stdout.split("\0")): + path = repo / name + # Git also tracks the target of a symlink, so a symlink would only give duplicate references. + if path.is_symlink() or not path.is_file() or path.resolve() in exclude: + continue + data = path.read_bytes() + if b"\0" in data: + continue + # Split on newlines only, so that the line numbers are the same as on GitHub. + for number, line in enumerate(data.decode("utf-8", errors="replace").split("\n"), start=1): + for match in VM_SIZE.finditer(line): + size = match.group().rstrip("_-") + references.setdefault(size.lower(), []).append(Reference(name, number, size)) + return references + + +def region_status(sku): + """Return the category and the cell text of a size that the region lists.""" + restrictions = sku.get("restrictions") or [] + if any(item["type"] == "Location" for item in restrictions): + return "blocked", "blocked" + zones = sorted( + { + zone + for item in restrictions + if item["type"] == "Zone" + for zone in (item.get("restrictionInfo") or {}).get("zones") or [] + } + ) + if zones: + return "zones blocked", f"{'zone' if len(zones) == 1 else 'zones'} {', '.join(zones)} blocked" + return "available", "available" + + +def size_status(key, skus, catalogue): + """Return the category and the cell text of a size. If skus is None, use only the catalogue.""" + if skus is not None and key in skus: + return region_status(skus[key]) + if key not in catalogue: + return "unknown", "unknown name" + if skus is None: + return "listed", "in catalogue" + return "not offered", "not offered" + + +def aml_status(key, sizes, compute_type, catalogue): + """Return the category and the cell text of a size for an Azure ML compute type in a region.""" + if key not in catalogue: + return "unknown", "unknown name" + if sizes is None: + return "not checked", "not checked" + compute_types = (sizes.get(key) or {}).get("computeTypes") or [] + if compute_type in compute_types: + return "available", "available" + return "not offered", "not offered" + + +def cell(status): + category, text = status + return f"{CATEGORIES[category][0]} {text}" + + +def number(value): + """Return a number as the VM SKU list shows it, for example 7 and not 7.0.""" + return f"{value:g}" if isinstance(value, float) else str(value or "") + + +def render(references, catalogue, regions=None, skus=None, aml=None, account=None, catalogue_date=None, link_base=None): + """Return the report as Markdown. Without regions, the report checks the names against the catalogue only.""" + columns = regions or ["catalogue"] + # A size that a region lists is real, even if the catalogue is older than the size. + known = dict(catalogue) + for region_data in [*(skus or {}).values(), *(aml or {}).values()]: + known.update({key: size["name"] for key, size in (region_data or {}).items()}) + + # A size gets one row for each service that uses it, because Azure ML has its own list of sizes. + groups = {} + for key, refs in references.items(): + for ref in refs: + groups.setdefault((key, reference_service(ref.path)), []).append(ref) + + entries = [] + for (key, service), refs in groups.items(): + if regions and service != "vm": + sources = [(aml or {}).get(region) for region in regions] + statuses = [aml_status(key, source, service, known) for source in sources] + else: + sources = [skus[region] for region in regions] if regions else [None] + statuses = [size_status(key, source, known) for source in sources] + size = next((source[key] for source in sources if source and key in source), None) + name = known.get(key, refs[0].size) + kinds = Counter(reference_kind(ref.path) for ref in refs) + worst = min(list(CATEGORIES).index(category) for category, _ in statuses) + order = (worst, "code" not in kinds, name.lower(), list(SERVICES).index(service)) + entries.append((order, name, SERVICES[service], statuses, size, kinds, refs)) + entries.sort(key=lambda entry: entry[0]) + + lines = ["# VM size availability" if regions else "# VM sizes in the repository", ""] + if regions: + lines.append(f"- Regions: {', '.join(regions)}") + if account: + lines.append(f"- Subscription: {account['name']}") + refreshed = f", refreshed {catalogue_date}" if catalogue_date else "" + places = sum(len(refs) for refs in references.values()) + lines += [ + f"- Date: {datetime.date.today().isoformat()}", + f"- Catalogue: {len(catalogue)} VM sizes{refreshed}", + f"- Referenced VM sizes: {len(references)}, in {places} places", + "", + "| Status | " + " | ".join(columns) + " |", + "| --- |" + " --- |" * len(columns), + ] + counts = [Counter(entry[3][index][0] for entry in entries) for index in range(len(columns))] + for category, (icon, label, _) in CATEGORIES.items(): + if any(count[category] for count in counts): + lines.append(f"| {icon} {label} | " + " | ".join(str(count[category]) for count in counts) + " |") + + size_columns = ["vCPUs", "Memory (GB)"] if regions else [] + header = ["VM size", "Service", *size_columns, *columns, "References"] + lines += ["", "| " + " | ".join(header) + " |", "|" + " --- |" * len(header)] + for _, name, service, statuses, size, kinds, _ in entries: + sizes = [number((size or {}).get("vCPUs")), number((size or {}).get("memoryGB"))] if regions else [] + summary = ", ".join(f"{kind} {kinds[kind]}" for kind in KINDS if kinds[kind]) + lines.append("| " + " | ".join([f"`{name}`", service, *sizes, *map(cell, statuses), summary]) + " |") + + used = {category for count in counts for category in count} + lines += ["", "Status key:", ""] + lines += [ + f"- {icon} **{label}**: {meaning}" + for category, (icon, label, meaning) in CATEGORIES.items() + if category in used + ] + if regions and any(entry[2] != SERVICES["vm"] for entry in entries): + lines += [ + "", + "AML rows use the Azure ML list of sizes for the region and the compute type. " + "Azure ML does not use the VM restrictions of the subscription.", + ] + lines += ["", "
", f"References for {len(references)} VM sizes"] + for _, name, service, _, _, _, refs in entries: + lines += ["", f"### `{name}` ({service})", ""] + for ref in refs: + location = f"`{ref.path}:{ref.line}`" + if link_base: + location = f"[{location}]({link_base.rstrip('/')}/{quote(ref.path)}#L{ref.line})" + lines.append(f"- {location} ({reference_kind(ref.path)})") + lines += ["", "
"] + return "\n".join(lines) + "\n" + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument( + "--region", + action="append", + default=[], + help="Azure region, for example switzerlandnorth. Separate more regions with commas, or give the option " + "again. If you do not give a region, the script checks the names against the catalogue only.", + ) + parser.add_argument("--subscription", help="Subscription name or ID. The default is the Azure CLI subscription.") + parser.add_argument( + "--hide-subscription", + action="store_true", + help="Do not put the subscription name in the report, for example in a public CI artifact.", + ) + parser.add_argument("--repo", type=Path, default=SCRIPT.parents[2], help="Repository root.") + parser.add_argument("--catalogue", type=Path, default=CATALOGUE, help="File with the names of all VM sizes.") + parser.add_argument("--output", type=Path, help="Write the Markdown report to this file.") + parser.add_argument("--link-base", help="URL that the report puts in front of each file path, to make links.") + parser.add_argument( + "--refresh-catalogue", + action="store_true", + help="Query all regions, write the catalogue and stop. This takes about 1.5 minutes.", + ) + args = parser.parse_args(argv) + try: + regions = parse_regions(args.region) + except ValueError as error: + parser.error(str(error)) + if args.region and not regions: + parser.error("--region has no region name.") + + skus = aml = account = None + try: + if args.refresh_catalogue: + count = refresh_catalogue(args.catalogue, args.subscription) + print(f"Wrote {count} VM sizes to {args.catalogue}", file=sys.stderr) + return + catalogue_date, catalogue = read_catalogue(args.catalogue) + references = find_references(args.repo, OWN_FILES | {args.catalogue.resolve()}) + if regions: + skus = region_skus(regions, args.subscription) + empty = [region for region in regions if not skus[region]] + if empty: + sys.exit(f"Azure lists no VM sizes in {', '.join(empty)}. Check the region names.") + account = az(["account", "show"], args.subscription) + if any(reference_service(ref.path) != "vm" for refs in references.values() for ref in refs): + aml = {region: aml_sizes(region, account["id"]) for region in regions} + except subprocess.CalledProcessError as error: + sys.exit(f"{error.cmd[0]} failed: {(error.stderr or '').strip()}") + except (OSError, ValueError) as error: + sys.exit(str(error)) + + shown_account = None if args.hide_subscription else account + report = render(references, catalogue, regions, skus, aml, shown_account, catalogue_date, args.link_base) + if args.output: + args.output.write_text(report, encoding="utf-8") + else: + sys.stdout.write(report) + + +if __name__ == "__main__": + main() diff --git a/devops/tests/test_vm_size_report.py b/devops/tests/test_vm_size_report.py new file mode 100644 index 0000000000..e919a71884 --- /dev/null +++ b/devops/tests/test_vm_size_report.py @@ -0,0 +1,389 @@ +"""Find the VM sizes in the repository and report their availability in Azure regions.""" + +import datetime +import io +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest +from unittest.mock import patch + +SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" +sys.path.insert(0, str(SCRIPTS)) +import vm_size_report # noqa: E402 +from vm_size_report import ( # noqa: E402 + CATALOGUE, + OWN_FILES, + VM_SIZE, + Reference, + find_references, + parse_regions, + read_catalogue, + reference_kind, + reference_service, + refresh_catalogue, + region_skus, + size_status, +) + + +def sku(name, location="switzerlandnorth", *restrictions): + return {"name": name, "location": location, "restrictions": list(restrictions), "vCPUs": "2", "memoryGB": "4"} + + +def git_repo(directory, files): + repo = Path(directory) + for name, content in files.items(): + path = repo / name + path.parent.mkdir(parents=True, exist_ok=True) + if isinstance(content, bytes): + path.write_bytes(content) + else: + path.write_text(content) + subprocess.run(["git", "init", "-q", str(repo)], check=True) + subprocess.run(["git", "-C", str(repo), "add", *files], check=True) + return repo + + +def table_rows(report): + return [ + [cell.strip() for cell in line.strip("|").split("|")] for line in report.splitlines() if line.startswith("| `") + ] + + +class PatternTests(unittest.TestCase): + def test_finds_vm_sizes_in_any_case(self): + line = 'sizes = ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0"]' + self.assertEqual( + [match.group() for match in VM_SIZE.finditer(line)], + ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0"], + ) + + def test_skips_skus_that_are_not_vm_sizes(self): + line = ( + "Standard_LRS Standard_GRS Standard_v2 basic_workspace_request basic_resource_template " + "GP_Standard_D2ds_v4 B_Standard_B1ms MO_Standard_E2ds_v4" + ) + self.assertEqual(list(VM_SIZE.finditer(line)), []) + + +class RegionTests(unittest.TestCase): + def test_accepts_display_names_lists_and_repeated_options(self): + self.assertEqual( + parse_regions(["Switzerland North, uksouth", "UKSouth,,eastus2 "]), + ["switzerlandnorth", "uksouth", "eastus2"], + ) + + def test_rejects_names_that_are_not_regions(self): + for value in ("uk-south", "eastus;whoami", "$(id)"): + with self.subTest(value=value), self.assertRaises(ValueError): + parse_regions([value]) + + def test_one_region_uses_a_location_filter(self): + with patch.object(vm_size_report, "az", return_value=[sku("Standard_B2s")]) as az: + result = region_skus(["switzerlandnorth"]) + self.assertIn("--location", az.call_args.args[0]) + self.assertEqual(list(result["switzerlandnorth"]), ["standard_b2s"]) + + def test_more_regions_use_one_query_and_ignore_the_case_of_locations(self): + skus = [sku("Standard_B2s", "SwitzerlandNorth"), sku("Standard_B2s", "uksouth"), sku("Standard_B2s", "eastus")] + with patch.object(vm_size_report, "az", return_value=skus) as az: + result = region_skus(["switzerlandnorth", "uksouth"]) + self.assertEqual(az.call_count, 1) + self.assertNotIn("--location", az.call_args.args[0]) + self.assertEqual( + {region: list(data) for region, data in result.items()}, + {"switzerlandnorth": ["standard_b2s"], "uksouth": ["standard_b2s"]}, + ) + + +class StatusTests(unittest.TestCase): + catalogue = {"standard_b2s": "Standard_B2s", "standard_d4s_v5": "Standard_D4s_v5"} + + def test_location_restriction_blocks_the_size(self): + restrictions = ({"type": "Location"}, {"type": "Zone", "restrictionInfo": {"zones": ["1", "2", "3"]}}) + skus = {"standard_b2s": sku("Standard_B2s", "switzerlandnorth", *restrictions)} + self.assertEqual(size_status("standard_b2s", skus, self.catalogue), ("blocked", "blocked")) + + def test_zone_restriction_names_the_zones(self): + restriction = {"type": "Zone", "restrictionInfo": {"zones": ["3", "1"]}} + skus = {"standard_b2s": sku("Standard_B2s", "switzerlandnorth", restriction)} + self.assertEqual(size_status("standard_b2s", skus, self.catalogue), ("zones blocked", "zones 1, 3 blocked")) + + def test_size_without_restrictions_is_available(self): + skus = {"standard_b2s": sku("Standard_B2s")} + self.assertEqual(size_status("standard_b2s", skus, self.catalogue), ("available", "available")) + + def test_catalogue_separates_regional_gaps_from_wrong_names(self): + self.assertEqual(size_status("standard_d4s_v5", {}, self.catalogue), ("not offered", "not offered")) + self.assertEqual(size_status("standard_ds2_v3", {}, self.catalogue), ("unknown", "unknown name")) + + def test_without_a_region_the_catalogue_decides(self): + self.assertEqual(size_status("standard_b2s", None, self.catalogue)[0], "listed") + self.assertEqual(size_status("standard_a1", None, self.catalogue)[0], "unknown") + + +class ScanTests(unittest.TestCase): + def test_reference_kind_separates_deployed_values_from_examples(self): + cases = { + "core/terraform/variables.tf": "code", + "templates/shared_services/admin-vm/template_schema.json": "code", + "e2e_tests/resources/aml.py": "test", + "api_app/tests_ma/test_services/test_schema_service.py": "test", + "devops/tests/test_bootstrap.py": "test", + "config.sample.yaml": "sample", + "templates/workspace_services/azureml/user_resources/aml_compute/.env.sample": "sample", + "api_http_requests/API User Journey.http": "sample", + "docs/tre-admins/environment-variables.md": "docs", + "CHANGELOG.md": "docs", + } + self.assertEqual({path: reference_kind(path) for path in cases}, cases) + + def test_scans_each_tracked_text_file_once_with_github_line_numbers(self): + with tempfile.TemporaryDirectory() as directory: + repo = git_repo( + directory, + { + "main.tf": 'size = "Standard_B2s"\n\nsku = "STANDARD_B2S"\n', + "catalogue.txt": "Standard_B2s\nStandard_D4s_v5\n", + "image.png": b"\x89PNG\r\n\x1a\n\0\0Standard_D4s_v5", + # Not UTF-8, and a form feed that GitHub does not count as a new line. + "latin1.tf": b'# caf\xe9\fend\nsize = "Standard_D2s_v5"\n', + }, + ) + (repo / "link.tf").symlink_to("main.tf") + subprocess.run(["git", "-C", str(repo), "add", "link.tf"], check=True) + (repo / "untracked.tf").write_text('size = "Standard_D8s_v5"\n') + references = find_references(repo, {(repo / "catalogue.txt").resolve()}) + self.assertEqual( + references, + { + "standard_b2s": [Reference("main.tf", 1, "Standard_B2s"), Reference("main.tf", 3, "STANDARD_B2S")], + "standard_d2s_v5": [Reference("latin1.tf", 2, "Standard_D2s_v5")], + }, + ) + + def test_scan_skips_the_files_of_this_tool(self): + self.assertIn(Path(__file__).resolve(), OWN_FILES) + self.assertTrue(all(path.is_file() for path in OWN_FILES)) + + +class ServiceTests(unittest.TestCase): + def test_azure_ml_files_use_the_azure_ml_compute_type(self): + cases = { + "templates/workspace_services/azureml/terraform/compute.tf": "AmlCompute", + "templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml": "ComputeInstance", + "e2e_tests/resources/aml.py": "ComputeInstance", + "e2e_tests/unit_tests/test_aml_lifecycle.py": "ComputeInstance", + "templates/shared_services/sonatype-nexus-vm/porter.yaml": "vm", + "e2e_tests/resources/nexus.py": "vm", + "templates/workspace_services/guacamole/user_resources/guacamole-azure-windowsvm/porter.yaml": "vm", + } + self.assertEqual({path: reference_service(path) for path in cases}, cases) + + +class AzureMlReportTests(unittest.TestCase): + files = { + "templates/workspace_services/azureml/terraform/compute.tf": 'vmSize = "Standard_DS2_v2"\n', + "templates/workspace_services/azureml/user_resources/aml_compute/porter.yaml": ( + 'default: "Standard_D2_v3"\nother: "Standard_B2s"\n' + ), + "templates/shared_services/admin-vm/porter.yaml": 'default: "Standard_DS2_v2"\n', + "catalogue.txt": "Standard_B2s\nStandard_D2_v3\nStandard_DS2_v2\n", + } + + def run_report(self, aml_error=None): + def fake_az(command, subscription=None): + if command[0] == "account": + return {"name": "Test subscription", "id": "0000"} + if command[0] == "rest": + if aml_error: + raise aml_error + return [ + {"name": "Standard_DS2_v2", "vCPUs": 2, "memoryGB": 7.0, "computeTypes": ["AmlCompute"]}, + {"name": "Standard_D2_v3", "vCPUs": 2, "memoryGB": 8.0, "computeTypes": ["ComputeInstance"]}, + ] + return [ + sku("Standard_DS2_v2", "switzerlandnorth", {"type": "Location"}), + sku("Standard_B2s"), + sku("Standard_D2_v3"), + ] + + with tempfile.TemporaryDirectory() as directory: + repo = git_repo(directory, self.files) + with ( + patch.object(vm_size_report, "az", side_effect=fake_az) as az, + patch("sys.stdout", new_callable=io.StringIO) as output, + patch("sys.stderr", new_callable=io.StringIO) as errors, + ): + vm_size_report.main( + ["--region", "switzerlandnorth", "--repo", str(repo), "--catalogue", str(repo / "catalogue.txt")] + ) + return output.getvalue(), errors.getvalue(), az + + def test_azure_ml_rows_use_the_azure_ml_list_of_sizes(self): + report, _, az = self.run_report() + self.assertIn( + "/subscriptions/0000/providers/Microsoft.MachineLearningServices/locations/switzerlandnorth/", + az.call_args_list[-1].args[0][4], + ) + self.assertEqual( + [[row[0], row[1], row[2], row[3], row[4]] for row in table_rows(report)], + [ + ["`Standard_DS2_v2`", "VM", "2", "4", "⛔ blocked"], + ["`Standard_B2s`", "AML instance", "", "", "❌ not offered"], + ["`Standard_D2_v3`", "AML instance", "2", "8", "✅ available"], + ["`Standard_DS2_v2`", "AML cluster", "2", "7", "✅ available"], + ], + ) + self.assertIn("### `Standard_DS2_v2` (AML cluster)", report) + + def test_azure_ml_error_marks_the_rows_not_checked(self): + error = subprocess.CalledProcessError(1, ["az", "rest"], stderr="ERROR: NoRegisteredProviderFound\n") + report, errors, _ = self.run_report(aml_error=error) + self.assertIn("could not get the Azure ML sizes of switzerlandnorth: ERROR: NoRegisteredProviderFound", errors) + self.assertEqual( + [[row[0], row[1], row[4]] for row in table_rows(report)], + [ + ["`Standard_DS2_v2`", "VM", "⛔ blocked"], + ["`Standard_B2s`", "AML instance", "➖ not checked"], + ["`Standard_D2_v3`", "AML instance", "➖ not checked"], + ["`Standard_DS2_v2`", "AML cluster", "➖ not checked"], + ], + ) + + +class CatalogueTests(unittest.TestCase): + def test_catalogue_gives_the_refresh_date_and_the_names(self): + with tempfile.TemporaryDirectory() as directory: + path = Path(directory) / "catalogue.txt" + path.write_text("# VM sizes that Azure listed in all regions on 2026-10-23.\nStandard_B2s\n\n") + self.assertEqual(read_catalogue(path), ("2026-10-23", {"standard_b2s": "Standard_B2s"})) + + def test_every_catalogue_name_matches_the_pattern(self): + _, names = read_catalogue(CATALOGUE) + self.assertGreater(len(names), 1000) + self.assertEqual([name for name in names.values() if not VM_SIZE.fullmatch(name)], []) + + def test_refresh_writes_a_catalogue_that_read_catalogue_reads(self): + skus = [sku("Standard_D4s_v5", "uksouth"), sku("Standard_B2s"), sku("Standard_D4s_v5")] + with tempfile.TemporaryDirectory() as directory, patch.object(vm_size_report, "az", return_value=skus): + path = Path(directory) / "catalogue.txt" + self.assertEqual(refresh_catalogue(path), 2) + date, names = read_catalogue(path) + self.assertEqual(date, datetime.date.today().isoformat()) + self.assertEqual(list(names.values()), ["Standard_B2s", "Standard_D4s_v5"]) + + def test_refresh_keeps_the_catalogue_if_azure_lists_nothing(self): + with tempfile.TemporaryDirectory() as directory, patch.object(vm_size_report, "az", return_value=[]): + path = Path(directory) / "catalogue.txt" + path.write_text("Standard_B2s\n") + with self.assertRaises(ValueError): + refresh_catalogue(path) + self.assertEqual(path.read_text(), "Standard_B2s\n") + + +class ReportTests(unittest.TestCase): + files = { + "main.tf": 'a = "Standard_D4s_v5"\nb = "Standard_B2s"\nc = "Standard_DS2_v3"\nd = "Standard_D8s_v5"\n', + "docs/sizes.md": "Use `Standard_B2s` or `Standard_E2s_v5`.\n", + "api_http_requests/API User Journey.http": '"vm_size": "Standard_A1"\n', + "catalogue.txt": "# Refreshed on 2026-10-23\nStandard_B2s\nStandard_D4s_v5\nStandard_D8s_v5\nStandard_E2s_v5\n", + } + + def run_report(self, *args, skus=(), az_error=None): + def fake_az(command, subscription=None): + if az_error: + raise az_error + return {"name": "Test subscription", "id": "0000"} if command[0] == "account" else list(skus) + + with tempfile.TemporaryDirectory() as directory: + repo = git_repo(directory, self.files) + with ( + patch.object(vm_size_report, "az", side_effect=fake_az) as az, + patch("sys.stdout", new_callable=io.StringIO) as output, + ): + vm_size_report.main([*args, "--repo", str(repo), "--catalogue", str(repo / "catalogue.txt")]) + return output.getvalue(), az + + def test_region_report_shows_problems_first_and_code_before_docs(self): + skus = [ + sku("Standard_B2s", "switzerlandnorth", {"type": "Location"}), + sku("Standard_D4s_v5", "switzerlandnorth"), + sku("Standard_D4s_v5", "uksouth"), + sku("Standard_B2s", "uksouth"), + sku("Standard_E2s_v5", "uksouth"), + sku("Standard_D8s_v5", "uksouth"), + ] + report, az = self.run_report("--region", "Switzerland North,uksouth", skus=skus) + + self.assertEqual(az.call_count, 2) + self.assertEqual( + [[row[0], row[1], row[4], row[5], row[6]] for row in table_rows(report)], + [ + ["`Standard_DS2_v3`", "VM", "❓ unknown name", "❓ unknown name", "code 1"], + ["`Standard_A1`", "VM", "❓ unknown name", "❓ unknown name", "sample 1"], + ["`Standard_B2s`", "VM", "⛔ blocked", "✅ available", "code 1, docs 1"], + ["`Standard_D8s_v5`", "VM", "❌ not offered", "✅ available", "code 1"], + ["`Standard_E2s_v5`", "VM", "❌ not offered", "✅ available", "docs 1"], + ["`Standard_D4s_v5`", "VM", "✅ available", "✅ available", "code 1"], + ], + ) + self.assertIn("| ⛔ Blocked | 1 | 0 |", report) + self.assertIn("- Catalogue: 4 VM sizes, refreshed 2026-10-23", report) + self.assertIn("- Subscription: Test subscription\n", report) + self.assertNotIn("0000", report) + + def test_hide_subscription_leaves_the_subscription_out(self): + report, az = self.run_report("--region", "switzerlandnorth", "--hide-subscription", skus=[sku("Standard_B2s")]) + self.assertEqual([call.args[0][0] for call in az.call_args_list], ["vm", "account"]) + self.assertNotIn("Subscription", report) + + def test_report_without_a_region_needs_no_azure_login(self): + report, az = self.run_report() + az.assert_not_called() + self.assertEqual( + [[row[0], row[2]] for row in table_rows(report)], + [ + ["`Standard_DS2_v3`", "❓ unknown name"], + ["`Standard_A1`", "❓ unknown name"], + ["`Standard_B2s`", "✔️ in catalogue"], + ["`Standard_D4s_v5`", "✔️ in catalogue"], + ["`Standard_D8s_v5`", "✔️ in catalogue"], + ["`Standard_E2s_v5`", "✔️ in catalogue"], + ], + ) + + def test_link_base_makes_links_to_the_lines(self): + report, _ = self.run_report("--link-base", "https://github.com/org/repo/blob/abc123/") + self.assertIn( + "- [`api_http_requests/API User Journey.http:1`]" + "(https://github.com/org/repo/blob/abc123/api_http_requests/API%20User%20Journey.http#L1) (sample)", + report, + ) + + def test_region_without_vm_sizes_stops_the_report(self): + with self.assertRaises(SystemExit) as stop: + self.run_report("--region", "switzerlandnorth,nowhere", skus=[sku("Standard_B2s")]) + self.assertEqual(str(stop.exception), "Azure lists no VM sizes in nowhere. Check the region names.") + + def test_azure_cli_error_shows_its_message(self): + error = subprocess.CalledProcessError(1, ["az", "vm"], stderr="ERROR: Please run 'az login'.\n") + with self.assertRaises(SystemExit) as stop: + self.run_report("--region", "switzerlandnorth", az_error=error) + self.assertEqual(str(stop.exception), "az failed: ERROR: Please run 'az login'.") + + def test_invalid_or_empty_region_stops_before_azure(self): + for value in ("eastus;whoami", " , "): + with ( + self.subTest(value=value), + patch("sys.stderr", new_callable=io.StringIO), + self.assertRaises(SystemExit) as stop, + ): + self.run_report("--region", value) + self.assertEqual(stop.exception.code, 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/devops/version.txt b/devops/version.txt index 49e0fc1e09..777f190df0 100644 --- a/devops/version.txt +++ b/devops/version.txt @@ -1 +1 @@ -__version__ = "0.7.0" +__version__ = "0.8.0" diff --git a/docs/tre-admins/vm-size-availability.md b/docs/tre-admins/vm-size-availability.md new file mode 100644 index 0000000000..291db0af5e --- /dev/null +++ b/docs/tre-admins/vm-size-availability.md @@ -0,0 +1,77 @@ +# VM Size Availability + +Azure does not offer all VM sizes in all regions. Azure can also block a size for a subscription in a region. If a template uses a size that the region does not offer, the deployment fails. + +The script `devops/scripts/vm_size_report.py` finds each VM size in the repository. Then it shows the status of each size in one or more regions, for your subscription. + +## Run the script by hand + +You need: + +- A clone of the repository. The script reads the files that git tracks. +- Python 3 and the Azure CLI. The [development container](setup-instructions/prerequisites.md#development-container) has both. +- The Reader role on the subscription. + +1. Log in to Azure with `az login`. +1. Select the subscription with `az account set --subscription `. You can also give the script the option `--subscription `. +1. In the repository root, run the script with one or more regions: + + ```bash + python3 devops/scripts/vm_size_report.py --region switzerlandnorth --output vm-size-report.md + ``` + +To check more than one region, separate the regions with commas, for example `--region switzerlandnorth,uksouth`. One region takes about 1 minute. More regions take about 1.5 minutes in total, because the script gets the data for all regions in one query. + +If you do not give a region, the script checks the names against the catalogue only. It does not use Azure. + +## Run the GitHub workflow + +1. In GitHub, open **Actions** and select **VM Size Availability**. +1. Select **Run workflow**. +1. In **Region**, select a region. The default `ci-location` is the `LOCATION` variable of the `CICD` environment. +1. To check more regions, type them in **More regions**, separated by commas. To check only these regions, select `none` in **Region**. + +You can also start the workflow with the GitHub CLI: + +```bash +gh workflow run vm_size_report.yml -f region=none -f more_regions=uksouth,eastus2 +``` + +The workflow logs in to Azure with the identity of the `CICD` environment. The report shows on the summary page of the run. The report is also in the `vm-size-report` artifact for 7 days. The workflow leaves the subscription out of the report, because anyone can see the run of a public repository. + +GitHub shows the workflow in **Actions** only when the workflow file is on the default branch. + +## Read the report + +The report has a column for each region. Problems come first. In each status, sizes that the code uses come before sizes that only samples, tests or documents use. + +The **Service** column shows what uses the size: + +- **VM**: a virtual machine or a scale set. The script uses the VM SKU list of the region, with the restrictions for your subscription. +- **AML cluster** and **AML instance**: an Azure Machine Learning compute cluster or compute instance. Azure ML has its own list of sizes for each region, and does not use the VM restrictions. The script uses that list. + +A size can have a different status for each service. For example, the VM SKU list can block `Standard_DS2_v2` for your subscription, but Azure ML can still offer it for a compute cluster. + +| Status | Meaning | +| --- | --- | +| ❓ Unknown name | The name is not in the Azure catalogue. The size is retired or the name is wrong. | +| ⛔ Blocked | The region has the size, but the subscription cannot use it. | +| ❌ Not offered | The region does not have the size for this service. | +| ⚠️ Some zones blocked | The subscription can use the size, but not in the zones shown. | +| ➖ Not checked | The script could not get the Azure ML sizes of the region. The script prints the reason. | +| ✅ Available | The subscription can use the size in the region. | +| ✔️ In catalogue | The name is in the Azure catalogue. The report did not check a region. | + +The report does not check quota. A size can be available and still have no free quota. Azure ML has a separate quota. + +## Refresh the catalogue + +The file `devops/scripts/vm_size_catalogue.txt` lists all VM sizes that Azure offers in any region. Azure removes retired sizes from its API. For this reason, the script finds names that look like VM sizes, and uses the catalogue to identify names that do not exist. + +To refresh the catalogue, run: + +```bash +python3 devops/scripts/vm_size_report.py --refresh-catalogue +``` + +The query takes about 1.5 minutes. diff --git a/mkdocs.yml b/mkdocs.yml index 0f4c44ba58..0e2eb3fd32 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -145,6 +145,7 @@ nav: - Upgrading Resources Version: tre-admins/upgrading-resources.md - Configuring Airlock Reviews: tre-admins/configure-airlock-review.md - Supported Clouds: tre-admins/supported-clouds.md + - VM Size Availability: tre-admins/vm-size-availability.md - Customer Managed Keys: tre-admins/customer-managed-keys.md - Custom Domain Name: tre-admins/custom-domain.md - Firewall Force Tunneling: tre-admins/configure-firewall-force-tunneling.md From c2059b34b7a6359d5a2a4896640556b4ea5720b2 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 14:25:01 +0000 Subject: [PATCH 21/33] Skip database SKUs that a tier label maps in the VM size report The MySQL test maps each database tier label, for example "B | 4GB 2vCores", to its SKU without the tier prefix, for example Standard_B2s. The report counted these SKUs as VM sizes and showed Standard_B2s as blocked for a test reference. The scan now skips a size that is the value of a tier label. --- devops/scripts/vm_size_report.py | 6 ++++++ devops/tests/test_vm_size_report.py | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/devops/scripts/vm_size_report.py b/devops/scripts/vm_size_report.py index cee485863e..d41fc58477 100644 --- a/devops/scripts/vm_size_report.py +++ b/devops/scripts/vm_size_report.py @@ -25,6 +25,10 @@ # This keeps out Standard_LRS, Standard_v2 and identifiers such as basic_workspace_request. # The word boundary keeps out database SKUs such as GP_Standard_D2ds_v4, which are not VM SKUs. VM_SIZE = re.compile(r"\b(?i:standard|basic)_[A-Z][A-Za-z]*[0-9][A-Za-z0-9_-]*") +# A database tier label such as "B | 4GB 2vCores" can map to a database SKU without its tier prefix, for example +# {"B | 4GB 2vCores": "Standard_B2s"}. The scan skips a size that is the value of such a label, because it is +# a database SKU and not a VM size. +DATABASE_TIER_KEY = re.compile(r'"[A-Z]{1,2} \| \d+GB \d+vCores"\s*[:=]\s*"$') REGION = re.compile(r"[a-z0-9]+") # Keep only the fields that the report uses. The full output for all regions is too large. SKU_FIELDS = ( @@ -164,6 +168,8 @@ def find_references(repo, exclude=()): # Split on newlines only, so that the line numbers are the same as on GitHub. for number, line in enumerate(data.decode("utf-8", errors="replace").split("\n"), start=1): for match in VM_SIZE.finditer(line): + if DATABASE_TIER_KEY.search(line, 0, match.start()): + continue size = match.group().rstrip("_-") references.setdefault(size.lower(), []).append(Reference(name, number, size)) return references diff --git a/devops/tests/test_vm_size_report.py b/devops/tests/test_vm_size_report.py index e919a71884..213d36b782 100644 --- a/devops/tests/test_vm_size_report.py +++ b/devops/tests/test_vm_size_report.py @@ -164,6 +164,28 @@ def test_scans_each_tracked_text_file_once_with_github_line_numbers(self): }, ) + def test_scan_skips_database_skus_that_a_tier_label_maps(self): + with tempfile.TemporaryDirectory() as directory: + repo = git_repo( + directory, + { + "test_mysql.py": ( + 'SKUS = {"B | 4GB 2vCores": "Standard_B2s", "GP | 8GB 2vCores": "Standard_D2ds_v4"}\n' + 'VM = {"vm_size": "Standard_B2s"}\n' + 'PAYLOAD = {"sql_sku": "B | 4GB 2vCores", "vm_size": "Standard_D2s_v5"}\n' + ), + "locals.tf": '"BC | 16GB 2vCores" = "Standard_E2ds_v4"\n', + }, + ) + references = find_references(repo) + self.assertEqual( + references, + { + "standard_b2s": [Reference("test_mysql.py", 2, "Standard_B2s")], + "standard_d2s_v5": [Reference("test_mysql.py", 3, "Standard_D2s_v5")], + }, + ) + def test_scan_skips_the_files_of_this_tool(self): self.assertIn(Path(__file__).resolve(), OWN_FILES) self.assertTrue(all(path.is_file() for path in OWN_FILES)) From 0aa2ea16c2e7254beb2b26e7e7467fba514b1a06 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 14:30:35 +0000 Subject: [PATCH 22/33] Run the VM size report on a branch push that changes VM sizes The workflow also starts on a push to a branch other than main, if the push changes a file that sets VM sizes in code or a file of the report. A run on a push checks the LOCATION region of the CICD environment. A new push to the same branch stops the older run. The workflow has no pull request trigger. --- .github/workflows/vm_size_report.yml | 25 ++++++++++++++++++++++++- docs/tre-admins/vm-size-availability.md | 11 ++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vm_size_report.yml b/.github/workflows/vm_size_report.yml index 81b6952cea..ee08e69425 100644 --- a/.github/workflows/vm_size_report.yml +++ b/.github/workflows/vm_size_report.yml @@ -44,6 +44,28 @@ on: # yamllint disable-line rule:truthy type: string required: false default: "" + # A push to a branch checks the LOCATION region of CICD. A manual run covers main. + # There is no pull_request trigger, so a pull request never starts the workflow. + push: + branches-ignore: + - main + paths: + # The files that set VM sizes in code. + - "templates/**/porter.yaml" + - "templates/**/template_schema.json" + - "templates/**/*.tf" + - "core/terraform/**" + - "config_schema.json" + - ".github/actions/devcontainer_run_command/action.yml" + # The files of the report. + - "devops/scripts/vm_size_report.py" + - "devops/scripts/vm_size_catalogue.txt" + - ".github/workflows/vm_size_report.yml" + +# A new push stops the older run on the same branch. +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true permissions: contents: read @@ -74,7 +96,8 @@ jobs: - name: Report VM size availability env: - REGION: ${{ inputs.region }} + # A push has no inputs, so it uses ci-location. + REGION: ${{ inputs.region || 'ci-location' }} MORE_REGIONS: ${{ inputs.more_regions }} CI_LOCATION: ${{ vars.LOCATION }} LINK_BASE: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }} diff --git a/docs/tre-admins/vm-size-availability.md b/docs/tre-admins/vm-size-availability.md index 291db0af5e..d7e8754534 100644 --- a/docs/tre-admins/vm-size-availability.md +++ b/docs/tre-admins/vm-size-availability.md @@ -39,7 +39,16 @@ gh workflow run vm_size_report.yml -f region=none -f more_regions=uksouth,eastus The workflow logs in to Azure with the identity of the `CICD` environment. The report shows on the summary page of the run. The report is also in the `vm-size-report` artifact for 7 days. The workflow leaves the subscription out of the report, because anyone can see the run of a public repository. -GitHub shows the workflow in **Actions** only when the workflow file is on the default branch. +GitHub shows **Run workflow** only when the workflow file is on the default branch. + +### Runs on a branch push + +The workflow also starts on a push to a branch other than `main`, if the push changes one of these files: + +- The files that set VM sizes in code: `porter.yaml`, `template_schema.json` and Terraform files in `templates`, the files in `core/terraform`, `config_schema.json` and the action `devcontainer_run_command`. +- The files of the report: the script, the catalogue and the workflow. + +A run on a push checks the `LOCATION` region of the `CICD` environment. A new push to the same branch stops the older run. The workflow does not start on pull requests. ## Read the report From db34bc68b02a6f3789650127e29c7d2712768a0e Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 15:10:57 +0000 Subject: [PATCH 23/33] Fix six points in the VM size report and its workflow - The scan skips the docs page of the report, so its example size does not give a false blocked row. - A new test runs the report and makes sure that it skips the files of the tool. - A push run by Dependabot does not start the job. A push run without the CICD secrets, for example in a fork, shows a notice and skips the report. A manual run without the secrets fails with an error. - Only a push run stops an older push run on the same branch. Each manual run has its own concurrency group. - Azure Login reads AZURE_ENVIRONMENT from the variables first, the same as the other workflows. - The status key and the docs page give the same meaning for Not offered. --- .github/workflows/vm_size_report.yml | 30 ++++++++++++++++++++++--- devops/scripts/vm_size_report.py | 12 +++++++--- devops/tests/test_vm_size_report.py | 14 ++++++++++++ docs/tre-admins/vm-size-availability.md | 2 +- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/.github/workflows/vm_size_report.yml b/.github/workflows/vm_size_report.yml index ee08e69425..6522bb1a5f 100644 --- a/.github/workflows/vm_size_report.yml +++ b/.github/workflows/vm_size_report.yml @@ -62,9 +62,10 @@ on: # yamllint disable-line rule:truthy - "devops/scripts/vm_size_catalogue.txt" - ".github/workflows/vm_size_report.yml" -# A new push stops the older run on the same branch. +# A new push stops the older push run on the same branch. +# Each manual run has its own group, so another run does not stop it. concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" + group: "${{ github.workflow }}-${{ github.event_name == 'push' && github.ref || github.run_id }}" cancel-in-progress: true permissions: @@ -73,6 +74,8 @@ permissions: jobs: report: name: Report VM size availability + # Dependabot runs get no environment secrets, so they cannot log in to Azure. + if: github.actor != 'dependabot[bot]' runs-on: ubuntu-latest # The federated credential of the CI identity trusts this environment. environment: CICD @@ -82,19 +85,39 @@ jobs: # Log in to Azure with OIDC. id-token: write steps: + # A fork without the CICD secrets cannot log in to Azure. A push run then skips the report. + - name: Check the Azure credentials + id: credentials + env: + CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + EVENT_NAME: ${{ github.event_name }} + run: | + if [ -n "$CLIENT_ID" ]; then + echo "ready=true" >> "$GITHUB_OUTPUT" + elif [ "$EVENT_NAME" = "push" ]; then + echo "::notice::The CICD environment has no AZURE_CLIENT_ID secret, so the push run skips the report." + echo "ready=false" >> "$GITHUB_OUTPUT" + else + echo "::error::The CICD environment has no AZURE_CLIENT_ID secret. Add the secret, then run the workflow again." + exit 1 + fi + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + if: steps.credentials.outputs.ready == 'true' with: persist-credentials: false - name: Azure Login + if: steps.credentials.outputs.ready == 'true' uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - environment: ${{ (secrets.AZURE_ENVIRONMENT != '' && secrets.AZURE_ENVIRONMENT) || 'AzureCloud' }} + environment: ${{ vars.AZURE_ENVIRONMENT || secrets.AZURE_ENVIRONMENT || 'AzureCloud' }} - name: Report VM size availability + if: steps.credentials.outputs.ready == 'true' env: # A push has no inputs, so it uses ci-location. REGION: ${{ inputs.region || 'ci-location' }} @@ -123,6 +146,7 @@ jobs: cat vm-size-report.md >> "$GITHUB_STEP_SUMMARY" - name: Upload the report + if: steps.credentials.outputs.ready == 'true' uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: vm-size-report diff --git a/devops/scripts/vm_size_report.py b/devops/scripts/vm_size_report.py index d41fc58477..a56d1080cb 100644 --- a/devops/scripts/vm_size_report.py +++ b/devops/scripts/vm_size_report.py @@ -19,8 +19,14 @@ SCRIPT = Path(__file__).resolve() CATALOGUE = SCRIPT.with_name("vm_size_catalogue.txt") -# The scan skips the files of this tool. The catalogue lists all sizes and the tests use example sizes. -OWN_FILES = {SCRIPT, CATALOGUE, SCRIPT.parents[1] / "tests" / "test_vm_size_report.py"} +# The scan skips the files of this tool. The catalogue lists all sizes, and the tests and the docs page use +# example sizes. +OWN_FILES = { + SCRIPT, + CATALOGUE, + SCRIPT.parents[1] / "tests" / "test_vm_size_report.py", + SCRIPT.parents[2] / "docs" / "tre-admins" / "vm-size-availability.md", +} # After the prefix, a VM size has a family that starts with a capital letter, and a vCPU count. # This keeps out Standard_LRS, Standard_v2 and identifiers such as basic_workspace_request. # The word boundary keeps out database SKUs such as GP_Standard_D2ds_v4, which are not VM SKUs. @@ -49,7 +55,7 @@ "The name is not in the Azure catalogue. The size is retired or the name is wrong.", ), "blocked": ("⛔", "Blocked", "The region has the size, but the subscription cannot use it."), - "not offered": ("❌", "Not offered", "The region does not have the size."), + "not offered": ("❌", "Not offered", "The region does not have the size for this service."), "zones blocked": ("⚠️", "Some zones blocked", "The subscription can use the size, but not in the zones shown."), "not checked": ("➖", "Not checked", "The script could not get the Azure ML sizes of the region."), "available": ("✅", "Available", "The subscription can use the size in the region."), diff --git a/devops/tests/test_vm_size_report.py b/devops/tests/test_vm_size_report.py index 213d36b782..deb54c2ca0 100644 --- a/devops/tests/test_vm_size_report.py +++ b/devops/tests/test_vm_size_report.py @@ -329,6 +329,20 @@ def fake_az(command, subscription=None): vm_size_report.main([*args, "--repo", str(repo), "--catalogue", str(repo / "catalogue.txt")]) return output.getvalue(), az + def test_report_skips_the_files_of_this_tool(self): + files = {**self.files, "own.md": "For example `Standard_F2s_v2`.\n"} + with tempfile.TemporaryDirectory() as directory: + repo = git_repo(directory, files) + with ( + patch.object(vm_size_report, "OWN_FILES", {(repo / "own.md").resolve()}), + patch("sys.stdout", new_callable=io.StringIO) as output, + ): + vm_size_report.main(["--repo", str(repo), "--catalogue", str(repo / "catalogue.txt")]) + report = output.getvalue() + self.assertIn("`Standard_D4s_v5`", report) + self.assertNotIn("Standard_F2s_v2", report) + self.assertNotIn("own.md", report) + def test_region_report_shows_problems_first_and_code_before_docs(self): skus = [ sku("Standard_B2s", "switzerlandnorth", {"type": "Location"}), diff --git a/docs/tre-admins/vm-size-availability.md b/docs/tre-admins/vm-size-availability.md index d7e8754534..a8f0c588c8 100644 --- a/docs/tre-admins/vm-size-availability.md +++ b/docs/tre-admins/vm-size-availability.md @@ -48,7 +48,7 @@ The workflow also starts on a push to a branch other than `main`, if the push ch - The files that set VM sizes in code: `porter.yaml`, `template_schema.json` and Terraform files in `templates`, the files in `core/terraform`, `config_schema.json` and the action `devcontainer_run_command`. - The files of the report: the script, the catalogue and the workflow. -A run on a push checks the `LOCATION` region of the `CICD` environment. A new push to the same branch stops the older run. The workflow does not start on pull requests. +A run on a push checks the `LOCATION` region of the `CICD` environment. A new push to the same branch stops the older push run. Another run does not stop a manual run. A push by Dependabot, or a push in a fork without the `CICD` secrets, skips the report and does not fail. The workflow does not start on pull requests. ## Read the report From 0771c9de1df47ceea4cb3d2cce1213a7f28982fd Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 15:19:53 +0000 Subject: [PATCH 24/33] Run the VM size report on ubuntu-26.04 and allow the label in actionlint The ubuntu-latest label moves to Ubuntu 26 from 19 October 2026. The actionlint lines are the same as in #5285. --- .github/linters/actionlint.yml | 6 ++++++ .github/workflows/vm_size_report.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml index daba70a4fd..86992dad0b 100644 --- a/.github/linters/actionlint.yml +++ b/.github/linters/actionlint.yml @@ -1,4 +1,10 @@ --- +# actionlint v1.7.12 does not yet recognise this GitHub-hosted runner label. +# https://github.com/rhysd/actionlint/issues/682 +self-hosted-runner: + labels: + - ubuntu-26.04 + # GitHub supports queue: max, but actionlint v1.7.12 does not recognise it. # https://github.com/rhysd/actionlint/issues/687 # Remove these exact parser exceptions when actionlint supports queue. diff --git a/.github/workflows/vm_size_report.yml b/.github/workflows/vm_size_report.yml index 6522bb1a5f..ad53dfb64f 100644 --- a/.github/workflows/vm_size_report.yml +++ b/.github/workflows/vm_size_report.yml @@ -76,7 +76,7 @@ jobs: name: Report VM size availability # Dependabot runs get no environment secrets, so they cannot log in to Azure. if: github.actor != 'dependabot[bot]' - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 # The federated credential of the CI identity trusts this environment. environment: CICD timeout-minutes: 15 From f9e3adb350627c96a442b10dd543cbd20bef1fea Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 16:40:55 +0000 Subject: [PATCH 25/33] Fix three points in the VM size report and the trace guard The report skips its tool files also in the repository that --repo names. Build Validation runs the devops tests when the report script or the catalogue changes. The trace guard also finds set -x after if, while and until. --- .github/workflows/build_validation_develop.yml | 2 ++ devops/scripts/vm_size_report.py | 8 +++++++- devops/tests/test_template_scripts.py | 7 ++++++- devops/tests/test_vm_size_report.py | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_validation_develop.yml b/.github/workflows/build_validation_develop.yml index 53ed341a19..205c25e3bb 100644 --- a/.github/workflows/build_validation_develop.yml +++ b/.github/workflows/build_validation_develop.yml @@ -86,6 +86,8 @@ jobs: - 'devops/scripts/destroy_ci_ref_env.py' - 'devops/scripts/destroy_env_no_terraform.sh' - 'devops/scripts/validate_ci_cleanup.py' + - 'devops/scripts/vm_size_report.py' + - 'devops/scripts/vm_size_catalogue.txt' - 'devops/scripts/kv_add_network_exception.sh' - 'core/terraform/deploy.sh' - 'core/terraform/mgmt_storage_private_endpoint.sh' diff --git a/devops/scripts/vm_size_report.py b/devops/scripts/vm_size_report.py index a56d1080cb..12ee110238 100644 --- a/devops/scripts/vm_size_report.py +++ b/devops/scripts/vm_size_report.py @@ -354,7 +354,13 @@ def main(argv=None): print(f"Wrote {count} VM sizes to {args.catalogue}", file=sys.stderr) return catalogue_date, catalogue = read_catalogue(args.catalogue) - references = find_references(args.repo, OWN_FILES | {args.catalogue.resolve()}) + # With --repo, the scan also skips the tool files at the same paths in that repository. + own_files = OWN_FILES | { + (args.repo / path.relative_to(SCRIPT.parents[2])).resolve() + for path in OWN_FILES + if path.is_relative_to(SCRIPT.parents[2]) + } + references = find_references(args.repo, own_files | {args.catalogue.resolve()}) if regions: skus = region_skus(regions, args.subscription) empty = [region for region in regions if not skus[region]] diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index db804f4016..9682e34394 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -7,7 +7,9 @@ ROOT = Path(__file__).resolve().parents[2] # The arguments of each set command, also after a separator or a keyword, up to a comment or the next command. -SET = re.compile(r"(?:^|[;&|]|\bthen\b|\bdo\b|\belse\b)[ \t]*set[ \t]+([^\n#;&|]*)", re.MULTILINE) +SET = re.compile( + r"(?:^|[;&|]|\bthen\b|\bdo\b|\belse\b|\bif\b|\bwhile\b|\buntil\b)[ \t]*set[ \t]+([^\n#;&|]*)", re.MULTILINE +) # A shebang line with a flag group that contains x. SHEBANG = re.compile(r"\A#![^\n]*[ \t]-[a-zA-Z]*x") @@ -40,6 +42,9 @@ def test_trace_forms(self): "set -o pipefail; set -x", "if true; then set -x; fi", "true && set -x", + "if set -x; then :; fi", + "while set -x; do break; done", + "until set -x; do :; done", "#!/bin/bash -x\necho done", ): with self.subTest(line=line): diff --git a/devops/tests/test_vm_size_report.py b/devops/tests/test_vm_size_report.py index deb54c2ca0..8f9c9e4ab4 100644 --- a/devops/tests/test_vm_size_report.py +++ b/devops/tests/test_vm_size_report.py @@ -343,6 +343,21 @@ def test_report_skips_the_files_of_this_tool(self): self.assertNotIn("Standard_F2s_v2", report) self.assertNotIn("own.md", report) + def test_report_skips_the_tool_files_of_another_repository(self): + files = { + **self.files, + "devops/scripts/vm_size_catalogue.txt": "# Refreshed on 2026-10-23\nStandard_F2s_v2\n", + "docs/tre-admins/vm-size-availability.md": "For example `Standard_F4s_v2`.\n", + } + with tempfile.TemporaryDirectory() as directory: + repo = git_repo(directory, files) + with patch("sys.stdout", new_callable=io.StringIO) as output: + vm_size_report.main(["--repo", str(repo), "--catalogue", str(repo / "catalogue.txt")]) + report = output.getvalue() + self.assertIn("`Standard_D4s_v5`", report) + self.assertNotIn("Standard_F2s_v2", report) + self.assertNotIn("Standard_F4s_v2", report) + def test_region_report_shows_problems_first_and_code_before_docs(self): skus = [ sku("Standard_B2s", "switzerlandnorth", {"type": "Location"}), From 019a77fde7ca34a25f9a9656c0e8d4dc0fb39681 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 17:22:24 +0000 Subject: [PATCH 26/33] Run the VM size report by hand only The workflow used the CICD deploy identity also on branch pushes, but the report only reads VM size lists. Until a separate identity that can only read exists, the workflow runs only when a person starts it. --- .github/workflows/vm_size_report.yml | 49 +------------------------ docs/tre-admins/vm-size-availability.md | 9 +---- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/.github/workflows/vm_size_report.yml b/.github/workflows/vm_size_report.yml index ad53dfb64f..e5c91e38a3 100644 --- a/.github/workflows/vm_size_report.yml +++ b/.github/workflows/vm_size_report.yml @@ -44,29 +44,6 @@ on: # yamllint disable-line rule:truthy type: string required: false default: "" - # A push to a branch checks the LOCATION region of CICD. A manual run covers main. - # There is no pull_request trigger, so a pull request never starts the workflow. - push: - branches-ignore: - - main - paths: - # The files that set VM sizes in code. - - "templates/**/porter.yaml" - - "templates/**/template_schema.json" - - "templates/**/*.tf" - - "core/terraform/**" - - "config_schema.json" - - ".github/actions/devcontainer_run_command/action.yml" - # The files of the report. - - "devops/scripts/vm_size_report.py" - - "devops/scripts/vm_size_catalogue.txt" - - ".github/workflows/vm_size_report.yml" - -# A new push stops the older push run on the same branch. -# Each manual run has its own group, so another run does not stop it. -concurrency: - group: "${{ github.workflow }}-${{ github.event_name == 'push' && github.ref || github.run_id }}" - cancel-in-progress: true permissions: contents: read @@ -74,8 +51,6 @@ permissions: jobs: report: name: Report VM size availability - # Dependabot runs get no environment secrets, so they cannot log in to Azure. - if: github.actor != 'dependabot[bot]' runs-on: ubuntu-26.04 # The federated credential of the CI identity trusts this environment. environment: CICD @@ -85,30 +60,11 @@ jobs: # Log in to Azure with OIDC. id-token: write steps: - # A fork without the CICD secrets cannot log in to Azure. A push run then skips the report. - - name: Check the Azure credentials - id: credentials - env: - CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - EVENT_NAME: ${{ github.event_name }} - run: | - if [ -n "$CLIENT_ID" ]; then - echo "ready=true" >> "$GITHUB_OUTPUT" - elif [ "$EVENT_NAME" = "push" ]; then - echo "::notice::The CICD environment has no AZURE_CLIENT_ID secret, so the push run skips the report." - echo "ready=false" >> "$GITHUB_OUTPUT" - else - echo "::error::The CICD environment has no AZURE_CLIENT_ID secret. Add the secret, then run the workflow again." - exit 1 - fi - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - if: steps.credentials.outputs.ready == 'true' with: persist-credentials: false - name: Azure Login - if: steps.credentials.outputs.ready == 'true' uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} @@ -117,10 +73,8 @@ jobs: environment: ${{ vars.AZURE_ENVIRONMENT || secrets.AZURE_ENVIRONMENT || 'AzureCloud' }} - name: Report VM size availability - if: steps.credentials.outputs.ready == 'true' env: - # A push has no inputs, so it uses ci-location. - REGION: ${{ inputs.region || 'ci-location' }} + REGION: ${{ inputs.region }} MORE_REGIONS: ${{ inputs.more_regions }} CI_LOCATION: ${{ vars.LOCATION }} LINK_BASE: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }} @@ -146,7 +100,6 @@ jobs: cat vm-size-report.md >> "$GITHUB_STEP_SUMMARY" - name: Upload the report - if: steps.credentials.outputs.ready == 'true' uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: vm-size-report diff --git a/docs/tre-admins/vm-size-availability.md b/docs/tre-admins/vm-size-availability.md index a8f0c588c8..5a8e431513 100644 --- a/docs/tre-admins/vm-size-availability.md +++ b/docs/tre-admins/vm-size-availability.md @@ -41,14 +41,7 @@ The workflow logs in to Azure with the identity of the `CICD` environment. The r GitHub shows **Run workflow** only when the workflow file is on the default branch. -### Runs on a branch push - -The workflow also starts on a push to a branch other than `main`, if the push changes one of these files: - -- The files that set VM sizes in code: `porter.yaml`, `template_schema.json` and Terraform files in `templates`, the files in `core/terraform`, `config_schema.json` and the action `devcontainer_run_command`. -- The files of the report: the script, the catalogue and the workflow. - -A run on a push checks the `LOCATION` region of the `CICD` environment. A new push to the same branch stops the older push run. Another run does not stop a manual run. A push by Dependabot, or a push in a fork without the `CICD` secrets, skips the report and does not fail. The workflow does not start on pull requests. +The workflow runs only when a person starts it. It does not start on a push or on a pull request, because the identity of the `CICD` environment can change resources. An automatic run on branch pushes needs a separate identity that can only read. ## Read the report From db5374cc884ba6a76dfee7f869f1af24645240bb Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 19:57:31 +0000 Subject: [PATCH 27/33] Find lowercase VM sizes and ignore set -x in comments and quoted text The size pattern now ignores case also after the prefix, and it still keeps out tiers such as Standard_v2. The trace guard now removes comments and quoted text before it looks for a set command. --- devops/scripts/vm_size_report.py | 8 ++++---- devops/tests/test_template_scripts.py | 12 +++++++++++- devops/tests/test_vm_size_report.py | 7 ++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/devops/scripts/vm_size_report.py b/devops/scripts/vm_size_report.py index 12ee110238..a86c420f9e 100644 --- a/devops/scripts/vm_size_report.py +++ b/devops/scripts/vm_size_report.py @@ -27,10 +27,10 @@ SCRIPT.parents[1] / "tests" / "test_vm_size_report.py", SCRIPT.parents[2] / "docs" / "tre-admins" / "vm-size-availability.md", } -# After the prefix, a VM size has a family that starts with a capital letter, and a vCPU count. -# This keeps out Standard_LRS, Standard_v2 and identifiers such as basic_workspace_request. -# The word boundary keeps out database SKUs such as GP_Standard_D2ds_v4, which are not VM SKUs. -VM_SIZE = re.compile(r"\b(?i:standard|basic)_[A-Z][A-Za-z]*[0-9][A-Za-z0-9_-]*") +# After the prefix, a VM size has a family of letters and a vCPU count, in any case. +# The vCPU count keeps out Standard_LRS and identifiers such as basic_workspace_request. A tier such as +# Standard_v2 is not a VM size. The word boundary keeps out database SKUs such as GP_Standard_D2ds_v4. +VM_SIZE = re.compile(r"\b(?i:standard|basic)_(?![vV][0-9]+\b)[A-Za-z]+[0-9][A-Za-z0-9_-]*") # A database tier label such as "B | 4GB 2vCores" can map to a database SKU without its tier prefix, for example # {"B | 4GB 2vCores": "Standard_B2s"}. The scan skips a size that is the value of such a label, because it is # a database SKU and not a VM size. diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index 9682e34394..bbf22f5e76 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -14,10 +14,16 @@ SHEBANG = re.compile(r"\A#![^\n]*[ \t]-[a-zA-Z]*x") +# Quoted text and comments, which do not run a command. +QUOTED = re.compile(r"'[^'\n]*'|\"(?:[^\"\\\n]|\\.)*\"") +COMMENT = re.compile(r"(^|[ \t])#[^\n]*", re.MULTILINE) + + def turns_on_trace(text): if SHEBANG.search(text): return True - for match in SET.finditer(text): + commands = COMMENT.sub(r"\1", QUOTED.sub("''", text)) + for match in SET.finditer(commands): args = match.group(1).split() for index, arg in enumerate(args): if arg == "--": @@ -60,6 +66,10 @@ def test_trace_forms(self): "set -e; tar -xzf a.tgz", "echo reset -x", "#!/bin/bash\nset -e", + "# if set -x", + "echo done # then set -x", + "printf '%s\\n' 'then set -x for debugging'", + 'echo "if set -x; then"', ): with self.subTest(line=line): self.assertFalse(turns_on_trace(line)) diff --git a/devops/tests/test_vm_size_report.py b/devops/tests/test_vm_size_report.py index 8f9c9e4ab4..398d7f181a 100644 --- a/devops/tests/test_vm_size_report.py +++ b/devops/tests/test_vm_size_report.py @@ -54,15 +54,16 @@ def table_rows(report): class PatternTests(unittest.TestCase): def test_finds_vm_sizes_in_any_case(self): - line = 'sizes = ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0"]' + line = 'sizes = ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0", "standard_b2s", "Standard_d2_v3"]' self.assertEqual( [match.group() for match in VM_SIZE.finditer(line)], - ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0"], + ["Standard_B2s", "STANDARD_D2_V3", "Standard_E64-32s_v5", "Basic_A0", "standard_b2s", "Standard_d2_v3"], ) def test_skips_skus_that_are_not_vm_sizes(self): line = ( - "Standard_LRS Standard_GRS Standard_v2 basic_workspace_request basic_resource_template " + "Standard_LRS Standard_GRS Standard_v2 standard_v3 STANDARD_V2 standard_lrs basic_workspace_request " + "basic_resource_template " "GP_Standard_D2ds_v4 B_Standard_B1ms MO_Standard_E2ds_v4" ) self.assertEqual(list(VM_SIZE.finditer(line)), []) From cbbc4a10041cb95f03c8e4af5a50b248447382a3 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 20:30:23 +0000 Subject: [PATCH 28/33] Read quotes and comments as the shell does in the trace guard The guard removed all quoted text, so it also removed quoted options such as set "-x" and set -o 'xtrace'. It now splits each line into the words that the shell reads, finds the set commands, and checks their options. A quoted message stays one word of its command. --- devops/tests/test_template_scripts.py | 45 +++++++++++++++++++++------ 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index bbf22f5e76..e8e684f2d1 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -2,29 +2,52 @@ from pathlib import Path import re +import shlex import unittest ROOT = Path(__file__).resolve().parents[2] -# The arguments of each set command, also after a separator or a keyword, up to a comment or the next command. -SET = re.compile( - r"(?:^|[;&|]|\bthen\b|\bdo\b|\belse\b|\bif\b|\bwhile\b|\buntil\b)[ \t]*set[ \t]+([^\n#;&|]*)", re.MULTILINE -) # A shebang line with a flag group that contains x. SHEBANG = re.compile(r"\A#![^\n]*[ \t]-[a-zA-Z]*x") +# Words after which the next word is a command. +SEPARATORS = {";", "&", "&&", "|", "||", "|&", "(", ")", ";;"} +KEYWORDS = {"if", "then", "elif", "else", "do", "while", "until", "!", "{", "}"} -# Quoted text and comments, which do not run a command. -QUOTED = re.compile(r"'[^'\n]*'|\"(?:[^\"\\\n]|\\.)*\"") -COMMENT = re.compile(r"(^|[ \t])#[^\n]*", re.MULTILINE) +def words(line): + """The words of one line, as the shell reads its quotes and comments.""" + lexer = shlex.shlex(line, posix=True, punctuation_chars=";&|()") + lexer.whitespace_split = True + try: + return list(lexer) + except ValueError: + # An open quote, for example in the text of a here-document. Read the plain words. + return re.findall(r"[;&|()]+|[^\s;&|()]+", re.sub(r"(^|\s)#.*", "", line)) + + +def set_arguments(text): + """The arguments of each set command that the shell runs.""" + for line in text.splitlines(): + command_start, args = True, None + for word in words(line) + [";"]: + if args is not None: + if word in SEPARATORS: + yield args + args = None + else: + args.append(word) + if word in SEPARATORS or (command_start and word in KEYWORDS): + command_start = True + elif command_start and word == "set" and args is None: + args, command_start = [], False + else: + command_start = False def turns_on_trace(text): if SHEBANG.search(text): return True - commands = COMMENT.sub(r"\1", QUOTED.sub("''", text)) - for match in SET.finditer(commands): - args = match.group(1).split() + for args in set_arguments(text): for index, arg in enumerate(args): if arg == "--": break @@ -48,6 +71,8 @@ def test_trace_forms(self): "set -o pipefail; set -x", "if true; then set -x; fi", "true && set -x", + 'set "-x"', + "set -o 'xtrace'", "if set -x; then :; fi", "while set -x; do break; done", "until set -x; do :; done", From 0ac90746612f321b3723ccca15e5a83188419aed Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 21:10:22 +0000 Subject: [PATCH 29/33] Keep quoted and escaped separators as words in the trace guard The guard read a quoted or escaped semicolon as the end of a command, so a set word after it looked like a command. The lexer now keeps the quotes, and a separator after a backslash stays a word. The option check still removes the quotes. --- devops/tests/test_template_scripts.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/devops/tests/test_template_scripts.py b/devops/tests/test_template_scripts.py index e8e684f2d1..76cd54d4f7 100644 --- a/devops/tests/test_template_scripts.py +++ b/devops/tests/test_template_scripts.py @@ -15,8 +15,8 @@ def words(line): - """The words of one line, as the shell reads its quotes and comments.""" - lexer = shlex.shlex(line, posix=True, punctuation_chars=";&|()") + """The words of one line, with their quotes, so that a quoted or escaped separator stays a word.""" + lexer = shlex.shlex(line, posix=False, punctuation_chars=";&|()") lexer.whitespace_split = True try: return list(lexer) @@ -25,18 +25,29 @@ def words(line): return re.findall(r"[;&|()]+|[^\s;&|()]+", re.sub(r"(^|\s)#.*", "", line)) +def unquoted(word): + """A word without the quotes around it, as the shell gives it to the command.""" + if len(word) >= 2 and word[0] == word[-1] and word[0] in "'\"": + return word[1:-1] + return word + + def set_arguments(text): """The arguments of each set command that the shell runs.""" for line in text.splitlines(): - command_start, args = True, None - for word in words(line) + [";"]: + command_start, args, after_backslash = True, None, False + for raw in words(line) + [";"]: + # A quoted separator keeps its quotes. An escaped one, as in "find -exec ... \\;", follows a backslash. + separator = raw in SEPARATORS and not after_backslash + after_backslash = raw == "\\" + word = unquoted(raw) if args is not None: - if word in SEPARATORS: + if separator: yield args args = None else: args.append(word) - if word in SEPARATORS or (command_start and word in KEYWORDS): + if separator or (command_start and raw in KEYWORDS): command_start = True elif command_start and word == "set" and args is None: args, command_start = [], False @@ -95,6 +106,8 @@ def test_trace_forms(self): "echo done # then set -x", "printf '%s\\n' 'then set -x for debugging'", 'echo "if set -x; then"', + "printf '%s\\n' ';' set -x", + "find . -exec rm {} \\; set -x", ): with self.subTest(line=line): self.assertFalse(turns_on_trace(line)) From 2ccfc6c278953b90fec4d5dfac9fd8c9c76d257e Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 21:44:27 +0000 Subject: [PATCH 30/33] Add the issue and pull request links to the new CHANGELOG entries The VM size entries link #5289. The other entries link #5290. --- CHANGELOG.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80f8a5669b..897ef1ab39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Setting to `false` will delete existing airlock storage accounts and must only b Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.19.0. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). - Also upgrade the Sonatype Nexus shared service to 3.11.5. Earlier versions keep the boot diagnostics of the Nexus VM in the core storage account. Until the upgrade, the boot diagnostics view of that VM does not load from outside the virtual network. + Also upgrade the Sonatype Nexus shared service to 3.11.5. Earlier versions keep the boot diagnostics of the Nexus VM in the core storage account. Until the upgrade, the boot diagnostics view of that VM does not load from outside the virtual network. ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) ENHANCEMENTS: * Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150)) @@ -37,7 +37,7 @@ See [Legacy Airlock & migration](docs/azure-tre-overview/airlock.md#legacy-airlo * Update template schemas to Draft 2020-12, preserve legacy input restrictions, and support local schema definitions in resource forms. (`API` 0.27.0, `ui` 0.9.0) ([#5005](https://github.com/microsoft/AzureTRE/pull/5005)) * Add weekly and manual builds for Dockerfiles and Porter bundles, with selected pull request builds. Retry a failed target once and report final results. ([#5088](https://github.com/microsoft/AzureTRE/issues/5088)) * Let a fork run CI in a shared subscription with the `CI_ENV_PREFIX` variable and a `ci_repository` tag, which scope cleanup and destruction. Keep a CI environment, for example for a demo, with a `ci_keep_until` tag. (`core` 0.18.15, `devops` 0.7.0, `build-scripts` 1.1.5) ([#5272](https://github.com/microsoft/AzureTRE/pull/5272)) -* Report the VM sizes that the repository uses and their availability in one or more Azure regions, for VMs and Azure ML compute, with `devops/scripts/vm_size_report.py` or the **VM Size Availability** workflow. See [VM size availability](docs/tre-admins/vm-size-availability.md). (`devops` 0.8.0) +* Report the VM sizes that the repository uses and their availability in one or more Azure regions, for VMs and Azure ML compute, with `devops/scripts/vm_size_report.py` or the **VM Size Availability** workflow. See [VM size availability](docs/tre-admins/vm-size-availability.md). (`devops` 0.8.0) ([#5289](https://github.com/microsoft/AzureTRE/issues/5289)) BUG FIXES: * Update Nexus from 3.94.0 to 3.94.3. The Nexus 3.94.3 image stops trusting the eMudhra certificate chains that Sonatype reports as compromised. (`tre-shared-service-sonatype-nexus` 3.11.3) ([#5276](https://github.com/microsoft/AzureTRE/issues/5276)) @@ -64,17 +64,17 @@ BUG FIXES: Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. If that resize fails, set `resource_processor_vmss_sku` to `Standard_B2s` and deploy the core again. An upgrade keeps the size of an existing admin VM. If a Nexus service has no stored `vm_size`, for example a Nexus from before bundle 3.2.3, the upgrade resizes its VM to `Standard_B2s_v2` and restarts it. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. - (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) -* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) + (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) ([#5289](https://github.com/microsoft/AzureTRE/issues/5289)) +* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. - An uninstall uses the installed bundle version, so complete an upgrade of the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) + An uninstall uses the installed bundle version, so complete an upgrade of the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. An uninstall uses the installed bundle version, so complete an upgrade of a workspace and its Gitea services first to keep the rules during the delete. - (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) -* Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) + (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) +* Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. - (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) + (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) From aff8f694fb5718fafc9eaec9270f7d47456853ba Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 21:57:47 +0000 Subject: [PATCH 31/33] Describe the values that earlier Guacamole versions wrote to their logs Before Guacamole 0.14.8, the server log had the oauth2-proxy cookie secret. The server makes a new secret at each start, so the old value has no use after the upgrade. Before Linux VM 1.4.10, the cloud-init output log of the VM had the workspace storage account key. The VM also keeps the key in its share credential file and its cloud-init user data. The Guacamole document gives these facts and the key rotation, and the CHANGELOG entry links it. --- CHANGELOG.md | 3 ++- .../workspace-services/guacamole.md | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 897ef1ab39..673b44830a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,7 +71,8 @@ BUG FIXES: * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. An uninstall uses the installed bundle version, so complete an upgrade of a workspace and its Gitea services first to keep the rules during the delete. (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) -* Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) +* Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. + Earlier versions wrote some values of these commands to their logs. See [Command trace in earlier versions](docs/tre-templates/workspace-services/guacamole.md#command-trace-in-earlier-versions). (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) diff --git a/docs/tre-templates/workspace-services/guacamole.md b/docs/tre-templates/workspace-services/guacamole.md index a18b195367..b4e7db0fa7 100644 --- a/docs/tre-templates/workspace-services/guacamole.md +++ b/docs/tre-templates/workspace-services/guacamole.md @@ -44,3 +44,24 @@ packages, we recommend using a custom VM image with the tooling pre-installed. The included user resource templates that rely on bootstrap scripts should only be used for trial/demonstration purposes. More info can be found in the [custom templates documentation](../user-resources/custom.md). + +### Command trace in earlier versions + +Before `tre-service-guacamole` 0.14.8, the Guacamole server wrote the start +command of oauth2-proxy to the console log of its web app. This command has the +cookie secret of oauth2-proxy, and the web app sends the log to the Log +Analytics workspace of the TRE core. The server makes a new cookie secret at +each start and keeps it only in memory. The upgrade to 0.14.8 restarts the +server, so after the upgrade the old value in Log Analytics has no use. + +Before `tre-service-guacamole-linuxvm` 1.4.10, the setup script of the Linux VM +wrote its commands to the cloud-init output log `/var/log/cloud-init-output.log` +on the VM. Some of these commands have the key of the workspace storage +account, which the VM uses for the workspace file share. An upgrade does not +change an existing VM, so its log keeps the key. The VM also keeps the key in +the credential file of the share in `/etc/smbcredentials` and in its cloud-init +user data, so a change of the log does not remove the key from the VM. + +If the people who can sign in to such a VM must not keep the key, rotate the +key of the workspace storage account. After a rotation, the share mount of each +existing VM fails until the VM gets the new key. From 77e8b32c934bce70282098152209776db99f66d2 Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 21:59:04 +0000 Subject: [PATCH 32/33] Link the new issues in the CHANGELOG entries The package source entry links #5291, the storage rule entries link #5292, the trace entry links #5293, and the core storage entries link #5294. --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 673b44830a..7181c7059b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Setting to `false` will delete existing airlock storage accounts and must only b Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * If the Airlock notifier shared service is installed, upgrade it to 1.0.15 directly after the upgrade to `core` 0.19.0. Azure mounts the content share of earlier notifier versions over the public network, which the core storage account no longer accepts. A running notifier can continue to work, but a restart or a configuration change of its Logic App can fail until the upgrade. See [Airlock notifier](docs/tre-templates/shared-services/airlock-notifier.md#storage-and-network). - Also upgrade the Sonatype Nexus shared service to 3.11.5. Earlier versions keep the boot diagnostics of the Nexus VM in the core storage account. Until the upgrade, the boot diagnostics view of that VM does not load from outside the virtual network. ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) + Also upgrade the Sonatype Nexus shared service to 3.11.5. Earlier versions keep the boot diagnostics of the Nexus VM in the core storage account. Until the upgrade, the boot diagnostics view of that VM does not load from outside the virtual network. ([#5294](https://github.com/microsoft/AzureTRE/issues/5294)) ENHANCEMENTS: * Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150)) @@ -65,17 +65,17 @@ BUG FIXES: An upgrade keeps the size of an existing admin VM. If a Nexus service has no stored `vm_size`, for example a Nexus from before bundle 3.2.3, the upgrade resizes its VM to `Standard_B2s_v2` and restarts it. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) ([#5289](https://github.com/microsoft/AzureTRE/issues/5289)) -* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) +* Make apt on the Guacamole Linux VM use the Ubuntu archive key for the Ubuntu sources from Nexus, and make Nexus get the Ubuntu packages over HTTPS, the same as its other proxies. An upgrade does not change the apt sources of an existing VM. (`tre-service-guacamole-linuxvm` 1.4.10, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5291](https://github.com/microsoft/AzureTRE/issues/5291)) * Create the network rules of the Gitea storage account together with the account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. - An uninstall uses the installed bundle version, so complete an upgrade of the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) + An uninstall uses the installed bundle version, so complete an upgrade of the service first to keep the rules during the uninstall. (`tre-workspace-service-gitea` 2.0.1) ([#5292](https://github.com/microsoft/AzureTRE/issues/5292)) * Create the network rules of the workspace storage account and the Airlock export in-progress storage account together with each account. A separate resource set them after the create and changed them again before the delete. An upgrade removes the separate resource from the Terraform state and keeps the rules. An uninstall uses the installed bundle version, so complete an upgrade of a workspace and its Gitea services first to keep the rules during the delete. - (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) + (`tre-workspace-base` 2.12.5, `tre-workspace-unrestricted` 0.15.4, `tre-workspace-airlock-import-review` 0.18.4) ([#5292](https://github.com/microsoft/AzureTRE/issues/5292)) * Turn off the shell command trace in the Guacamole Linux VM setup script and around the oauth2-proxy start of the Guacamole server. The comment in the setup script says that the trace is for debugging only. - Earlier versions wrote some values of these commands to their logs. See [Command trace in earlier versions](docs/tre-templates/workspace-services/guacamole.md#command-trace-in-earlier-versions). (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) + Earlier versions wrote some values of these commands to their logs. See [Command trace in earlier versions](docs/tre-templates/workspace-services/guacamole.md#command-trace-in-earlier-versions). (`tre-service-guacamole-linuxvm` 1.4.10, `tre-service-guacamole` 0.14.8) ([#5293](https://github.com/microsoft/AzureTRE/issues/5293)) * Accept traffic to the core storage account only through its private endpoints and from trusted Azure services. Add private endpoints for the queue and table services, which the Airlock notifier Logic App uses. The Logic App reaches its content share through the virtual network, and Nexus keeps its boot diagnostics in managed storage. The notifier uses the AzureRM provider 4.57.0, which updates the Logic App in one request with all its app settings. - (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5290](https://github.com/microsoft/AzureTRE/pull/5290)) + (`core` 0.19.0, `tre-shared-service-airlock-notifier` 1.0.15, `tre-shared-service-sonatype-nexus` 3.11.5) ([#5294](https://github.com/microsoft/AzureTRE/issues/5294)) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) From 18912acf7b501ce5a6104034cc103c329d89649a Mon Sep 17 00:00:00 2001 From: Jay W Date: Sun, 1 Nov 2026 22:13:25 +0000 Subject: [PATCH 33/33] Say that the admin VM size applies only at install, and give a rollback size from the report The comment on the admin VM size named the schema rule unclearly. It now says that the size applies only at install, that Terraform ignores a later change of the default, and that Azure cannot resize between a size with a temporary disk and a size without one. The CHANGELOG rollback for a failed resource processor resize now names the size that the deployment used before, or a size that the VM size report shows as available. --- CHANGELOG.md | 3 ++- .../shared_services/admin-vm/terraform/admin-jumpbox.tf | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7181c7059b..8fbf872c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,7 +61,8 @@ BUG FIXES: * Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283)) * Change the default VM sizes that Azure does not offer to all subscriptions in all regions, for example Switzerland North. The resource processor and the admin VM use `Standard_B2ls_v2` in place of `Standard_B2s`. Nexus uses `Standard_B2s_v2` in place of `Standard_B2ms`, and `Standard_B4s_v2` is a new choice beside `Standard_B4ms`. - Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. If that resize fails, set `resource_processor_vmss_sku` to `Standard_B2s` and deploy the core again. + Each new size has the same vCPU count and memory as the old size. If a deployment does not set `resource_processor_vmss_sku`, the next core deployment resizes the resource processor. + If that resize fails, set `resource_processor_vmss_sku` to the size that the deployment used before, for example `Standard_B2s`, or to a size that the [VM size report](docs/tre-admins/vm-size-availability.md) shows as available in the region. Then deploy the core again. An upgrade keeps the size of an existing admin VM. If a Nexus service has no stored `vm_size`, for example a Nexus from before bundle 3.2.3, the upgrade resizes its VM to `Standard_B2s_v2` and restarts it. The AML compute instance bundle default is now `Standard_D2_v3`, the same as its schema, because `Standard_DS2_v3` does not exist. (`core` 0.19.0, `tre-shared-service-admin-vm` 0.5.8, `tre-shared-service-sonatype-nexus` 3.11.5, `tre-user-resource-aml-compute-instance` 0.5.16) ([#5289](https://github.com/microsoft/AzureTRE/issues/5289)) diff --git a/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf b/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf index bcf03e681d..faa24db5a5 100644 --- a/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf +++ b/templates/shared_services/admin-vm/terraform/admin-jumpbox.tf @@ -62,8 +62,10 @@ resource "azurerm_windows_virtual_machine" "jumpbox" { # ignore changes to secure_boot_enabled and vtpm_enabled as these are destructive # (may be allowed once https://github.com/hashicorp/terraform-provider-azurerm/issues/25808 is fixed) # - # The size is not updateable, so only a new default can change it. Azure does not resize a Windows VM - # between a size with a temporary disk and a size without one, so an upgrade keeps the installed size. + # The size applies only at install. The template schema does not mark admin_jumpbox_vm_sku as updateable, + # and Terraform ignores a later change of the default. Azure cannot resize a VM between a size with a + # temporary disk (Standard_B2s) and a size without one (Standard_B2ls_v2), so an upgrade of an earlier + # admin VM keeps its installed size. To change the size, install the admin VM again. lifecycle { ignore_changes = [tags, secure_boot_enabled, vtpm_enabled, size] } }