Hi all,
I'm using the following to deploy a SQL Server virtual machine. This machine allows mixed type authentication and allows external connections.
imageReference {
publisher: 'microsoftsqlserver'
offer: 'sql2022-ws2022'
sku: 'standard-gen2'
version: 'latest'
}
I have another machine in the same subnet that hosts a .NET 4.8 application that is attempting to connect to this database. However, I'm unable to connect. I've tried the following security group on the SQL VM, but this does not seem to open up anything.
resource nsg 'Microsoft.Network/networkSecurityGroups@2023-09-01' = {
name: 'sql-access-nsg'
location: location
properties: {
securityRules: [
{
name: 'AllowSQL'
properties: {
description: 'Allow SQL Server access'
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '1433'
sourceAddressPrefix: '10.0.0.5'
destinationAddressPrefix: '10.0.0.4'
access: 'Allow'
priority: 100
direction: 'Inbound'
}
}
]
}
}
The only thing that confirms the fact that I'm able to connect to the SQL VM is adding a network firewall rule to open up all traffic on 1443.
New-NetFirewallRule -DisplayName "SQL Server" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow
What's funny is that I can connect over 80/443 on this SQL VM just fine even without a NSG defined.
Both of these VMs are on a peered VPN network, but using netstat -an
on the SQL machine I can see that the incoming connection after enabling the above firewall rule shows as 10.0.0.5. The connecting machine also has a public IP which has its own NSG applied to allow HTTP/HTTPS and that works as expected.
Maybe I'm missing some documentation here, or things are a bit more strict in these SQL VMs. Any guidance is appreciated.
Thanks!