We have a VM with a vnet containing a subnet (call the subnet data-subnet) with the Microsoft.Sql service endpoint in eastus2 region.
In the same subscription we have an Azure SQL Database in the same region in a different resource group with a vnet rule using the data-subnet mentioned above from the VM's virtual network.
When we try to connect to the SQL Server from the VM we get this error message:
Invoke-Sqlcmd : Cannot open server 'yada' requested by the login. Client with IP address
'137.yada.yada.yada' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or
run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.
But we already added the vnet subnet rule to the sql server for a subnet that the server already has. It almost looks like it is trying to connect to the SQL Server using a public IP address rather than the subnet. Indeed the subnet AddressPrefix starts with 172... not 137.
We have also made sure the vm, vnet, and sql server are in the same region.
We have successfully set this up in Azure with other VMs using a completely different subscription, but this VM has more than one subnet (under one vnet), which we haven't tested previously.
Any ideas as to what we need to do more?