Skip to content

Commit

Permalink
E2E Extended tests failing as service principal does not exist as a u…
Browse files Browse the repository at this point in the history
…ser in AD

Fixes #4396
  • Loading branch information
marrobi committed Feb 21, 2025
1 parent fa4a320 commit 1a6819f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
3 changes: 2 additions & 1 deletion e2e_tests/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ async def test_bulk_updates_to_ensure_each_resource_updated_in_series(verify) ->
"properties": {
"display_name": "Perf test VM",
"description": "",
"os_image": "Ubuntu 22.04 LTS"
"os_image": "Ubuntu 22.04 LTS",
"admin_username": "admin"
}
}

Expand Down
3 changes: 2 additions & 1 deletion e2e_tests/test_workspace_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ async def test_create_guacamole_service_into_base_workspace(setup_test_workspace
"properties": {
"display_name": "My VM",
"description": "Will be using this VM for my research",
"os_image": "Windows 10"
"os_image": "Windows 10",
"admin_username": "admin"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
schemaVersion: 1.0.0
name: tre-service-guacamole-windowsvm
version: 1.2.10
version: 1.2.11
description: "An Azure TRE User Resource Template for Guacamole (Windows 10)"
dockerfile: Dockerfile.tmpl
registry: azuretre
Expand Down Expand Up @@ -104,6 +104,9 @@ parameters:
- name: os_image
type: string
default: "Windows 10"
- name: admin_username
type: string
default: ""
- name: vm_size
type: string
default: "2 CPU | 8GB RAM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ data "azurerm_user_assigned_identity" "ws_encryption_identity" {
}

data "azuread_user" "user" {
count = var.admin_username == "" ? 1 : 0
object_id = var.owner_id
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ locals {
keyvault_name = lower("kv-${substr(local.workspace_resource_name_suffix, -20, -1)}")
storage_name = lower(replace("stg${substr(local.workspace_resource_name_suffix, -8, -1)}", "-", ""))
admin_username = (
length(data.azuread_user.user.mail) > 0 && strcontains(data.azuread_user.user.user_principal_name, "#EXT#") ?
substr(element(split("@", data.azuread_user.user.mail), 0), 0, 20) :
substr(element(split("#EXT#", element(split("@", data.azuread_user.user.user_principal_name), 0)), 0), 0, 20)
var.admin_username == "" ?
(length(data.azuread_user.user[0].mail) > 0 && strcontains(data.azuread_user.user[0].user_principal_name, "#EXT#") ?
substr(element(split("@", data.azuread_user.user[0].mail), 0), 0, 20) :
substr(element(split("#EXT#", element(split("@", data.azuread_user.user[0].user_principal_name), 0)), 0), 0, 20)
) :
var.admin_username
)
vm_password_secret_name = "${local.vm_name}-admin-credentials"
tre_user_resources_tags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ variable "key_store_id" {
type = string
}
variable "auth_tenant_id" {
type = string
description = "Used to authenticate into the AAD Tenant to create the AAD App"
type = string
}
variable "auth_client_id" {
type = string
description = "Used to authenticate into the AAD Tenant to create the AAD App"
type = string
}
variable "auth_client_secret" {
type = string
description = "Used to authenticate into the AAD Tenant to create the AAD App"
type = string
}
variable "admin_username" {
type = string
}

0 comments on commit 1a6819f

Please sign in to comment.