Introduction
In the evolving landscape of hybrid cloud security, rapid response to network threats is critical. Azure Local SDN enables fine-grained network controls for on-premises and hybrid infrastructures, while Power Automate offers an accessible automation platform that integrates with security alerts. In this article, we explore how to automatically isolate compromised hosts by updating Azure Local SDN Network Security Groups (NSGs) or Software Load Balancer (SLB) rules with Power Automate flows triggered by security events.
This step-by-step guide is designed for IT architects, security admins, and sysadmins who want to operationalize incident response, minimize dwell time, and enforce consistent security controls at scale.
Table of Contents
- Why Automate Network Isolation?
- Azure Local SDN Security Building Blocks
- Power Automate for Incident Response
- Scenario Overview and Architecture
- Step-by-Step: Building the Automated Isolation Workflow
- Prerequisites
- Step 1: Triggering on Security Alerts
- Step 2: Power Automate Flow Design
- Step 3: Invoking PowerShell for SDN Rule Changes
- Step 4: Modifying NSG/SLB Rules
- Step 5: Verification and Recovery
- End-to-End Example: Code and Flow
- Best Practices and Compliance
- Summary and Next Steps
1. Why Automate Network Isolation?
Manual response to compromised endpoints introduces delays and inconsistency. Automating network isolation offers:
- Rapid containment, reducing attack surface
- Repeatable, auditable response to incidents
- Integration with SIEM, XDR, and EDR systems for closed-loop security
By connecting security events to automated remediation, organizations improve their overall security posture and compliance with regulatory frameworks.
2. Azure Local SDN Security Building Blocks
Azure Local SDN delivers modern, software-defined network controls for on-premises and hybrid deployments. Key components:
- Network Security Groups (NSGs): Define inbound and outbound security rules for VNets and subnets.
- Software Load Balancer (SLB): Provides L4-L7 traffic steering, with granular ACL controls.
- Automation Interfaces: PowerShell, REST API, and integration with Power Platform (including Power Automate).
3. Power Automate for Incident Response
Power Automate provides event-driven workflows that can bridge security tools and SDN automation. With built-in connectors and PowerShell integration, security teams can automate:
- Real-time incident response actions
- Custom alert-to-remediation pipelines
- Audit and notification steps
4. Scenario Overview and Architecture
Objective: Automatically isolate a compromised host by blocking its network traffic using Azure Local SDN NSG or SLB rules, triggered by a security alert.
Architecture Diagram

5. Step-by-Step: Building the Automated Isolation Workflow
Prerequisites
- Azure Local SDN deployed with NSG/SLB in use
- Power Automate environment with gateway to execute scripts on-prem
- Security alerts from SIEM or Defender
- Permissions to modify NSG/SLB with PowerShell
Step 1: Triggering on Security Alerts
Use a security platform that supports event forwarding to Power Automate. Example: Microsoft Sentinel sends an HTTP POST webhook when a host is detected as compromised.
Step 2: Power Automate Flow Design
The flow will:
- Receive the security alert payload (hostname, IP, reason)
- Parse the details
- Trigger an on-premises PowerShell script to update SDN rules
- Log action and notify relevant stakeholders
Step 3: Invoking PowerShell for SDN Rule Changes
Install and configure the On-premises Data Gateway for Power Automate. Set up a custom connector or use the “Run PowerShell Script” action.
Step 4: Modifying NSG/SLB Rules
PowerShell scripts will dynamically update SDN security rules to block inbound and outbound traffic from the compromised endpoint.
Step 5: Verification and Recovery
After isolation, verify connectivity status. Provide a recovery mechanism for authorized unblocking after remediation.
6. End-to-End Example: Code and Flow
Example Security Alert Payload
{
"hostname": "SRV-WIN-01",
"ipAddress": "10.10.20.15",
"alertType": "SuspiciousTraffic",
"timestamp": "2025-07-09T08:00:00Z"
}
Power Automate Flow Structure
- Trigger: HTTP request from SIEM/Sentinel
- Parse: Extract host details
- Run PowerShell Script: Pass variables to PowerShell via On-premises Data Gateway
- Notify: Send Teams/email notification to security team
Flow Overview (Pseudo-steps)

PowerShell Script: Isolating Host via NSG
Script: Update-AzureLocalNSG.ps1
param(
[string]$HostIP,
[string]$NSGName,
[string]$ResourceGroup
)
# Import SDN/NSG PowerShell modules
Import-Module AzureStack.Network
# Block all inbound and outbound traffic for HostIP
$denyRuleName = "Deny-$HostIP"
# Add inbound deny rule
Add-AzsNetworkSecurityRule -Name $denyRuleName `
-NetworkSecurityGroupName $NSGName `
-ResourceGroupName $ResourceGroup `
-Priority 100 `
-Direction Inbound `
-Access Deny `
-SourceAddressPrefix $HostIP `
-DestinationAddressPrefix '*' `
-Protocol '*' `
-SourcePortRange '*' `
-DestinationPortRange '*'
# Add outbound deny rule
Add-AzsNetworkSecurityRule -Name "$denyRuleName-Out" `
-NetworkSecurityGroupName $NSGName `
-ResourceGroupName $ResourceGroup `
-Priority 101 `
-Direction Outbound `
-Access Deny `
-SourceAddressPrefix '*' `
-DestinationAddressPrefix $HostIP `
-Protocol '*' `
-SourcePortRange '*' `
-DestinationPortRange '*'
Note: Adjust NSGName and ResourceGroup parameters as required for your environment. To unblock, remove these rules using Remove-AzsNetworkSecurityRule.
PowerShell Script: Isolating Host via SLB (Optional)
param(
[string]$HostIP,
[string]$SLBRuleName,
[string]$ResourceGroup
)
# Import SDN/SLB PowerShell modules
Import-Module AzureStack.Network
# Update SLB rule to remove/deny $HostIP
Set-AzsLoadBalancerRule -Name $SLBRuleName `
-ResourceGroupName $ResourceGroup `
-BackendAddressPool @()
# Or update BackendAddressPool to exclude HostIP
Power Automate – Run PowerShell Action Example
Configure the “Run a PowerShell Script” action with parameters mapped from the parsed alert payload:
HostIP=alert.ipAddressNSGName= NSG for host’s subnetResourceGroup= Resource group of the NSG
Notification Step
Add an action to send a message to Microsoft Teams or email:
"Host SRV-WIN-01 (10.10.20.15) has been isolated via SDN NSG update following a SuspiciousTraffic alert."
7. Best Practices and Compliance
- Use least-privilege permissions for automation accounts.
- Maintain audit logs for all automated actions.
- Test automation in a non-production environment before live deployment.
- Define rollback procedures for accidental or false positive isolations.
- Align with your organization’s incident response policy and compliance requirements.
8. Summary and Next Steps
By integrating Power Automate with Azure Local SDN, organizations can achieve rapid, consistent, and auditable network isolation as part of their incident response workflow. This approach enables proactive security controls for hybrid environments, reducing manual effort and minimizing breach impact.
Next Steps:
- Extend workflows to cover additional response actions (quarantine, ticketing, forensic snapshot).
- Integrate with more advanced detection sources (EDR/XDR).
- Automate recovery and notification for resolved incidents.
Disclaimer: The views expressed in this article are those of the author and do not represent the opinions of Microsoft, my employer or any affiliated organization. Always refer to the official Microsoft documentation before production deployment.
Introduction In the evolving landscape of hybrid IT, the fusion of Software-Defined Networking (SDN) with artificial intelligence (AI) is transforming how organizations...