I'm trying to restrict access to endpoints on my virtual machine only to specific external IP addresses. Having looked into it I found that a Network Security Group on Azure may be appropriate. I created a network security group and attached it to the subnet of my Virtual Network.
I then created these two rules which I thought should only allow access by one specified IP address:
The rules are below:
- Source: IP Addresses
- Source IP address range: *
- Source port range: *
- Destination: *
- Destination port range: *
- Protocol: Any
- Action Deny
- Priority: 1000
- Name: Deny-All
- Source: IP Addresses
- Source IP Address Range: XX.XXX.XXX.XX
- Source Port Range: *
- Destination: Any
- Destination Port Range: *
- Protocol: Any
- Action: Allow
- Priority: 700
- Name: Allow-Specific
However when I try to access the endpoint from the specified IP address I appear to be blocked. Does anyone know if I have forgotten a step or done something wrong. The NSG is blocking access but I can't seem to get the white list working.
I have checked the NSG logs but unfortunately I am unable to check what the source IP address is. Perhaps it is possible that the source IP address is getting changed somewhere along the pipeline and is changed before it hits the NSG rules.