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

Nilavarasi Sivasankaran (Nila) 21 Reputation points
2022-01-03T10:18:20.107+00:00

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 Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,197 questions
Azure Firewall Manager
Azure Firewall Manager
An Azure service that provides central network security policy and route management for globally distributed, software-defined perimeters.
85 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,997 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ronen Ariely 15,096 Reputation points
    2022-01-03T13:16:11.937+00:00

    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

    0 comments No comments

0 additional answers

Sort by: Most helpful