DEV Community

Cover image for Creating an Azure App Service with a SQL Database using Node.js
Barbra Mududa
Barbra Mududa

Posted on • Updated on

Creating an Azure App Service with a SQL Database using Node.js

To create an app service with a SQL database in Azure, follow these steps:

  1. Sign in to the Azure portal at https://portal.azure.com.

  2. Click on the "Create a resource" button (+) in the Azure portal's left-hand menu.

  3. In the search box, type "App Service" and select "App Services" from the suggested results.

  4. Click on the "Create" button to begin creating a new app service.

  5. In the "Basics" tab, configure the following settings:

  • Subscription: Select the Azure subscription you want to use.
  • Resource Group: Choose an existing resource group or create a new one to logically group related resources.
  • Name: Enter a unique name for your app service.
  • Publish: Choose the appropriate publishing method based on your application requirements (e.g., Code, Docker Container, etc.).
  • Runtime stack: Select the runtime stack that matches your application (e.g., .NET, Node.js, Python, etc.). I chose Node.js because that is what I was using for my app service
  • Operating System: Choose the operating system (Windows or Linux) for your app service.
  • Region: Select the Azure region where you want to host your app service.

Image description

  1. Click on the "Next" button to proceed to the "Deployment" tab. Here, you give your Github repository and organisation name

Image description

  1. Click on the "Next" button to proceed to the "Networking" tab. Select "Enable public access" on so that others may access your website.

  2. Click on the "Review + create" button to review your app service configuration..

  3. After reviewing the settings, click on the "Create" button to create the app service. Azure will start provisioning the necessary resources for your app service.
    Once the app service is created, navigate to the app service's Overview page.

Creating a SQL Database

  1. In the Overview page, click on the "Add" button under the "Settings" section and select "Azure SQL" from the dropdown menu.

  2. In the "Add SQL connection" page, click on the "Create new database" option.

  3. Configure the SQL database settings:

  • Database name: Enter a name for your SQL database.
  • Server: Choose an existing SQL server or create a new one.
  • Pricing tier: Select the appropriate pricing tier based on your performance and cost requirements.
  • Server admin login and password: Provide the login credentials for the SQL server.

Image description

  1. Click on the "OK" button to create the SQL database.

  2. Once the database is created, you can access its connection string and other details from the app service's Overview page.

  3. Update your application code or configuration to use the SQL database connection string obtained in the previous step.

Image description

Image description

  • On your Web App Service overview, select the domain link to view your website

Image description

Below is my domain link:
https://barbra.azurewebsites.net/

That's all! You have now created an app service in Azure using a SQL database. You can deploy your application code or content to the app service, which will connect to the corresponding SQL database for data storage and retrieval.

Top comments (0)