Getting Started With SQL Server
Let's connect to our SQL Server.
Like most data engineering tools, most of what you do in Azure Data Studio will begin with a connection. ADS has some very helpful features for managing connections, whether your data is on-premise, in the cloud, in a container, or even located in a file system.
Creating, using, and managing connections
Since there is no better way to learn than by doing, let’s go ahead and open Azure Data Studio. The figure below shows the “Welcome” page, which is designed to assist you in getting started with ADS.
The opening screen places you automatically in the context of connections, which is exactly where we want to start. Notice that the icons stacked vertically on the left side of the application (the Activity Bar) provide you with access to other ADS functionalities. As shown in the figure below, a closer examination of these icons reveals that one of the icons is a little brighter than the others. This indicates the current ADS context, which also determines the contents of the detailed navigation (called the sidebar) that is displayed in the pane immediately to the right of the Activity Bar.
The Connection sidebar provides high-level groupings for:
- Servers
- Azure
- SQL Server Big Data Clusters
These can be expanded to list individual connections and/or sub groupings of connections.
You can also add Central Management Servers to the above list by first installing the Microsoft extension for this feature. Steps for installing this are included in the last section of this chapter.
Connecting to SQL Server
For our first connection, let’s connect to an on-premise instance of SQL Server. To start, click on “Create a connection” on the “Welcome” page, as outlined below:
You could also open the Servers container located in the sidebar, and click on the “Add connection” mini icon as shown below:
In either case, the form shown below will appear on the right side of the ADS application, allowing you to provide the details for your connection. If you would like to connect using your Windows credentials, the only required field on this form is the Server name of your SQL Server (instance). Also, if your SQL Server is running on the same computer as Azure Data Studio, you can generally reference it as simply localhost:
Regarding authentication type, if you are connecting to an instance of SQL on Linux, you may need to use SQL Login. Similarly, if you are connecting to a database in Azure, you may want to use Azure Active Directory. The choice of authentication types are highlighted below:
The Database option allows you to connect directly to a database on your target server. Leaving this field as ‘
If you have a friendly name for a given server (or database), you can use the optional “Name” field located at the very bottom of the connection form. One option for this “Name” field could be to clarify the connection context. For example, if using an SQL Login with limited access, you could append a short descriptive tag such as “Read Only” to the friendly connection name.
We will cover grouping connection names in a following section, but it suffice to say at this point, your connections may appear under a ‘group’ heading, which can provide additional context to your connection names.
Let’s connect the Data Studio to our local SQL database. You can follow the steps above. The form shown above should be filled in with the the following details. This will be true for all upcoming instances where we will need to connect to a database:
- Server: localhost
- Authentication type: SQL Login
- Username: SA
- Password: Adminpass123
Hitting the run button will open up a small window with Azure Data Studio running in it. You can also click on the URL once the app has loaded to open it in a new browser tab.