Introduction
In this article, you will learn how to create a SQL server instance In the managed virtual machine.
By using SQL Server on Azure Virtual Machines you can run complete versions of SQL Server in the Cloud without the need for on-premises hardware management. When you have a subscription, SQL Server virtual machines (VMs) can also help you save money on licenses.
By using VM or using SQL Server in the cloud you can save a lot of effort and a lot of money which you will need for hardware and other needs.
Virtual machines in Azure may be found in a variety of locations throughout the world. They also provide a choice of machine sizes to choose from. All of the images in the virtual machine gallery.
Benefits Of using SQL Server in the Virtual Machine
Performance
Azure virtual machines offer different machine sizes with various workloads depending on your demand. We can also optimize our performance by using automated storage configuration.
Backups
SQL Server may benefit from Automated Backup on Azure Virtual Machines, which frequently produces backups for your database to blob storage. This approach can also be used manually.
Azure also provides a corporate-class SQL Server backup solution for Azure VMs. It provides a fully managed backup system for point-in-time recovery and centralized administration and monitoring.
Updates
There is no need to take care of the updates Azure will do it for you. Automated Patching may be used for the automated installation of windows and SQL Server updates by SQL Server in Azure's Virtual Machines.
Availability
Consider setting up SQL Server Availability Groups if you need high availability. This includes several instances of the Azure Virtual Machines SQL Server on a virtual network. For automated configuration, you may manually set up your high-availability solution or you may utilize Azure Portal templates.
How to create a SQL Server instance in the managed Virtual Machine
Here we will see how to create SQL Server instance in our managed virtual machine by following the below steps,
Step 1
Login to portal.azure.com and open your dashboard.
Step 2 - Create a resource
Click on create a resource.
Step 3
Here we will search for SQL Server. After hitting enter we will get so many results like the below image,
Step 4
For this article, we will search the images published by Microsoft. For doing that we need to select Microsoft from the publisher type dropdown. Now we will get only those images that are published by Microsoft.
Step 6
Here we will select SQL Server 17 on Windows Server 19.
Step 7
Now we got this screen. Here we need to select a plan for our service so you can see in the last option free SQL server License
Then we select a software plan dedicated to developers that is free developer license SQL Server 17 developer on windows Server 19. We will choose this.
Note
Please keep in mind that you will still be charged for the virtual machine and windows installed in it. The SQL Server license will be free.
Step 8
So we selected our plan, now click on create.
Step 9
Now a wizard will open for the provision of our managed virtual machine. Here you need to select the resource group if you do not have a resource group, click on create new and enter the details.
After this you need to provide the instance details like virtual machine name, region here I selected central India you can select any region. And then we will select our software image like the earlier free developer license SQL Server 17 developer on windows Server 19.
Step 10 - Change size
Here we have an option to create our VM size as per our or project requirement. Here I am not doing anything I am leaving everything by default.
Step 11
Here we need to enter the administrator accounts details. These details will be required for login to our virtual machine.
Enter admin details for login.
Step 12
Here you can check that the RDP option will be selected in the inbound ports. And also inbound ports allowed for the selected ports because we need to access our VM on the public internet.
Step 13 - Select disk
Here you can select the disk type, we have the options like standard SSD, standard HDD, premium SSD, ultra disk. We can choose our Disk type as per our project requirement. I am choosing Standard SSD for this article and now we click on the Next button.
Step 14 -Network screen
In the network screen, you can check that the Azure virtual machine has been added to the virtual network. I am not doing any changes here and leaving everything as default. And now we click on the Next button and move to the management.
Step 15 -Management screen
On this screen, I am not making any changes. We move on to the next screen.
Step 16 – Advanced setting
This is how our advanced setting looks like. We are not doing any changes on this screen also. Now we click on to the next and move on to the SQL Server setting.
Step 17 - SQL Server setting
So in the SQL Server setting, you can choose the SQL connectivity, I am choosing public only for this demo which is not a very good decision I am choosing this only to access it anywhere otherwise we will choose private.
Also the port Azure selected is 1433 you can change this as well.
In the next option SQL authentication, you can see here is a toggle button for enabling and disable by default it is set to disable. I am enabling it and you can see when click on enable I got a user ID and password these are the same ID password which we created earlier for our virtual machine login.
Step 18 - Tag screen
On this screen, we can not change anything. We need tags in our project where we can separate the project resources by these tags. This can also be used in pricing.
Step 19 - Validation passed
Ok, so we got this screen. Here we can see that validation has been passed.
Click on create to create our resource.
So we can see here that our deployment is in progress we have to wait here for some time.
We can see our Deployment has been completed.
Now we can Go to resource and check our VM dashboard. We will get a screen like below,
Here we can see the connect button. So we can click here and we will get three options like the image below,
Click on connect.
We will select the RDP file. Now we will click on Download RDP File.
So our File has been downloaded.
Now we will click on our downloaded RDP file. When we click on the RDP file this window pop up to connect to our VM click on connect to the VM.
Enter your credentials here which we created earlier.
Now we will click on the yes.
Here we can see that we are logged in Successfully to our VM.
Here we will Search for SSMS.
Our SSMS is opening in our newly created VM in azure.
Here everything is correct so we can Click on connect.
So now we are connected to our server. To check this right-click on our server and click on New query.
Here we can check our version for this type below command,
Select @@version
Summary
In this article, we learned how to create an SQL Server in Azure and connect to it through Azure VM and what its benefits.
If you want to learn more you can check here,
Thanks.