Hello @Apurva Pathak,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
Thank you for your detailed description of the scenario and sharing the log snippets. Here’s some clarity on what’s happening:
When you access Azure Storage from within Azure using private connectivity options such as Service Endpoints or Private Endpoints, the traffic remains inside Azure’s internal network. In this case, Azure Storage logs the source IP as the private IP address of your VM or firewall, not the public IP. This is expected behavior because the connection never goes out over the public internet.
As a result, if you have configured your Storage account to allow access only from specific public IP addresses, it won't align with which IP is actually logged or used for access control when private connectivity is involved.
If you want Azure Storage to recognize and log your public IP for access control, you need to:
- Avoid using private connectivity options like Service Endpoints or Private Endpoints.
- Ensure your VM or firewall egresses traffic directly to the internet using its dedicated public IP.
- Whitelist this public IP in the Storage account’s firewall and virtual network settings.
Once set up this way, Azure Storage will log the public IP and enforce access based on IP allow-listing correctly.
Alternatively, if you want to keep using private connectivity for better security, here’s what to know:
- Access control happens using virtual network and subnet rules instead of public IP allow-listing.
- Azure Storage will always log the internal private IP of your VM or firewall.
- You must configure the Storage account firewall to allow the virtual network or subnet that your VM/firewall belongs to.
To verify whether you are hitting a private endpoint, you can run the command:
nslookup <yourstorageaccount>.blob.core.windows.net
To resolve this issue and ensure the storage account correctly identifies the outbound public IP, the most reliable solution is to route traffic through a NAT Gateway or an Azure Firewall with SNAT enabled. This guarantees that all outbound traffic uses a consistent public IP address, which will then appear in logs and match firewall rules.
If you prefer to retain private connectivity for security purposes, avoid relying on public IP–based firewall rules. Instead, configure Virtual Network rules or use Private Endpoints along with Private DNS zones. These approaches are fully supported and documented under Azure NAT Gateway, Private Endpoint and DNS, and Storage Firewall and VNet rules.
Azure Storage Private Endpoints https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints
Troubleshoot Azure Private Endpoint DNS issues https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns
Configure network rules for Azure Storage https://learn.microsoft.com/en-us/azure/storage/common/storage-network-security-guide
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.