question

NilavarasiSivasankaranNila-3225 avatar image
0 Votes"
NilavarasiSivasankaranNila-3225 asked pituach answered

Cannot able to connect Azure VM after changing firewall settings to ufw allow https

I have Installed Nginx.
I have updated UFW firewall settings to allow https, I haven't allow ssh. Now I can't able to get into my virtual machine.
I want to remove the old firewall settings from Virtual Machine without doing ssh.

azure-virtual-networkazure-firewall-managerazure-webapps-ssh
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

pituach avatar image
0 Votes"
pituach answered

Hi,

You can execute scripts on your Virtual Machine even if you cannot login to it, since the Azure add an agent in the VM by default. Using the script you can enable ssh, uninstall the ufw or do whatever you want.

Any script you execute from the portal (as the following explanation) is executed as root/administrator.

How to execute script on the VM when you cannot login :


If you are using windows VM then:
Logon to the Azure portal-> select the VM -> on the left menu select Run command -> select RunPowerShellScript

If you this is Ubuntu VM then:
Logon to the Azure portal -> VM Name -> Extensions -> Add -> Select "Custom Script for Linux" > Create

Uncomplicated Firewall (UFW) uses a command-line interface which mean that using the above option you can run and control UFW using the script you execute even if you cannot login the VM

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.