Skip to content

Latest commit

 

History

History
62 lines (35 loc) · 2.48 KB

File metadata and controls

62 lines (35 loc) · 2.48 KB

The Azure Portal and Connecting to an Azure SQL Database

Prerequisites

Software

  • Visual Studio Code with the SQL Extension

Services

  • Azure OpenAI instance with a text-embedding-ada-002 deployment and a gpt-4 deployment.
  • An Azure SQL Database

Key Information Needed

  • Azure SQL Database Server Name
  • Azure SQL Database Name
  • Azure OpenAI Endpoint Name
  • Azute OpenAI Endpoint Key

Connect to the free Azure SQL Database

Using Visual Studio Code

Visual Studio Code will be used for working with the database.

  1. When Visual Studio Code opens, click the SQL Extension on the left side.

    A picture of clicking Add Connection in the SQL Extension

  2. Next, click Add Connection in the SQL Extension. (The Add Connection option might take a few seconds to load.)

    A picture of clicking Add Connection in the SQL Extension

  3. A SQL Connection Dialog tab will appear in the VS Code editor.

    A picture of the SQL Connection Dialog tab

  4. For the Profile Name field, enter SampleDB.

    A picture of entering SampleDB in the Profile Name field

  5. Next, for Input type, select the Connection String radio button.

    A picture of selecting the Connection String radio button for input type

  6. In the Connection String text box, copy and paste the following connect string

    Be sure to replace the following placeholders in the connection string:YOUR_AZURE_SQL_SERVER_NAME, YOUR_DATABASE_NAME, YOUR_SQLADMIN_PASSWORD

    Server=tcp:azuresql@YOUR_AZURE_SQL_SERVER_NAME.database.windows.net,1433;Initial Catalog=YOUR_DATABASE_NAME;Persist Security Info=False;User ID=sqladmin;Password=YOUR_SQLADMIN_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
    

    then press the blue Connect button.

    A picture of the connection string text box

  7. Once connected to the database, right click on the database in the connection navigator on the left side and choose New Query.

  8. You are now connected to the Azure SQL Database!