From a5dc22670e4ad33a1b557fdb0b159cbca25579d6 Mon Sep 17 00:00:00 2001 From: Matt Craddock <5796417+craddm@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:56:33 +0000 Subject: [PATCH 1/3] Replace Invoke-Expression with call operator --- .../setup/Apply_SRE_Network_Configuration.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 b/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 index e8470f7645..e746ea77f2 100644 --- a/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 +++ b/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 @@ -110,7 +110,7 @@ foreach ($nsgName in $nsgs.Keys) { # Ensure SRE is peered to correct mirror/proxy set # ------------------------------------------------ # Unpeer any existing networks before (re-)establishing correct peering for SRE -Invoke-Expression -Command "$(Join-Path $PSScriptRoot Unpeer_SRE_Package_Repositories.ps1) -shmId $shmId -sreId $sreId" +& $(Join-Path $PSScriptRoot "Unpeer_SRE_Package_Repositories.ps1") -shmId $shmID -sreId $sreId # Peer this SRE to the repository network Add-LogMessage -Level Info "Ensuring SRE is peered to correct package repository..." if (-not $config.sre.repositories.network.name) { @@ -146,8 +146,7 @@ $null = Set-AzContext -SubscriptionId $config.sre.subscriptionName -ErrorAction # Block external DNS queries # -------------------------- -Invoke-Expression -Command "$(Join-Path $PSScriptRoot "Configure_External_DNS_Queries.ps1") -shmId $shmId -sreId $sreId" - +& $(Join-Path $PSScriptRoot "Configure_External_DNS_Queries.ps1") -shmId $shmId -sreId $sreId # Switch back to original subscription # ------------------------------------ From 0edc855bfc3db3012f0e1dc237199a84f43544b1 Mon Sep 17 00:00:00 2001 From: Matt Craddock <5796417+craddm@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:44:46 +0000 Subject: [PATCH 2/3] Remove trailing whitespace --- .../setup/Apply_SRE_Network_Configuration.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 b/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 index e746ea77f2..4e5b7b9b3e 100644 --- a/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 +++ b/deployment/secure_research_environment/setup/Apply_SRE_Network_Configuration.ps1 @@ -146,7 +146,7 @@ $null = Set-AzContext -SubscriptionId $config.sre.subscriptionName -ErrorAction # Block external DNS queries # -------------------------- -& $(Join-Path $PSScriptRoot "Configure_External_DNS_Queries.ps1") -shmId $shmId -sreId $sreId +& $(Join-Path $PSScriptRoot "Configure_External_DNS_Queries.ps1") -shmId $shmId -sreId $sreId # Switch back to original subscription # ------------------------------------ From 1002a1ddf5f4ad11ccac03f375ce15d3640982a5 Mon Sep 17 00:00:00 2001 From: Matt Craddock <5796417+craddm@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:02:19 +0000 Subject: [PATCH 3/3] remove additional invoke-expression calls --- deployment/administration/SRE_SRD_Remote_Diagnostics.ps1 | 2 +- deployment/administration/SRE_Teardown.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/administration/SRE_SRD_Remote_Diagnostics.ps1 b/deployment/administration/SRE_SRD_Remote_Diagnostics.ps1 index 6b7effa1ca..9a72120f91 100644 --- a/deployment/administration/SRE_SRD_Remote_Diagnostics.ps1 +++ b/deployment/administration/SRE_SRD_Remote_Diagnostics.ps1 @@ -39,7 +39,7 @@ if ($?) { # Run remote diagnostic scripts # ----------------------------- -Invoke-Expression -Command "$(Join-Path $PSScriptRoot '..' 'secure_research_environment' 'setup' 'Run_SRE_SRD_Remote_Diagnostics.ps1') -shmId $shmId -sreId $sreId -ipLastOctet $ipLastOctet" +& $(Join-Path $PSScriptRoot '..' 'secure_research_environment' 'setup' 'Run_SRE_SRD_Remote_Diagnostics.ps1') -shmId $shmId -sreId $sreId -ipLastOctet $ipLastOctet # Get LDAP secret from the Key Vault diff --git a/deployment/administration/SRE_Teardown.ps1 b/deployment/administration/SRE_Teardown.ps1 index 8360eed862..aa62102510 100644 --- a/deployment/administration/SRE_Teardown.ps1 +++ b/deployment/administration/SRE_Teardown.ps1 @@ -83,7 +83,7 @@ $scriptPath = Join-Path $PSScriptRoot ".." "secure_research_environment" "setup" if ($dryRun.IsPresent) { Add-LogMessage -Level Info "SRE data would be removed from the SHM by running: $scriptPath -shmId $shmId -sreId $sreId" } else { - Invoke-Expression -Command "$scriptPath -shmId $shmId -sreId $sreId" + & $scriptPath -shmId $shmId -sreId $sreId }