Introduction
In this project, I focused on understanding the fundamentals of working with Azure SQL Database. By the end of this project, I was able to create, configure, and manage SQL databases within Azure. I also learned how to connect to the database, run SQL queries, and perform common database management tasks such as creating tables and adding data. This hands-on experience with Azure SQL Database provided me with essential skills for managing databases in the cloud.
Project Overview
In this project, I:
- Set up and configured an Azure SQL Database.
- Performed basic SQL operations, including creating tables, inserting data, and running queries.
- Learned how to securely manage access to the SQL Database using SQL Authentication and Microsoft Entra (formerly Azure AD).
Let me walk you through the steps I followed to complete this project.
Step-by-Step Guide
Step 1: Create an Azure SQL Database
1️⃣ Navigate to Azure Portal:
- In the Azure Portal, I clicked on Create a resource and searched for "SQL Database".
2️⃣ Configure SQL Database Settings:
- Subscription: I selected the active subscription I was working under.
-
Resource Group: I created a new resource group called
az-rg1
. -
Database Name: I named my database
myfirsteverdatabase
to keep it unique. -
SQL Server: Under the Server section, I clicked Create new to set up a new SQL Server.
-
Server Name: I named the server
bobsdiner
. -
Server Admin Login: I created an admin username
adminuser
and set a strong password. - Location: I selected UK South for better performance.
- Authentication Method: I chose SQL Authentication.
-
Server Name: I named the server
3️⃣ Networking and Security:
- Networking: I allowed public endpoint access and selected "Allow Azure services and resources to access this server".
- Security: I left the default security settings.
4️⃣ Review & Create:
- After reviewing the configuration, I clicked Review + Create and then Create to provision my SQL database.
Step 2: Connect to Your Azure SQL Database
Once the SQL Database was set up, I connected to it to run SQL queries and perform database operations.
1️⃣ Using the Azure Portal Query Editor:
- In the Azure Portal, I navigated to my SQL Database and clicked on Query editor (preview).
- I signed in with the Server Admin login credentials to access the database and execute SQL queries directly within the portal.
Step 3: Managing Your Azure SQL Database
Now that I was connected to the database, I performed basic database management tasks such as creating tables, adding data, and running queries.
1️⃣ Creating a Table:
-
I created a simple Employees table using the following SQL query:
CREATE TABLE Employees ( EmployeeID INT PRIMARY KEY, FirstName NVARCHAR(50), LastName NVARCHAR(50), Email NVARCHAR(100), HireDate DATE );
2️⃣ Inserting Data:
-
I inserted data into the Employees table using this query:
INSERT INTO Employees (EmployeeID, FirstName, LastName, Email, HireDate) VALUES (1, 'John', 'Doe', '[email protected]', '2022-01-01');
3️⃣ Running Basic Queries:
-
I ran a simple SELECT query to retrieve the data from the Employees table:
SELECT * FROM Employees;
Step 4: Clean Up Resources
After completing the project, I made sure to clean up my resources to avoid unnecessary charges.
1️⃣ Delete the Resource Group:
- In the Azure Portal, I deleted the resource group
az-rg1
, which contained the SQL database and associated resources.
Conclusion
In this project, I successfully:
- Created and configured an Azure SQL Database.
- Performed basic SQL operations, such as creating tables, inserting data, and running queries.
- Managed access using SQL Authentication.
By completing this project, I gained hands-on experience with Azure SQL Database, which is a crucial skill for managing databases in the cloud. I can now efficiently manage SQL databases on Azure, perform essential database tasks, and configure secure access to my databases.
Credits : https://www.datacamp.com/blog/azure-project-ideas
🚀 Stay tuned for more as I continue my learning journey with Azure!