-
Notifications
You must be signed in to change notification settings - Fork 9
/
RecoverFilefromLinuxVM.azcli
35 lines (23 loc) · 1.03 KB
/
RecoverFilefromLinuxVM.azcli
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
$recoveryServicesVaultName = "mac-rsv00"
$resourceGroupName = "mac-vm-rg"
$virtualMachineName = "mac-ubuntu00"
$location = "westeurope"
$adminName = "macadmin"
#get public IP
az vm show --resource-group $resourceGroupName --name $virtualMachineName -d --query [publicIps] --o tsv
#log in to vm
ssh macadmin@<publicIP>
#delete file
sudo rm /var/www/html/index.nginx-debian.html
# get recovery point name
az backup recoverypoint list --resource-group mac-backup-rg --vault-name mac-rsvault00 --item-name mac-ubuntu00 --container-name mac-ubuntu00 --query [0].Name --output tsv
# mount recovery drive
az backup restore files mount-rp --resource-group $resourceGroupName --vault-name $recoveryServicesVaultName --container-name $virtualMachineName --item-name $virtualMachineName --rp-name <rpname>
#run script
scp myVM_we_1571974050985163527.sh macadmin@<public ip>:
#log in to vm
ssh macadmin@<publicIP>
# add execute permissions
chmod +x myVM_we_1571974050985163527.sh
./ name
sudo cp <dirname>/var/www/html/index.nginx-debian.html /var/www/html/