Cloud Databases In Azure - Part Three

This is the third article in “Azure Cloud Databases” articles series, which is a continuation of the previous two articles. I will recommend going through the first two articles (links are given below).

In this article, we will see how we can create a new login and can make a connection between our Visual Studio application and Azure SQL Database.

Let’s get started.

Create a new login in SQL Server Management Studio. Right-click on "Security" and click on "New Login".

Azure Cloud Databases

The template will allow you to fill some parameters (username & password) to create the login. Let’s create a user – “vipulDBUser” and with the password and execute the query, as shown below.

Azure Cloud Databases

Now, we have to add the user to our database and assign some roles. After executing the command, you will see that a user – vipulDBUser has been added to the database - vipul-aspnetmvcDB.

Azure Cloud Databases

Now, once we have created the username and password for the database, we can add these details in the Azure SQL Database connecting string.

For this, go to Visual Studio project and check the connection name. With the same connection name, create an entry in the App Services along with the new connection string having username and password.

In my case, the connection name in Web.config file of the Visual Studio project is – DefaultConnection.

Azure Cloud Databases

Now, go to Azure Portal and click on App Services. Then, search for connection string in application settings. Add an entry with the same connection name and with the updated connection string.

Azure Cloud Databases

Once you save this entry, your application and Azure SQL Database will be connected.

Summary

In this article, we saw how to create a new login in SQL Database. We also saw how we can connect our application and Azure SQL Database by updating the username and password details in the connection string.


Similar Articles