Open In App

How to Install SQL Server on Azure VM?

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Microsoft Azure provides us with multiple database services which help us to run popular relational database management systems, like MySQL, SQL Server, and PostgreSQL in the cloud. We can use an SQL server on Azure Virtual machines by running a virtual machine in Azure and installing an SQL server in it. Each instance can support multiple different databases. By using virtual machines we make it an infrastructure-as-a-service ( IaaS) solution that virtualizes the hardware infrastructure for networking, and compute storage in Azure. SQL Server is fully compatible with on-premises physical and virtualized installations. This makes this a great option available for “lift and shift” migration of existing on-premises SQL server installations to the cloud with ease without making any changes as it effectively replicates the database running on real on-premises hardware. It is similar to moving the database from one on-premises server to another. As it is an IaaS service we must manage all the aspects of the server including the updates, configurations, operating system, backups, and other maintenance tasks of the resource. 
It has an availability of 99.99%  and can be used to develop and test traditional SQL server applications. 

Installing SQL Server on Azure VM

Prerequisites: You need to have an active Azure Subscription. You can avail a free 12-month subscription by going to the official website

Step 1: Navigate to Azure Portal and sign in to your account. 

Navigate-to-Azure-Portal

 

Step 2: On the homepage, select All services and type in Azure SQL in the search box. 

Type-in-Azure-SQL

 

Step 3: Select the +Create option present. A select SQL deployment options page will pop up. We can view the additional information by selecting show details on the SQL virtual machines tile.

Select-the-+Create-option

 

Step 4: Select the image you wish to create. For now, you may select the Free SQL Server License: SQL Server 2019 Developer on Windows Server 2022 image from the dropdown. 

Select-the-+Create-option-present

 

Step 5: Select Create to create the image. You will be promoted to provide basic details to create the image: 

  • Subscription: Choose the Azure subscription in which you wish to create the image. 
  • Resource group: Choose the resource group where you wish to create the image of creating a new resource group. 
  • Virtual machine name: Enter a unique name for the virtual machine name. 
  • Region: Choose a location
  • Availability options: Choose the option based on your needs. For now, select No infrastructure redundancy required.
  • Image list: Select the image. For now select Free SQL Server License: SQL Server 2019 Developer on Windows Server 2022.
  • Size: Select the size you wish for the virtual machine. For now, select the A2 basic offering by clicking on change size. 

Step 6: Under the administrator account, give a unique username and a password. The password should be at least 12 characters long and meet the defined complexity requirements. Inbound port rules: Choose allow selected ports and select the ports from the drop-down. For now, choose RDP(3389)

Create-a-virtual-machine

 

Step 7: Next, click on SQL server settings. In the tab that opens fill in the necessary details : 

  • Under security and networking, select Public for SQL connectivity and make the port 1418 to avoid a well-known port number in the public scenario. 
  • Under SQL authentication, choose whether you wish to enable it or not. For now, click on Enable. The SQL login credentials will be the same as the user name and password we configured for our VM. 
  • Change any other if needed and click on Review + Create.
Click-on-SQL-server-settings

 

Step 8: On the Review + Create tab, review the summary and select Create to create the SQL server, resource group, and resources specified for the VM with the specified configurations. 

Select-Create-option-to-create-the-SQL-server

 

Step 9: If it shows all validations passed them click on create button to create your virtual machine else check for validation errors. It will take some time to get deployed.

Click-on-create-button-to-create-your-virtual-machine

 

Connecting to the SQL server

Step 1: Go to the deployed resource in the portal. In the overview section of the virtual machine you had created you will find a public IP address. Note it down.

Goto-the-deployed-resource-in-the-portal

 

Step 2: On a different computer from where you wish to connect open SQL Server Management Studio. A connect to server or connect to database engine dialog box will pop up. Enter the public IP address we had previously noted down in the Server name. Then add a comma and add the custom port that we used when configuring the virtual machine (1418). For example, 31.22.43.11,1418. In the authentication box, select the SQL server authentication. You will be asked to log in. Type the name of the SQL login and login password. 

 

Step 3: Click on the connect button then you will connect to your SQL server. 

 

The capabilities of the SQL Server on Azure help us to:

  • Instantly create development and test scenarios for our applications when we don’t want to buy on-premises development or test SQL server hardware.
  • It makes it a great fit for a lift-and-shift fast migration of existing applications with minimal or no changes. 
  • Be cost-effective and efficient as it helps us scale up the platform in which the SQL Server is running by allocating more resources (memory, CPU power, disk space) to our virtual machines. We can quickly resize the virtual machine without even reinstalling the software that is running on it. 
  • It allows us to extend existing on-premises applications to the cloud in hybrid mode. 
  • It allows us to have full administration over the DBMS and operating system of the virtual machine.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads