Azure Data Studio: Initial thoughts and walk-through
Tags: azure, data, sqlserver, database
Published: 2018-09-25 08:33:13

---
title: Azure Data Studio: Initial thoughts and walk-through
published: true
tags: azure, data, sqlserver, database
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/480/0*6LNlv8LJ1y0CPLlC.jpg)

At Microsoft Ignite, Azure Data Studio was made Generally Available. Previously known as SQL Operations Studio, Azure Data Studio is a cross-platform database tool that you can use to manage on-prem and cloud data sources.

When I first [installed](https://docs.microsoft.com/en-gb/sql/azure-data-studio/download?view=sql-server-2017) and ran Azure Data Studio, my inital impression of it was that it was pretty much a Visual Studio Code for Data. It comes with Intellisense, code snippets, integration for source control and an integrated terminal.

There’s support for Git in Azure Data Studio, however you need to install version 2.0.0 or later before you can use it.

Much like Visual Studio code, you can have multiple integrated terminals running at the same time rather than switching in out of your editor each time you want to do some command line work:

![](https://cdn-images-1.medium.com/max/1024/1*kHE058d-0CYhtDB_OFjlyw.png)<figcaption>All the terminals!</figcaption>

As a default, Terminals in Windows 10 use Powershell, while Linux and macOS use $SHELL. You can learn more about configuring the terminal [here](https://docs.microsoft.com/en-gb/sql/azure-data-studio/integrated-terminal?view=sql-server-2017).

There’s also support for extensions. Extensions in Azure Data Studio allows us to add more functionality to our base installation much like Visual Studio Code. You can also [develop your own extensions](https://docs.microsoft.com/en-gb/sql/azure-data-studio/extension-authoring?view=sql-server-2017) which is pretty awesome!

![](https://cdn-images-1.medium.com/max/1024/1*_xRNFOF0CG8bAu2vflhiPA.png)

Let’s go through a simple tutorial for connecting and querying a Azure SQL Database. I’m going to assume that you know how to create a Database in Azure. If not, you can follow [this tutorial](https://docs.microsoft.com/en-gb/sql/azure-data-studio/download?view=sql-server-2017) to get started.

Open Azure Studio to get started. If this is the first time you’ve run Azure Data Studio, you’ll automatically see a Connection page open. If not, you can add a new connection by clicking on the icon in the SERVERS sidebar (see below):

![](https://cdn-images-1.medium.com/max/355/1*YNoMhUtni3TLQoBc2SkXhw.png)

Both **SQL Login** and **Windows Authentication** is supported by Azure Data Studio. I’ve used SQL Login, so I need to provide my server name, username and password.

![](https://cdn-images-1.medium.com/max/719/1*EqGlL1ojBPcXwU-cOZMrCw.png)

(_Note: Make sure you enable a_[_firewall rule_](https://docs.microsoft.com/en-gb/azure/sql-database/sql-database-firewall-configure) _for your server in Azure. If you don’t do this, you are able to do this in Azure Data Studio by following a simple UI wizard. Pretty cool!)_

Once you’re logged in, let’s create a database and a table to work with. Right click on your server and select **New Query**. In the query editor, run the following SQL code:

```
IF NOT EXISTS (
    SELECT name
    FROM sys.databases
    WHERE name = N'PersonDB'
)

CREATE DATABASE [PersonDB]
GO

ALTER DATABASE [PersonDB] SET QUERY\_STORE=ON
GO
```

Once our database has been created we want to change our database to PersonBD. We can do this using the drop down menu:

![](https://cdn-images-1.medium.com/max/826/1*-sgDHnycFySaKO01LmatbQ.png)

We can then create a Person table by running the following code:

```
IF OBJECT\_ID('dbo.People', 'U') IS NOT NULL
DROP TABLE dbo.People
GO

CREATE TABLE dbo.People
(
   PeopleId INT NOT NULL PRIMARY KEY,
   Name [NVARCHAR](50) NOT NULL,
   Age INT NOT NULL,
   Email [NVARCHAR](50) NOT NULL
);
GO
```

We can see our new table in the Server sidebar:

![](https://cdn-images-1.medium.com/max/448/1*WF-BfhUa7m5PfVz6kkKy6A.png)

Now let’s insert some rows into our new table:

```
INSERT INTO dbo.People
 ([PeopleID], [Name], [Age], [Email])
VALUES
  (1, N'Will', 27, N'will@example.com'),
  (2, N'Isaac', 7, N'isaac@example.com'),
  (3, N'Sam', 4, N'sam@example.com'),
  (4, N'Jan', 33, N'jan@example.com'),
  (5, N'Jane', 57, N'jane@example.com')
GO
```

And finally, we can query it to view its contents:

```
SELECT * FROM dbo.People;
```

We should see the following result:

![](https://cdn-images-1.medium.com/max/792/1*QfbdBNgNp6GXWn9oC7BIYg.png)

Now that we’ve created our table and we’ve inserted some data in it, let’s now manage our database by creating an insight widget that provides us a view of how much space our tables are using in the database.

Much like Visual Studio Code, we can find things quickly using the Command Palette. To open this up, press **Ctrl+Shift+P.** Once open, type in _settings_ and select **Preferences: Open User Settings.**

We’ll see a JSON file open along with a search input box. In here, type _dashboard_ and find the _dashboard.database.widgets_ setting:

![](https://cdn-images-1.medium.com/max/1024/1*O8QvXd44nuhNET73F_W-3A.png)

Once you found this setting in default user settings, you want to click the pencil icon and select **Copy to Settings**. If it says Replace in Settings please **don’t click it!**

When you copy the settings into your **User Settings** file, you want to add the following JSON:

```
{          
   "name": "Space Used by Tables",
   "gridItemConfig": {
           "sizex": 2,
           "sizey": 1          
    },          
    "widget": {              
        "table-space-db-insight": null          
    }      
},
```

Save your settings and open your database dashboard by right clicking your **PeopleDB** and clicking **Manage**. You should see the following widget in your dashboard:

![](https://cdn-images-1.medium.com/max/1024/1*5dhH4HNaiqn4NmN7UK8Mvg.png)

You can now use this insight chart for different insights through the use of filtering etc.

Once you’re done with your resources, feel free to head back into Azure and clean up any resources that you don’t need anymore.

As you can see, Azure Data Studio is a pretty awesome tool for Data Engineers to manage on-prem and cloud data sources. Personally, I can’t wait to see how this product evolves with input from the community.

If you want to check out the source code, here’s the [GitHub repo.](https://github.com/Microsoft/azuredatastudio) Likewise you can also see the [release notes here](https://docs.microsoft.com/en-gb/sql/azure-data-studio/release-notes?view=sql-server-2017).