Deploying a SQL Server VM in Azure

30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

Starting with SQL Server 2017, we can run Microsoft’s enterprise-grade RDBMS on Linux. Combined with the power of the Azure Marketplace, this gives us the ability to quickly spin up database infrastructure in a minimal amount of time.

In this hands-on lab, we quickly meet business demands for database infrastructure by utilizing images in the Azure Marketplace.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log In to the Azure Portal

Log in to the Azure Portal using the provided credentials.

Create a SQL Server on Linux VM from the Azure Marketplace
  • On the home page, click Create a resource.
  • Search for "SQL Server 2017" and hit enter.
  • Filter the search by the criteria Operating system -> Redhat and Publisher -> Microsoft.
  • Click on Free SQL Server License: SQL Server 2017 Developer on Red Hat Enterprise Linux 7.4 (RHEL).
  • Click Create.
  • Select the resource group created by the lab.
  • Provide a Virtual machine name.
  • Click Change size under Size.
  • Choose "See all sizes" and scroll down to the B2s row and select it.
  • Choose Password for the Authentication type, then provide a Username and Password.
  • Click Allow selected ports.
  • Select SSH (22).
  • Click Review + create.
  • Verify everything looks good and click Create.
  • Once the deployment is complete, click Go to resource.
Connect to the VM
  • On the resource page, click Connect at the top.
  • Use the provided information to SSH to the server.
Change the SA Password
  • Stop the mssql-server service.
    sudo systemctl stop mssql-server
  • Change the SA password.
    sudo /opt/mssql/bin/mssql-conf set-sa-password
  • Restart the mssql-server service.
    sudo systemctl start mssql-server
Allow Incoming Connections

If we’d like outside applications to connect to our database, we must follow these steps.

  • On our resource page, click Networking in the left pane.
  • Click Add inbound port rule.
  • Leave all of the defaults, but change Destination port ranges to "1433".
  • Change Name to "Port_1433".
  • Click Add.

Use the following commands to open the firewall port on the VM.

sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

Success! We’ve created a SQL Server backend that the development team can utilize with minimal time and configuration!

Additional Resources

In this hands-on lab scenario, we are the SQL Server DBA for Awesome Company. Recently the company has launched a new high-priority project with a central mandate of only using Linux servers in the cloud. Awesome Company's CEO is demanding the development environment be ready today so they can start building, leaving us no time to research how to create a SQL Server on Linux environment from scratch. We can harness the power of the Azure Marketplace to quickly deliver the database backend and save the day.

Step-by-step instructions are included in the task list. Feel free to follow along there or jump in and start working!

Note: To select the B2s instance size, choose "See all sizes" at the bottom of the "Select a VM size" screen.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?