The cloud is a buzzword in the IT world. Oracle, Amazon and Microsoft with Microsoft Azure are offering Cloud Services to the public. Most of the companies plan to have part of their environments in the cloud to reduce the maintenance and security effort.
Microsoft Azure offers a great solution to move your company information to the Clouds. That way you can access to your Servers, Databases, and Applications from your Tablet, Smartphone anywhere, anytime.
Figure 1. A screenshot of an Android Smartphone accessing to the Azure Administration Portal.
In this article, we will introduce to Microsoft Azure world, we will show how to create a Database and a Table in Azure and then we will show how to deploy a SQL Server Database to Microsoft Azure.
What is Windows Azure?
Azure is a Microsoft Platform hosted in the Microsoft Data Center used for multiple services like Virtual Machines, Web services, Databases, Cloud Services, Application Services, Media Services and more.
Figure 2. Some Available OSs in Azure like Windows, Linux Ubuntu, Coreos, SUSE, etc.
With Azure, you can have multiple remote machines that you can access remotely anywhere. You can have Windows Servers or Linux Servers. In addition, you can have applications in Java, .NET, etc.
Azure is a multiplatform Portal.
Getting started with Microsoft Azure
In order to start you need:
- A Microsoft Account.
- A credit card (there is free trial for 3 months that requires a credit card).
Once you have accomplished the requirements, go to the Microsoft Azure Portal.
You will need to add personal information like your country, Address, telephone and your credit card information.
Once you are registered, you will be able to see the Microsoft Azure Platform.
Figure 3. the Microsoft Azure Portal
The portal lets you Administer different cloud services like web sites, mobile services, SQL databases and more. In this sample, we are going to use SQL Databases. Click on the SQL DATABASES link.
Figure 4 Create a new Database with Azure
The easiest way to create a database is the Quick Create option. For testing purposes is a good option, but in the real life is better to customize it with the custom create option.
Figure 5 Quick Database Creation
If it is your first time with Azure, you will need to create a New SQL database server.
Figure 6 New SQL database server
You will also need to specify a Login and password. Do not forget them to connect later. In SQL Server Azure, the SQL Server Authentication is used.
Figure 7. Creating a new Server with new login and password.
If everything is OK, you will have a new Database created and a new Server. In this example, the Server name is Kadhym5bh and the database name sqlshack.
Figure 8. The database created in Microsoft Azure.
Now you have a database named sqlshack. In order to create a table, press the Manage option.
Figure 9. Database Management in Azure
You will receive a message to add your current personal machine IP to add to the list of allowed IP addresses. Without this option, your local server will not have access to the Azure server.
Figure 10. Message to allow the current local IP address.
You can create new tables from your Web Browser. The environment is friendly and simple.
Figure 11. New table creation in Azure
You can also add columns to the table using the Columns link.
Figure 12. Column creation in Azure
You can also add Data to the table.
Figure 13. Adding Data
How to connect to Azure with the local SSMS
Now in the SQL Server Management Studio (SSMS), connect to the Database Server Using the following syntax:
ServerName.database.windows.net (see the figure 8 to find the Server Name)
Use SQL Server Authentication
Use the login used when you created the database (see the figure 7 for your login and password information)
Figure 14. Windows to connect to Azure
You will be able to connect to the kadhym5bh server and you will be able to see the sqlshack database.
Figure 15. The sqlshack database visualized in SSMS.
The SQL Azure looks similar to a local database at the beginning.
Figure 16. The SQL Azure Database expanded.
You will also notice that the options to administer a SQL Azure Database are limited. In the following example, Right click on the table folder to create a new table.
Figure 17. The SSMS limitations on Azure
As you can see, the SSMS only generates T-SQL templates instead of showing visual interfaces to create objects. For many options, the T-SQL is the only way to create objects and add data.
Figure 18. The T-SQL code generated to create a table in SQL Azure.
How to deploy a SQL Server Database as an Azure Database
Today, most of the people have local and Virtual Remote Servers in the Cloud. A common task is to migrate some data from the local database to Azure.
In this new example, we are going to deploy a local database in SSMS as an Azure SQL Database. In order to do this, right click on your database and select the Deploy Database to Windows Azure SQL Database option.
Figure 19. Deploying a Database to an Azure database.
The Deploy Database Wizard will be displayed.
You will be prompted the database name to be used in Azure. A temporary file will be used for the creation. Click the Connect button to connect to Azure.
Figure 21. The deployment settings
Specify the same connection information used to connect to Azure from the SSMS and press connect.
Figure 22. Connection information.
Finally, you will have the summary of the configuration wizard. Verify if everything is OK.
Figure 23. The summary of the wizard settings.
The final step is the result window. If everything is OK, all should be green.
Figure 24. The successful messages.
If you refresh the Azure SQL Server, you will find the new Database deployed.
Figure 25. The database migrated to Azure.
In addition, if you go to the Azure Portal, you will find the d1 database created.
Figure 26. The database deployed in Azure.
As you can see, the SQL Server tends to be handled in Virtual Servers in the future. The tendency is to migrate the traditional databases to the cloud. These days, the companies are using Hybrid environments where part of the information is Local and part in Azure or other Virtual Servers.
- PSQL stored procedures overview and examples - February 14, 2023
- How to create Power BI reports - January 11, 2023
- SQL Server Tutorial - December 23, 2022