How to set up an alert when a subnet is created in Azure?

32373548 30 Reputation points
2023-10-02T15:53:22.4466667+00:00

I am looking to set up an alert in my Azure Subscription when a new subnet is created in a Virtual Network in Azure

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,328 questions
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,520 questions
{count} vote

Accepted answer
  1. msrini-MSFT 9,286 Reputation points Microsoft Employee
    2023-10-03T08:12:25.7066667+00:00

    Hi,

    Subnet is not a resource type. It is a sub-resource of Virtual Network. Subnet update operation is a VNET PUT operation.

    if you enable an alert for any PUT on VNET, then you might get alert not only for the subnet update, but also for the VNET updates like DNS, VNET peering, etc.

    User's image

    If you want only subnet operation, then you can select the custom log search and optimize the query.

    Regards,

    Karthik Srinivas

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Ketan Kumar 0 Reputation points
    2023-10-02T16:47:11.54+00:00

    Azure portal > Monitor services > Alerts > + New alert > resource type: Subnet > signal type: Creation > Next > Configure alert condition > Next > Configure alert action > Create alert rule > DONE 🎉


  2. David Broggy 5,906 Reputation points MVP
    2023-10-02T18:01:24.1033333+00:00

    I'll just add to that:
    Enable logging of Azure Activity logs to Azure Monitor
    https://learn.microsoft.com/en-us/azure/azure-monitor/logs/data-platform-logs

    NOW you can create alerts based on any changes shown in the Azure activity logs.

    additional references:

    https://medium.com/@pradeepgupta_9558/azure-nsg-change-alerts-using-azure-monitor-service-e37e4760d6ca

    0 comments No comments

  3. tbgangav-MSFT 10,416 Reputation points
    2023-10-03T09:41:58.97+00:00

    Hi @32373548 ,

    In addition to David Broggy's response, below are the steps to set up an alert when a subnet is created in a Virtual Nework in Azure.

    1. Go to Azure Monitor > Alerts > Create > Alert rule User's image
    2. Under Scope section, select your subscription User's image
    3. Under Condition section, click on 'See all signals' link and in the search by signal name pane, search with the action word "Microsoft.Network/virtualNetworks/subnets/write" because as per this document, "Microsoft.Network/virtualNetworks/subnets/write" is the action that gets generated while creating a virtual network subnet or updating an existing virtual network subnet. Select the activity log signal "
      Create or Update Virtual Network Subnet (Virtual Network Subnet)" and click 'Apply'. User's image
    4. Next under Actions section, select the action group.
    5. Next under Details and Tags sections, update details as appropriate.
    6. Next under Review + create section, click 'Create'.

    Or if you have configured to send activity logs to Log Analytics Workspace then create custom log alert based alert rule with the kusto query something like shown below which will basically query the AzureActivity kusto table.

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.