Skip to content

Commit fb2495a

Browse files
committed
destroy
1 parent 5fd1890 commit fb2495a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

setup-vm.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,12 @@ export IP_ADDRESS=$(az vm show --show-details --resource-group $MY_RESOURCE_GROU
3939

4040
alias sshvm="ssh -o StrictHostKeyChecking=no $MY_USERNAME@$IP_ADDRESS"
4141

42+
echo '#!/bin/bash' > "destroyvm-$RANDOM_ID"
43+
echo "az vm delete --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_VM_NAME --yes" >> "destroyvm-$RANDOM_ID"
44+
echo "az group delete --name $MY_RESOURCE_GROUP_NAME --yes" >> "destroyvm-$RANDOM_ID"
45+
chmod +x "destroyvm-$RANDOM_ID"
46+
47+
echo
48+
echo "VM created. You can now connect to it using 'sshvm' command"
49+
echo "To destroy the VM, run 'destroyvm-$RANDOM_ID'"
4250
echo
43-
echo "VM created. You can now connect to it using 'sshvm' command"

0 commit comments

Comments
 (0)