Hello Julian McNeill
Thank you for reaching out to Microsoft Q&A.
It looks like you're trying to connect to your Azure SQL Managed Instance (MI) using SSMS, but the connection is failing despite enabling the **public endpoint
Please try following steps to get this issue resolved.
- Verify That Public Endpoint is Enabled for Your Managed Instance**
Run the following Azure CLI command to confirm:
az sql mi show --name <your-managed-instance-name> --resource-group <your-resource-group>
Check the publicDataEndpointEnabled property. If it's false, enable it using:
az sql mi update --name <your-managed-instance-name> --resource-group <your-resource-group> --set publicDataEndpointEnabled=true
2. Verify the Correct Port (Use 3342, Not 3343)
Azure SQL Managed Instance only allows public connections on port 3342. Ensure SSMS is using port 3342:
- In SSMS, go to Options → Connection Properties.
- Manually enter 3342 in the port field.
3. Check NSG Rules and Firewalls
Even though you've added a rule, let's double-check the Network Security Group (NSG) and firewall settings:
- Go to Azure Portal → Networking (under your SQL MI).
- Inbound Rules:
- Priority: Ensure the rule allowing TCP 3342 is higher than Deny All Inbound.
- Source: Try setting it to 0.0.0.0/0 for testing (then restrict it after testing).
- Destination: Ensure it's set to Any (or your SQL MI subnet).
- Action: Allow.
- Destination: Ensure it's set to Any (or your SQL MI subnet).
- Source: Try setting it to 0.0.0.0/0 for testing (then restrict it after testing).
- Priority: Ensure the rule allowing TCP 3342 is higher than Deny All Inbound.
Additionally, check the Azure Firewall:
- If Azure Firewall is enabled, add a rule allowing TCP 3342 outbound.
4. Verify Virtual Network (VNet) Peering and DNS Resolution
- If your client is inside another VNet, ensure VNet peering is configured between your Managed Instance VNet and the client VNet.
- If using a custom DNS server, make sure it resolves your MI's FQDN correctly.
- Test DNS resolution:
If it fails, temporarily switch to Azure-provided DNS.nslookup free-sql-mi-5555637.81371bd0b3f3.database.windows.net
- Test DNS resolution:
5. Test Connectivity Using Telnet or PowerShell
Try connecting directly via Telnet:
telnet free-sql-mi-5555637.81371bd0b3f3.database.windows.net 3342
Or using PowerShell:
Test-NetConnection free-sql-mi-5555637.81371bd0b3f3.database.windows.net -Port 3342
- If it fails, something is blocking the connection (likely NSG, firewall, or public endpoint misconfiguration).
6. Verify SQL Authentication Mode & Credentials
- Ensure you're using SQL authentication (not just Azure AD).
- Try logging in with admin credentials that were set during deployment.
- If using Azure AD authentication, make sure your account has access:
SELECT
7. Try Connecting via Azure Data Studio
- If SSMS fails, try Azure Data Studio using the same connection string.
Final Steps
- If everything looks correct but you still can't connect, try restarting the SQL Managed Instance:
az sql mi stop --name <your-managed-instance-name> --resource-group <your-resource-group>
az sql mi start --name <your-managed-instance-name> --resource-group <your-resource-group>
If you find this helpful, please do not forget to accept this answer.