Hello @RJ,
Thanks for reaching out on Microsoft Q&A! let me try to help with some steps
Why You Can't Delete Grayed-Out Ips:
Even though you have roles like SQL Security Manager and Subscription Admin, those roles do not give you permission to manage server-level firewall rules stored in the master database.
These rules can only be modified by.
The server-level principal login (the original SQL admin created during server setup)
Or an Azure Active Directory (AD) admin assigned to the SQL server
Become the Azure AD Admin for the SQL Server
You must be set as the Active Directory admin on the SQL logical server-not just the database.
- Go to the SQL server (not the database) in the Azure portal.
- Under Settings, click Active Directory admin.
- If your account isn’t listed, click Set admin, choose your user, then Save.
- Sign out and back in to refresh your permissions.
Delete the Grayed-Out IPs via Portal
In Azure Portal:
- Go to the SQL server --> Firewalls and virtual networks.
- You should now be able to click the trash icon next to the grayed-out IPs and Save.
In T-SQL (SQL Server Management Studio or Azure Data Studio):
- Make sure you connect to the master database using your Azure AD admin credentials.
--Connect to master database
USE master;
--Delete the rule
EXEC sp_delete_firewall_rule @name = N'ClientIPAddress_2023-06-28_01:06:27';
--Optional: Refresh cache
DBCC FLUSHAUTHCACHE;
If you get the error “User must be in the master database,” it means you're connected to the wrong database. Switch to master before running the command.
Note: Grayed-out firewall rules in Azure SQL Database can only be deleted by the server-level principal login or an Azure Active Directory (AD) admin.
Please refer this document:
https://learn.microsoft.com/en-us/azure/azure-sql/database/firewall-configure?view=azuresql&source=recommendations
Let me know if you need more details, happy to assist you further
Thanks,
Kalyani