You can run the PowerShell script below to enable a public IP address in Azure SQL database:
Import-Module Az.Accounts
Import-Module Az.Sql
Connect-AzAccount
Select-AzSubscription -SubscriptionId "<subscriptionId>"
$SecureString = ConvertTo-SecureString "<adminPassword>" -AsPlainText -Force
Set-AzSqlServer -ServerName "<serverName>" -ResourceGroupName "<RGName>" -SqlAdministratorPassword $SecureString -PublicNetworkAccess "Enabled"
You can see the result as shown below:

And the public network access is enabled as mentioned below:

As per this, if you add a firewall rule with 0.0.0.0 as the start and end IP address to the SQL server, then "Allow Azure services and resources to access this server" is set to yes. Run the script below to set the firewall rule:
az sql server firewall-rule create --resource-group "<RGName>" --server "<serverName>" -n "<firewallRuleName>" --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
You can see the result as mentioned below:

And "Allow Azure services and resources to access this server" is set to yes, as mentioned below:

You can run the script below to add the current IP address to the SQL server. Invoke 'https://api.ipify.org' to get the current IP, as mentioned below:
$ipAddress = Invoke-WebRequest 'https://api.ipify.org' | Select-Object -ExpandProperty Content
az sql server firewall-rule create --resource-group "<RGName>" --server "<serverName>" -n "<firewallRuleName>" --start-ip-address $ipAddress --end-ip-address $ipAddress
You can see the result as mentioned below:

It will add the current IP address to the firewall rules, as mentioned below:
