Azure: Get email when VM instance state changes

To set up email notification in Azure environment when VM changes the state, you should do the following:

1. In the Azure portal, select Service Health

2. From the left side panel choose Resource health -> click Create Resource Health alert rule

Fill in the necessary fields:

In the Actions section, you have to indicate action groups. As long as we have not created any before, let’s click Add action groups -> Create action group

And fill in the following fields:

Click Review + create -> Create.

After creating the group you will see that the new group was chosen automatically. Fill in fields under Alert rule details:

Click Create alert rule.

3. Go to the Resource Group (in my case marirac2) where you have created Action Group.

Resource groups -> marirac2 -> from the left-side panel choose Alerts -> Action groups -> choose action group name in my case mariactgrp -> on the Notifications section choose Email/SMS message/Push/Voice -> on the right-side panel click Email checkbox -> enter email address who will be responsible for receiving and handling these alerts -> click OK -> enter desirable name under Notifications section -> click Save changes.

4. Test alert by stopping and starting the VM (assuming it is a test environment)

After changing the state of the VM you will receive the following notification.

Please note notification should have been sent as soon as VM changes the state but email can come 2 – 3 min later.


Virtualbox connect from host to guest via ssh and enable internet on guest

  1. Open Oracle VM Virtualbox Manager


  2. Place the cursor on the machine that you want to configure and press the button Settings.
    -> Network -> Adapter 1-> check Enable Network Adapter -> in Attached to choose NAT.
    -> in Advanced section -> press Port Forwarding  -> in Port Forwarding Rules, press addition button ->
    Fill the rule , by the following way:
    Host IP: (leave blank)
    Host Port: 22   (or any port that your host has free)
    Guest IP: (leave blank)
    Guest Port: 22


  3. Start up the VM and connect to the guest using ssh.
    Hostname: localhost (or your machine name)
    Port: 22 (it is the same that we have indicated during rule configuration field Host Port)


  4. If you are not using proxy, than you can think that the post finished for you. You can connect to the guest from os and also you have an internet on your guest.

    But if proxy is used then you should configure parameter http_proxy.
    You can enter this variable information in every user’s  ~/.bash_profile or you can do it globally in /etc/profile file.

    #add the following entry in profile file

    [root@oracle01 ~]# vi /etc/profile
    export http_proxy=

    Logout and login for changes to take effect.