未加星标

Create and Connect to an Azure SQL Database

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二03 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

In this article, we will discuss creating a new Microsoft Azure SQL Database and use SQL Server Management Studio and Powershell to connect and work with it. You will need to sign up for the Free Trial with a Microsoft Account. Go to http://azure.microsoft.com and sign up for a free 30-day trial. Once you sign up, go to the Azure Portal ( http://portal.azure.com ) and sign in.

Overview

Microsoft Azure SQL Database is a cloud DAAS (Database As A Service) that can be used to build SQL Server databases easier and on-demand. Developers can leverage the cloud offering to focus on development of their new applications without having to wait days for a DBA to create a database. Database Administrators can use it for high availability scenarios, use the service to backup databases to the cloud, or scale databases quickly based on demand.

Microsoft Azure SQL Database uses the codebase from the newest SQL Server 2016 Product Suite for the database engine, however, there are some T-SQL differences on what you can do in Microsoft Azure SQL. The table below highlights a few of those differences. You can view more differences and limitations in the Azure Documentation .

Global Tempoary Tables SQL Server Agent Functions/Procedures SQL Server Logins (Database Scope Credentials are supported) sp_addmessage SQL Server Auditing (Database Auditing Supported) SQL Server Trace Login Triggers or Server-scope Triggers USE statement Use Cases

There are a number of use cases that can be adopted.

Scale a production application based on increase demand Provision development and test environments that will speed up development and QA/Test Ability to out-source database management and TCO Backup and Recovery Features

Instead of writing out the features that are available in Microsoft Azure SQL I will provide a link to the Microsoft Docs with that information. The feature set is changing daily and it a good idea to check with the docs on a daily or weekly basis.

Microsoft Docs - Azure SQL Database Features

Create an SQL Database in Azure

You will need to create a Azure account and Microsoft is offering a Free Trial as of the date of this article. Once you have the account and are in the Azure Portal, to create a database, click on the SQL Databases icon.


Create and Connect to an Azure SQL Database

Next, click on the plus icon in the Azure Database Screen.


Create and Connect to an Azure SQL Database

You will be presented with various options to create a new Azure SQL Database. We will walk though each one.

Database Name = AdventureWorks2016CTP3 Subscription = This will be the free trial you signed up for. This is $200 and good for 30 days Resource Group = This is the resource group that you assign to your database. You can read more about Resource Group Guidelines in Azure Documentation Site . Server = When you create an Azure SQL Database it needs to be assigned to a server. You can create one from the portal or choose an existing one. We will create a new one. You will need to choose the Server Name, User Name and Password, Location. Want to use SQL Elastic Pool? = Allow you to budget your resources while providing resources based on demand Pricing tier = You have a number of different tiers of pricing available. For this demo, we will choose the Basic. Collation = Default SQL Server Collation
Create and Connect to an Azure SQL Database

After your database is deployed you will see the new database in your list of Microsoft Azure SQL Databases. Click on the database to see the properties.


Create and Connect to an Azure SQL Database

From here you can perform a number of different actions.

Setup Dynamic Data Masking Transparent Data Encryption Geo-Replication Get Connection String Information Restore/Export Database Connect to Azure SQL Database with SQL Server Management Studio (SSMS)

You can download the Microsoft SQL Server Management Studio software from Microsoft for free . In this demonstration, we will be using a Release Candidate 17.0. To connect to Azure SQL Database with Microsoft SQL Server Management Studio you will need the server name, user name, and password that you created when you setup the database. You will connect using SQL Authentication. The screenshot (Figure 1) is an example of what you will need to type in to connect.

You may be asked, when you click Connect, to sign into your Microsoft Account (Figure 2). You will need to enter the same credentials you use to log into the Microsoft Azure Portal. You will also be asked to add a New Firewall Rule with your public IP Address listed. Click OK.


Create and Connect to an Azure SQL Database
Figure 1 - SSMS Connection Screen
Create and Connect to an Azure SQL Database
Figure 2 - Azure Sign in Screen and New Firewall Rule
Create and Connect to an Azure SQL Database
Figure 3 - SSMS Object Explorer Screen connected to Azure SQL Database

You would query a Azure Database just like you would an on-premise SQL Server. The screenshot below (Figure 4) is an example of a simple query that will select database from a table.


Create and Connect to an Azure SQL Database
Figure 4 - Query a SQL Azure Database from SQL Server Management Studio (SSMS) Connect to Azure SQL Database with Powershell

You will need to install the Azure Powershell Modules in order to connect to Azure via Powershell. You can find the MSI file here on Github . Once you have the installation completed, perform the following commands to add your Azure Account You will be asked to log into your Microsoft Azure Account.

PS C:\>Add-AzureAccount
PS C:\>Disable-AzureDataCollection
Create and Connect to an Azure SQL Database
Figure 1 - Add Azure Account after Powershell plugin installation

To view your list of Azure Databases with your subscription, you can type in the following command in PowerShell.

PS C:\>Get-AzureSqlDatabaseServer
Create and Connect to an Azure SQL Database
Figure 2

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

主题: SQLSQL ServerPowerShellGit
分页:12
转载请注明
本文标题:Create and Connect to an Azure SQL Database
本站链接:http://www.codesec.net/view/531572.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(28)