Featured image of post Azure SQL Linux VM – configuring SQL, installing pwsh and connecting and interacting with dbatools

Azure SQL Linux VM – configuring SQL, installing pwsh and connecting and interacting with dbatools

In my posts about using Azure Devops to build Azure resources with Terraform, I built a Linux SQL VM. I used the Terraform in this GitHub repository and created this

Connecting with MobaXterm

I had set the Network security rules to accept connections only from my static IP using variables in the Build Pipeline. I use MobaXterm as my SSH client. Its a free download. I click on sessions

[

Choose a SSH session and fill in the remote host address from the portal

[

fill in the password and

[

Configuring SQL

The next task is to configure the SQL installation. Following the instructions on the Microsoft docs site I run

sudo systemctl stop mssql-server
sudo /opt/mssql/bin/mssql-conf set-sa-password

enter the sa password and

[

Now to start SQL

sudo systemctl start mssql-server

Installing pwsh

Installing PowerShell Core (pwsh) is easy with snap

sudo snap install powershell –classic

A couple of minutes of downloads and install

[

and pwsh is ready for use

[

Installing dbatools

To install dbatools from the Powershell Gallery simply run

Install-Module dbatools -Scope CurrentUser

This will prompt you to allow installing from an untrusted repository

[

and dbatools is ready to go

#Set a credential
$cred = Get-Credential
# Show the databases on the local instance
Get-DbaDatabase -SqlInstance localhost -SqlCredential $cred

[

Connecting with Azure Data Studio

I can also connect with Azure Data Studio

[

and connect

[

Just a quick little post explaining what I did 🙂

Happy Linuxing!

Built with Hugo
Theme Stack designed by Jimmy