-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58524dc
commit bb12e8d
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
safe_haven_management_environment/Shutdown_SHM_Deployment_VMs.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
param( | ||
[Parameter(Position=0, Mandatory = $true, HelpMessage = "Enter DSG ID (usually a number e.g enter '9' for DSG9)")] | ||
[string]$shmId | ||
) | ||
|
||
Import-Module Az | ||
Import-Module $PSScriptRoot/../new_dsg_environment/dsg_deploy_scripts/DsgConfig.psm1 -Force | ||
|
||
# Get SHM config | ||
$config = Get-ShmFullConfig($shmId) | ||
|
||
# Temporarily switch to SHM subscription | ||
$prevContext = Get-AzContext | ||
$_ = Set-AzContext -SubscriptionId $config.subscriptionName; | ||
|
||
Write-Host "===Stopping all Deployment Servers===" | ||
Get-AzVM -ResourceGroupName "RG_SHM_DEPLOYMENT_POOL" | Stop-AzVM -Force -NoWait | ||
|
||
# Switch back to original subscription | ||
$_ = Set-AzContext -Context $prevContext; |
23 changes: 23 additions & 0 deletions
23
safe_haven_management_environment/Shutdown_SHM_IAAM_VMs.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
param( | ||
[Parameter(Position=0, Mandatory = $true, HelpMessage = "Enter DSG ID (usually a number e.g enter '9' for DSG9)")] | ||
[string]$shmId | ||
) | ||
|
||
Import-Module Az | ||
Import-Module $PSScriptRoot/../new_dsg_environment/dsg_deploy_scripts/DsgConfig.psm1 -Force | ||
|
||
# Get SHM config | ||
$config = Get-ShmFullConfig($shmId) | ||
|
||
# Temporarily switch to SHM subscription | ||
$prevContext = Get-AzContext | ||
$_ = Set-AzContext -SubscriptionId $config.subscriptionName; | ||
|
||
Write-Host "===Stopping NPS Server===" | ||
Stop-AzVM -ResourceGroupName $config.nps.rg -Name $config.nps.vmName -Force -NoWait | ||
Write-Host "===Stopping AD DCs===" | ||
Stop-AzVM -ResourceGroupName $config.dc.rg -Name $config.dc.vmName -Force -NoWait | ||
Stop-AzVM -ResourceGroupName $config.dc.rg -Name $config.dcb.vmName -Force -NoWait | ||
|
||
# Switch back to original subscription | ||
$_ = Set-AzContext -Context $prevContext; |
20 changes: 20 additions & 0 deletions
20
safe_haven_management_environment/Shutdown_SHM_Mirror_VMs.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
param( | ||
[Parameter(Position=0, Mandatory = $true, HelpMessage = "Enter DSG ID (usually a number e.g enter '9' for DSG9)")] | ||
[string]$shmId | ||
) | ||
|
||
Import-Module Az | ||
Import-Module $PSScriptRoot/../new_dsg_environment/dsg_deploy_scripts/DsgConfig.psm1 -Force | ||
|
||
# Get SHM config | ||
$config = Get-ShmFullConfig($shmId) | ||
|
||
# Temporarily switch to SHM subscription | ||
$prevContext = Get-AzContext | ||
$_ = Set-AzContext -SubscriptionId $config.subscriptionName; | ||
|
||
Write-Host "===Stopping all Mirror Servers===" | ||
Get-AzVM -ResourceGroupName "RG_SHM_PKG_MIRRORS" | Stop-AzVM -Force -NoWait | ||
|
||
# Switch back to original subscription | ||
$_ = Set-AzContext -Context $prevContext; |