Connection was denied since Deny Public Network Access is set to Yes

 Issue: Connection was denied since Deny Public Network Access is set to Yes

In this blog we are going to learn how to resolve Error which is  ''connection was denied since deny public network access is set to Yes'' let's create an SQL Azure database and then configure it with a private endpoint, first of all, we have to create a virtual network, For creating a virtual network go to the Azure portal and then click on the search bar and search for virtual networks, then create a virtual network by clicking virtual networks, on the left side of the dashboard, click on create button and then in basic tab select the resource group, after selecting the resource group give the name of virtual network and select the region and then click on Review + Create button as shown in below picture.


Inside this virtual network, we have to create multiple Sub-Virtual Networks, so one Sub-virtual network we will create will be for our azure SQL database and one for our remote virtual machine.

For creating a Sub-Virtual Network we will click on the Subnets tab and then click on +Subnet button, by clicking +Subnet button it will open a form as shown in the picture below, we have to name the Subnet and click save, after that again we will click +Subnet button and create another subnet and name it. 

Once our Subnets are created we have to create Azure SQL Server, for creating Azure SQL Server we have to go to the Azure portal and click on SQL Databases on the dashboard, it will open a window as shown below,  Click on the +Create button, then insert information ie Resource Group Database name and then create Server name, after creating server name then click on configure database and select as per your requirement and click apply, then click on Review + Create Button and then click on create.

Once our  Azure SQL Server is created we will now have to create a Virtual Machine, to create a virtual machine we have to go on the main page of our azure portal, on the top of the dashboard click on the Virtual Machines, it will open a window, on that window we have to click on +Create Button and then click on a new machine, select the subscription, resource group, name of the machine then allow the selected port which is RDP3389 and then click on Disks:

On the disks page, you can select the OS Disk type and Encryption type as per your requirement then click on networking.

In the networking tab, you have to select Virtual Network Name, Subnet, Public IP, NIC network security group, public inbound ports then Click on Review + Create Button, then click on create.

Our virtual machine is ready to let's connect the virtual machine click on connect then click on RDP, then click on download the RDP file at the bottom, then double click on downloaded RDP file and click on connect, it will ask for user name & password which created earlier, click on yes and accept the remote desktop connection certificate now our virtual machine is ready, and from this virtual machine we will connect with our azure SQL database.

our server is ready now click on the local server and then make some changes in the Internet Explorer Enhanced Security Configuration, change the status from ON to OFF, and then click on ok

now we have to install the azure data studio, for which we open Internet Explorer and search for Azure Data Studio and install.

now our Virtual Server Machine is ready let's go to the server and copy the Server name as shown is the picture below.

Then go to the remote desktop and click on a new connection, fill in the required information ie. Connection type, server, authentication type, username, password before we click on connect we have to make a private endpoint connection. for creating a private endpoint connection we have to go back to the Azure portal and click on the server and then select the private endpoint connection under the security tab and click on +Private Endpoint, once we click on +Private Endpoint we have to fill required fields ie. Subscription, Resource group, Name, and the region as the picture is shown below.

Then click on Resource and fill the required fields as picture shown below which are Subscription, Resource type, Resource and Target sub-resource and then click on configuration.

In the configuration tab fill the required information as per the picture below, we have to provide the virtual network name and subnet, then click on tags and click on Create.

   Our resource is ready which is shown in the picture below.

Now go back to our virtual machine and click on connect, as you can see in the picture below that I am facing the login error, to resolve this error plz follow the steps.

Error Resolution:

Go to the Azure portal in the portal click on the resource group '' Private DNS Zone'' inside the resource group click on the ''Virtual network links'' click on +Add button, it will open a window as shown in the picture below, give the link name, subscription and select the virtual network, check on the Enable auto registration and then click ok, it will create a Virtual network link.

Once the Virtual network link is created go back to your Virtual machine and connect it again, as you can see in the below picture we are now connected without having any login error.

Video Demo: Connection was denied since Deny Public Network Access is set Yes- Microsoft SQL Server, Error:47073

No comments:

Post a Comment