Is it possible to create an alert when someone logs into a Windows Virtual Machine and send it to an e-mail address?

Jerrol Mossel 21 Reputation points
2022-03-08T20:30:41.9+00:00

We have a few Windows 2019 VMs (no ADDS so standalone) but like to have a signal/alert when somebody tries to login locally the Windows server VM.

KR

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,105 questions
0 comments No comments
{count} votes

Accepted answer
  1. Manu Philip 16,966 Reputation points MVP
    2022-03-09T06:53:06.567+00:00

    Yes, it is possible to create an alert and send to the desired email/sms etc. when a user logins the azure virtual machine.
    Here is how I am setting it up to get an email alert.
    VM Blade >Monitoring> Diagnostic settings>Enable Guest Level Monitoring Make sure that you have a storage account at the same region
    181285-image.png
    'Enable' Insights under Monitoring>Insights
    181286-image.png

    Monitoring>Alerts->Create New Alert Rule
    181331-image.png

    Select a Custom query as follows

    VMConnection | where Direction == "inbound" | where Protocol == "tcp" | where DestinationPort == 3389  
    

    181341-image.png

    Create an Action Group to send alerts
    181294-image.png
    Select the preferred way of getting alerts
    181295-image.png
    Select the preferred Alert Logic
    181351-image.png

    Set Alert details as per the preference
    181240-image.png

    Now you are ready to save the alert rules. It may take couple of minutes to start getting the alerts. Then you will start receiving the alerts something like follows when there is an RDP connection detected like following message in your inbox
    181288-image.png

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Jerrol Mossel 21 Reputation points
    2022-03-09T21:48:56.81+00:00

    @Manu Philip ,
    Thank you. I will try it out and let you know :).

    0 comments No comments

  2. Linebaugh, Jacob 1 Reputation point
    2022-03-10T15:36:59.013+00:00

    I set this up, but get nothing in the query results. I am using SSH and adjusted. I simply query the entire log and nothing there. Do you have to adjust logging level or anything?181974-2022-03-10-10-31-24.png


  3. Jerrol Mossel 21 Reputation points
    2022-03-10T20:37:23.163+00:00

    It worked for me in one GO on a Windows VM. Thank you.
    Is it also possible to see who has logged in?


  4. Linebaugh, Jacob 1 Reputation point
    2022-03-10T20:38:04.71+00:00

    yeah there is an appearent issue with the linux agent. microsoft likes to half-bake things

    0 comments No comments