0
votes

I have an Azure Function which writes to an Azure SQL DB. Sometimes it works, other times I get an error...

Cannot open server 'removed' requested by the login. Client with IP address 'removed' 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. It may take up to five minutes for this change to take effect.

The function is running on a consumption plan and connects to SQL with managed identity. From what I understand the IP address won't stay the same and seemingly this is likely what it happening as sometimes it can connect and other times it can't.

Any ideas on how to make it always connect?

1

1 Answers

1
votes

My issue turned out to be that the DB had been created with a firewall rule for 1 IP named Azure. This was somehow set to the IP address the function app was sometimes using. No idea how this got setup.

The DB firewall rules have a switch to allow Azure resources to connect. No need for v-net and premium plans, unless you want it more secure.

enter image description here