forked from dibaskar/encryptedvm-support-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnew-rescue.ps1
More file actions
477 lines (355 loc) · 20.3 KB
/
new-rescue.ps1
File metadata and controls
477 lines (355 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<#
.SYNOPSIS
Creates a Rescue VM and attaches the OS Disk of the problem VM to this intermediate rescue VM.
.DESCRIPTION
This script automates the creation of Rescue VM to enable fixing of OS disk issues related to a problem VM.
In such cases it is a common practice to recover the problem VM by performing the following steps. These are the steps that are performed by the script.
-Stops the problem VM
-Take a snapshot of the OS Disk
-Create a Temporary Rescue VM
-Attach the OS Disk to the Rescue VM
-Starts the Rescue VM
-RDPs to RescueVM (For Windows)
.PARAMETER VmName
This is a mandatory Parameter, Name of the problem VM that needs to be recovered.
.PARAMETER ResourceGroupName
This is a mandatory Parameter, Name of the resource group the problem VM belongs to.
.PARAMETER SubscriptionId
Optional Parameter, SubscriptionID the VM belongs to.
.PARAMETER showErrors
Optional Parameter. By default it is set to true, so it displays all errors thrown by PowerShell in the console, if set to False it runs in silentMode.
.PARAMETER prefix
Optional Parameter. By default the new Rescue VM and its resources are all created under a resource group named same as the original resource group name with a prefix of 'rescue', however the prefix can be changed to a different value to override the default 'rescue'
.PARAMETER UserName
Optional Parameter. Allows to pass in the user name of the rescue VM during its creation, by default during case creation it will prompt
.PARAMETER Password
Optional Parameter. Allows to pass in the password of the rescue VM during its creation, by default t will prompt for password during its creation
.PARAMETER AllowManagedVM
Optional Parameter. This allows the script to support Managed VM's also, however prior to that the SubscriptionID needs to be whitelisted to be able to use the OS Disk Swap feature formanaged VM's.
.PARAMETER Sku
Optional Parameter. Allows to pass in the SKU of the preferred image of the OS for the Rescue VM
.PARAMETER Offer
Optional Parameter. Allows to pass in the Offer of the preferred image of the OS for the Rescue VM
.PARAMETER Publisher
Optional Parameter. Allows to pass in the Publisher of the preferred image of the OS for the Rescue VM
.PARAMETER Version
Optional Parameter. Allows to pass in the Version of the preferred image of the OS for the Rescue VM
.EXAMPLE
Example using all the mandatory fields:
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName sujtemp -VmName sujnortheurope -subscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
.EXAMPLE
Examples with optional parametersm in this example it will create the rescue VM with RedHat installed
$scriptResult = .\New-AzureRMRescueVM.ps1 -VmName ubuntu -resourceGroupName portalLin -subscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Publisher RedHat -Offer RHEL -Sku 7.3 -Version 7.3.2017090723 -prefix rescuered
.EXAMPLE
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName sujtemp -VmName sujnortheurope -subscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex2"
.EXAMPLE
Example for managed disk VM:
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName sujasrg -VmName sujunmanagedP -subscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex0011"
.EXAMPLE
Example for managed disk VM
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName recoveryVMRg -VmName recovmtestmg -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex2"
.EXAMPLE
Example for marketplace image with Plan
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName recoverytest -VmName datasciencevm -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex17" -AllowManagedVM
.EXAMPLE
Using a VM created from a custom image:
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName testvmrecovery2 -VmName win2016custom -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex18"
.EXAMPLE
Using a VM Unmanaged Windows VM
$scriptResult = .\New-AzureRMRescueVM.ps1 -resourceGroupName testvmrecovery2 -VmName sujUNManagedvm -UserName "sujasd" -Password "XPa55w0rrd12345" -prefix "rescuex48"
.NOTES
Name: New-AzureRMRescueVM.ps1
To get help on the below script run get-help .\New-AzureRMRescueVM.ps1
#>
param(
[Parameter(mandatory=$true)]
[String]$vmName,
[Parameter(mandatory=$true)]
[String]$ResourceGroupName,
[Parameter(mandatory=$true)]
[String]$Encryption_type,
[Parameter(mandatory=$true)]
[String]$rescueVMName,
[Parameter(mandatory=$false)]
[String]$subscriptionId,
[Parameter(mandatory=$true)]
[String]$rescuevmusername,
[Parameter(mandatory=$true)]
[String]$rescuevmpassword,
[Parameter(mandatory=$false)]
[String]$UserName,
[Parameter(mandatory=$false)]
[Bool]$showErrors=$true,
[Parameter(mandatory=$false)]
[String]$prefix = 'rescue',
[Parameter(mandatory=$false)]
[String]$Sku,
[Parameter(mandatory=$false)]
[String]$Offer,
[Parameter(mandatory=$false)]
[String]$Publisher,
[Parameter(mandatory=$false)]
[String]$Version,
[switch]$AllowManagedVM = $true
)
Write-Host 'Checking Disk Encryption Status' -ForegroundColor DarkGreen
$Encryption_status=$(Get-AzureRmVmDiskEncryptionStatus -ResourceGroupName $ResourceGroupName -VMName $vmName | grep -i OsVolumeEncrypted | awk -F":" '{print $2}' | sed 's/^ *//')
IF ($Encryption_status -ne "Encrypted")
{
Write-Host "############### OS Disk is not Encrypted. Cannot proceed with the script ##################" -ForegroundColor DarkGreen
#exit
}
ELSE
{
Write-Host "################# OS Disk is Encrypted. Proceeding further execution. #####################" -ForegroundColor DarkGreen
}
$script:scriptStartTime = (get-date).ToUniversalTime()
$timestamp = get-date $script:scriptStartTime -f yyyyMMddHHmmss
$scriptPath = split-path -path $MyInvocation.MyCommand.Path -parent
$scriptName = (split-path -path $MyInvocation.MyCommand.Path -leaf).Split('.')[0]
$logFile = "$scriptPath\$($scriptName)_$($vmName)_$($timestamp).log"
$restoreCommandFile = "Restore_" + $vmName + ".ps1"
set-location $scriptPath
$commonFunctionsModule = "$scriptPath\Common-Functions.psm1"
#Import-Module Common-Functions -ArgumentList $logFile -ErrorAction Stop
if (get-module Common-Functions)
{
remove-module -name Common-Functions
}
import-module -Name $commonFunctionsModule -ArgumentList $logFile -ErrorAction Stop
$EventName = "Started"
$scriptVersion = "1.0.0"
$scriptRunId = [System.Guid]::NewGuid()
$Message = "Started execution of the script"
LogToAppInsight -EventName $EventName -scriptname $MyInvocation.MyCommand.Name -Command $MyInvocation.Line -Scriptversion $scriptVersion -Message $Message -RunID $scriptRunId
#write-log "Log file: $logFile"
#write-log $MyInvocation.Line -logOnly
#Checks to see if AzureRM is available
if (-not (get-module -ListAvailable -name 'AzureRM.Profile') -and (-not $env:ACC_CLOUD))
{
$message = "[Error] Azure PowerShell not installed. Either install Azure PowerShell from https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps or use Cloud Shell PowerShell at https://shell.azure.com/powershell"
write-log $message -color red
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
if (-not (Get-AzureRmContext).Account)
{
$null = Login-AzureRmAccount
}
if (-not $subscriptionId)
{
write-log "[Running] Getting authentication context"
$authContext = Get-AzureRmContext
if (-not $authContext.Subscription.Id)
{
$message = "[Error] Unable to determine subscription ID. Run the script again using -SubscriptionID to specify the subscription ID."
write-log $message -color red
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
}
else
{
#Set the context to the correct subscription ID
write-log "[Running] Setting context to subscriptionId $subscriptionId"
$authContext = Set-AzureRmContext -SubscriptionId $subscriptionId
write-log $authContext -logOnly
if (-not $authContext.Subscription.Id)
{
$message = "[Error] Unable to set context to subscription ID $subscriptionId. Run Login-AzureRMAccount and then try the script again."
write-log $message -color red
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
}
$subscriptionId = $authContext.Subscription.Id
$subscriptionName = $authcontext.Subscription.Name
$accountId = $authContext.Account.Id
$accountType = $authContext.Account.Type
$tenantId = $authContext.tenant.Id
$environmentName = $authContext.Environment.Name
write-log "[Success] Using subscriptionId: $subscriptionId, subscriptionName: $subscriptionName" -color green
write-log "AccountId: $accountId" -logOnly
write-log "AccountType: $accountType" -logOnly
write-log "TenantId: $tenantId" -logOnly
write-log "Environment: $environmentName" -logOnly
# Step 1 Get VM object
write-log "[Running] Get-AzureRmVM -resourceGroupName $resourceGroupName -Name $vmName"
try
{
$vm = Get-AzureRmVM -ResourceGroupName $resourceGroupName -Name $vmName -ErrorAction Stop -WarningAction SilentlyContinue
}
catch
{
$message = "[Error] Problem VM $vmName not found in resource group $resourceGroupName in subscription $subscriptionId. Verify the vmName, resourceGroupName, and subscriptionId and run the script again."
write-log $message -color red
write-log "Exception Type: $($_.Exception.GetType().FullName)" -logOnly
write-log "Exception Message: $($_.Exception.Message)" -logOnly
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
write-log "`$vm: $vm" -logOnly
if (-not (SupportedVM -vm $vm -AllowManagedVM $AllowManagedVM))
{
$message = "[Error] Problem VM $($vm.name) is not supported."
write-log $message -color red
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
write-log "[Success] Found problem VM $($vm.Name)" -color green
if ($vm.StorageProfile.OsDisk.ManagedDisk)
{
$managedVM = $true
}
else
{
$managedVM = $false
}
write-log "[Running] Getting OsType for problem VM $vmName"
if ($vm.StorageProfile.OsDisk.OsType -eq 'Windows')
{
$windowsVM = $true
}
else
{
$windowsVM = $false
}
write-log "[Success] Problem VM $vmName OsType is $($vm.StorageProfile.OsDisk.OsType)" -color green
# Step 2 Stop problem VM
$stopped = StopTargetVM -resourceGroupName $resourceGroupName -VmName $vmName -Force
write-log "`$stopped: $stopped" -logOnly
if (-not $stopped)
{
$message = "[Error] Unable to stop problem VM $vmName"
write-log $message -color red
$scriptResult = Get-ScriptResultObject -scriptSucceeded $false -rescueScriptCommand $MyInvocation.Line -FailureReason $message -Scriptversion $scriptVersion -RunID $scriptRunId
return $scriptResult
}
$vm_details=$(az vm show -g $resourceGroupName -n $vmName)
$offer=$(echo $vm_details | jq ".storageProfile.imageReference.offer")
$Publisher=$(echo $vm_details | jq ".storageProfile.imageReference.publisher")
$sku=$(echo $vm_details | jq ".storageProfile.imageReference.sku")
$Version=$(echo $vm_details | jq ".storageProfile.imageReference.version")
$location=$(echo $vm_details | jq '.location' | tr -d '"')
$urn=$publisher,$offer,$sku,$version
$image_urn=$(echo $urn | xargs | sed 's/ /:/g')
$os_disk=$(echo $vm_details| jq ".storageProfile.osDisk")
$disk_uri=$(echo $os_disk | jq ".managedDisk.id")
$disk_uri=$($disk_uri -replace '"', "")
Write-Host '################## Generating Snapshot of problematic's OS Disk ####################' -ForegroundColor DarkGreen
$time=date +%d-%m-%Y-%T
$source_disk_name=$(echo $disk_uri | awk -F"/" '{print $NF}')
$snapshot_name=$((echo $disk_uri | awk -F"/" '{print $NF}') -replace '_', "-")
$snapshot_name=$((echo $snapshot_name-snap-$time) -replace ":","-")
$target_disk_name=$((echo $disk_uri | awk -F"/" '{print $NF}') -replace '_', "-")
$target_disk_name=$((echo $target_disk_name-copy-$time) -replace ":", "-")
az snapshot create -g $resource_group $resourceGroupName -n $snapshot_name --source $source_disk_name -l $location
Write-Host '################### Creating disk from snapshot ####################' -ForegroundColor DarkGreen
$snapshotId=$(az snapshot show --name $snapshot_name --resource-group $resourceGroupName --query [id] -o tsv)
$disk_type=$(az disk list --output table | grep -i $source_disk_name | awk '{print $4}')
az disk create --resource-group $resourceGroupName --name $target_disk_name -l $location --sku $disk_type --source $snapshotId
Write-Host '################### Creating Rescue VM ####################' -ForegroundColor DarkGreen
az vm create --name $rescueVMName -g $resourceGroupName --location $location --admin-username $rescuevmusername --admin-password $rescuevmpassword --image $image_urn --storage-sku Standard_LRS
$rescuevmip=$(az vm show -d -g $resourceGroupName -n $rescueVMName --query publicIps -o tsv)
echo $rescuevmip
$disk= Get-AzureRMDisk -ResourceGroupName $ResourceGroupName -DiskName $source_disk_name
$keyvaulturl=$disk.EncryptionSettingsCollection.EncryptionSettings.diskencryptionkey.SecretUrl
$kekurl=$disk.EncryptionSettingsCollection.EncryptionSettings.KeyEncryptionKey.KeyUrl
#$Encryption_type=$disk.EncryptionSettingsCollection.Enable
$KeyVaultName=echo $keyvaulturl | awk -F".vault.azure.net" '{print $1}' | awk -F"//" '{print $2}'
$rgKeyName=Get-AzureRmKeyVault -VaultName $KeyVaultName | grep -i "resource group" | awk -F": " '{print $2}'
$KeyVault = Get-AzureRmKeyVault -VaultName $KeyVaultName -ResourceGroupName $rgKeyName;
$diskEncryptionKeyVaultUrl = $KeyVault.VaultUri;
$KeyVaultResourceId = $KeyVault.ResourceId;
$ADEKeyName=echo $kekurl | awk -F "/" '{print $5}'
$VolumeType = 'Data';
IF ($Encryption_type -eq "Single")
{
Write-Host "################# Encryption type is single ###############" -ForegroundColor DarkGreen
Write-Host '########################### Attaching copy of OS disk to rescue VM #######################' -ForegroundColor DarkGreen
$DestVMName= "$rescueVMName"
$DestVMRG= "$resourceGroupName"
$OSDisk = Get-AzureRmDisk -ResourceGroupName $DestVMRG -DiskName $target_disk_name
$vm = get-AzureRMVM -ResourceGroupName $DestVMRG -Name $DestVMName
Add-AzureRmVMDataDisk -VM $vm -Name $target_disk_name -ManagedDiskId $osDisk.Id -Caching None -Lun 3 -CreateOption Attach
Update-AzureRMVM -VM $vm -ResourceGroupName $DestVMRG
$sequenceVersion = [Guid]::NewGuid()
<#
$val="@"
$con=":"
$path="/tmp/secret.bek"
sed -i '/secretUrl=/d' key.ps1
sed -i '/secretFilePath=/d' key.ps1
sed -i '/kekUrl=/d' key.ps1
sed -i '"1i$secretUrl='"'$keyvaulturl'"'"' key.ps1
sed -i '"2i$secretFilePath='"'$path'"'"' key.ps1
sed -i '"3i$kekUrl='"'$kekurl'"'"' key.ps1
sed -i '/Copying secret.bek/d' key.ps1
sed -i '/scp -pr/d' key.ps1
echo "Write-Host 'Copying secret.bek to rescue VM. Please provide rescue VMs password' -ForegroundColor Black -BackgroundColor DarkGreen" >> key.ps1
echo "scp -pr $path $rescuevmusername$val$rescuevmip$con$path" >> key.ps1
./key.ps1
#>
IF ( !$kekurl )
{
Write-Host "####################### Single pass encryption without KEK #####################" -ForegroundColor DarkGreen
Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $ResourceGroupName -VMName $rescueVMName -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId -VolumeType $VolumeType -SequenceVersion $sequenceVersion -skipVmBackup;
}
ELSE
{
Write-Host "################ Single pass encryption with KEK #######################" -ForegroundColor DarkGreen
$key = Get-AzureKeyVaultKey -VaultName $KeyVaultName -Name $ADEKeyName
$keyencryptionkeyurl=$key.Id
# With KEK
Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $ResourceGroupName -VMName $rescueVMName -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId -KeyEncryptionKeyUrl $keyencryptionkeyurl -KeyEncryptionKeyVaultId $KeyVaultResourceId -VolumeType $VolumeType -SequenceVersion $sequenceVersion -skipVmBackup;
}
Write-Host "#################### Copy of OS disk is successfully attached to rescue VM #####################". Please execute below commands on rescue VM to mount the OS disk. The disk order may change since the VM reboots after enabling extension please validate the disk order in lsblk, if there is a change then please modify /dev/sdc with /dev/sdd"
#mkdir /{investigateboot,investigateroot}
#mount -o nouuid /dev/sdc1 /investigateboot
#Use the below command to open the crypts lock for the osdisk.
#cryptsetup luksOpen --key-file /mnt/azure_bek_disk/LinuxPassPhraseFileName --header /investigateboot/luks/osluksheader /dev/sdc2 investigateosencrypt
#mount -o nouuid /dev/mapper/investigateosencrypt /investigateroot" -ForegroundColor Black -BackgroundColor DarkYellow
Write-Host "################ Below are your Rescue VM details #################""
RescueVM Name : $rescueVMName
Resche VM IP : $rescuevmip
Username : $rescuevmusername
Password : $rescuevmpassword" -ForegroundColor DarkGreen
exit
}
IF ($Encryption_type -eq "dual")
{
Write-Host "################## Encryption type is dual ##################" -ForegroundColor DarkGreen
Write-Host '########################### Removing encryption settings from Disk and attaching it to rescue VM #######################' -ForegroundColor DarkGreen
#$rgName = "testrg"
#$osDiskName = " copiedmanagedisk"
New-AzureRmDiskUpdateConfig -EncryptionSettingsEnabled $false |Update-AzureRmDisk -diskName $target_disk_name -ResourceGroupName $resourceGroupName
$DestVMName= "$rescueVMName"
$DestVMRG= "$resourceGroupName"
$OSDisk = Get-AzureRmDisk -ResourceGroupName $DestVMRG -DiskName $target_disk_name
$vm = get-AzureRMVM -ResourceGroupName $DestVMRG -Name $DestVMName
Add-AzureRmVMDataDisk -VM $vm -Name $target_disk_name -ManagedDiskId $osDisk.Id -Caching None -Lun 3 -CreateOption Attach
Update-AzureRMVM -VM $vm -ResourceGroupName $DestVMRG
Write-Host "############ Migrating BEK Volume to Rescue VM ###################" -ForegroundColor DarkGreen
#$SourceVMName = "redhatmanaged"
#$SourceVMRG = "encryption"
#$DestVMName = "rhelteste"
#$DestVMRG = "encryption"
#Stop-AzureRmVM -ResourceGroupName $SourceVMRG -Name $SourceVMName –Force
$SourceVM = Get-AzureRmVM -ResourceGroupName $resourceGroupName -VMName $vmName
$DestVM = Get-AzureRmVM -ResourceGroupName $resourceGroupName -VMName $rescueVMName
$DestVM.StorageProfile.OsDisk.EncryptionSettings = $SourceVM.StorageProfile.OsDisk.EncryptionSettings
Update-AzureRmVM -ResourceGroupName $resourceGroupName -VM $DestVM
echo "###############################################"
write-Host "Copy of OS disk is successfully attached to rescue VM. Please refer CSS wiki page https://www.csssupportwiki.com/index.php/curated:Azure/Virtual_Machine/Features/Disk_Encryption/TSG/General_troubleshooting_for_encrypted_managed_disk#Method_1_2" and refer Troubleshooting using ADE Dual-Pass --> Method 1 point no 9 which consists of the below commands on rescue VM to mount the OS disk. Once Troubleshooting is done Please refer point no 10 and 11 for for recreating and installing the ADE extension respectively"
# mkdir /{investigatekey,investigateboot,investigateroot}
# mount /dev/sdc1 /investigatekey
# mount -o nouuid /dev/sdd1 /investigateboot/
# cryptsetup luksOpen --key-file /investigatekey/LinuxPassPhraseFileName --header /investigateboot/luks/osluksheader /dev/sdd2 investigateosencrypt
# mount -o nouuid /dev/mapper/investigateosencrypt /investigateroot/" -ForegroundColor Black -BackgroundColor DarkYellow
Write-Host "Below are your Rescue VM details""
RescueVM Name : $rescueVMName
Resche VM IP : $rescuevmip
Username : $rescuevmusername
Password : $rescuevmpassword" -ForegroundColor DarkGreen
exit
}