How to connect to the Azure Storage Account with SQL Server Management Studio SSMS

How to connect to the Azure Storage Account with SQL Server Management Studio SSMS

How to connect to the Azure Storage Account with SQL Server Management Studio SSMS

SQLShack

SQL Server training Español

How to connect to the Azure Storage Account with SQL Server Management Studio SSMS

September 25, 2017 by Daniel Calbimonte

Introduction

In SQL Server Management Studio (SSMS), it is possible to connect to the Azure Storage. The Azure Storage Account is useful because it creates replicas automatically in the cloud. You only need to upload your file to the Azure Storage Account and the replication is automatic. You can have multiple replications in different regions and Datacenters with few clicks. That is why it is a common practice to Back up your local database to Azure. In this article, we will show how to connect to Azure using SSMS and then we will store a backup file of a SQL Server database on-premises to the Azure Storage Account. Finally, we will restore a database using the backup created.

Requirements

The following software is required: SSMS 17.2 and SQL Server installed. An Azure Account

Getting started

We will first create an Azure Account and containers and then we will back up a local database in the Azure container and finally, we will restore the database.

Create an Azure Account and containers

We will create an Azure Account first and then we will connect to it. To create an Azure Storage Account, go to the Azure Portal. In the Azure Portal, press the + icon and write storage account. Select the Storage Account -blob file -Table -Queue: You will receive access to links with an introduction and documentation. Press the create button: Specify a name. The system has validators. For example, the Storage name does not support numbers or uppercase letters: Specify a name for the storage account. In the deployment model, use the default one (Resource manager). “Classic” is the older option. In “Account kind” specify General purpose. For some reason, blob storage is not supported in SSMS. In performance, we will use “Standard” because it is just a demo. In replication, the cheapest option is locally redundant storage. This option is used to replicate the information 3 times in the same region. The Subscription is important if you have multiple subscriptions. You can use an existing group or create a new one. This is important if you want to administer multiple resources in groups. You can also select your location. Press the create button: At the right top of the Azure Portal, there is a bell icon. It will inform the user if the storage creation is in progress and/or if it was created successfully. The Notifications can be used for any Azure resource: When the creation is completed, a green message is displayed: To check your Azure Account, go to more services and write storage to find Storage accounts. Click on Storage accounts: Click on the storage account just created: In the Azure Account, go to overview, click on Blobs: Click on the + Container to create containers: Create a container named backups or any name of your preference. The container is like a folder. We will store the backups here: Repeat the steps and create a new container named logs: In the Azure Account, in Access keys you will have two keys. Key1 and key2. You can use any of the keys to connect to your Azure Storage Account using SSMS:

Connect to Azure Storage Account using SSMS

In previous steps, we created an Azure Storage Account with 2 containers. Now, we will connect to the Storage Account using SSMS. In the SSMS, go to Connect and select Azure Storage: Specify the Azure Storage Account name created in the Azure Portal and the Account key. The account key can be the key1 or key2 that we saw in the Azure Portal in the Access Keys section:
A common error is that the Authentication failed for account xxx and the provider key. If your problem is not the key, the problem can be the account kind. It must be general purpose. For some reason, it may fail with the Blob Storage option: If everything is OK, you will be able to connect to your Azure Account: In SSMS 17.2, you cannot create new containers. However, you can delete and refresh your containers. This may change in future versions. You also do not have access to other Storage Account services like Queues, Tables and file storage.

Create a backup in the Azure Account

We will create a backup of a database on-premises into the Azure Account. Right click on your database and select Tasks>Back Up In the General page, select Back Up to URL. This option will let you store your backup in the Azure Storage Account. Press the Add button: We will create a new container. Press the New container button: You will need to Sign in to Azure. Press the Signing In button and specify your Azure credentials: Once connected, you will be able to see your subscription. If you have multiple subscription, select the one used to create the Storage Account. Select the Azure Storage Account created in the portal and the container backups and press OK: You will be able to see the URL destination. Press OK to start the back up:
If everything is OK, a successful message will be displayed: You can verify in the Azure Storage Account that the backup was successfully created in Azure:

Restore a database in SQL Server on-premises using a backup stored in an Azure Storage Account

Restoring a local database from the Azure Storage is a straightforward process in SSMS 17.2. To restore, right click the database that you want to restore and select Tasks>Restore>Database: The backups created are already detected. You only need to select the backup that you want to use and press OK. The database will be restored using the Azure Backup:

Conclusion

As you can see, now it is easier to interact with the Azure Storage Account and verify your files. Today, we may have SQL Server on-premises, but we also want to store some information in the Cloud. In this example, we show how to back up our database on-premises to Azure and how to verify the creation using SSMS. Author Recent Posts Daniel CalbimonteDaniel Calbimonte is a Microsoft Most Valuable Professional, Microsoft Certified Trainer and Microsoft Certified IT Professional for SQL Server. He is an accomplished SSIS author, teacher at IT Academies and has over 13 years of experience working with different databases.

He has worked for the government, oil companies, web sites, magazines and universities around the world. Daniel also regularly speaks at SQL Servers conferences and blogs. He writes SQL Server training materials for certification exams.

He also helps with translating SQLShack articles to Spanish

View all posts by Daniel Calbimonte Latest posts by Daniel Calbimonte (see all) SQL Partition overview - September 26, 2022 ODBC Drivers in SSIS - September 23, 2022 Getting started with Azure SQL Managed Instance - September 14, 2022

Related posts

SQL interview questions on database backups, restores and recovery – Part III SQL Restore Database using DBATools SQL Server Database Backup and Restore operations using the Cloud Database Backup and Restore process in SQL Server – series intro Accessing Azure Blob Storage from Azure Databricks 31,446 Views

Follow us

Popular

SQL Convert Date functions and formats SQL Variables: Basics and usage SQL PARTITION BY Clause overview Different ways to SQL delete duplicate rows from a SQL Table How to UPDATE from a SELECT statement in SQL Server SQL Server functions for converting a String to a Date SELECT INTO TEMP TABLE statement in SQL Server SQL WHILE loop with simple examples How to backup and restore MySQL databases using the mysqldump command CASE statement in SQL Overview of SQL RANK functions Understanding the SQL MERGE statement INSERT INTO SELECT statement overview and examples SQL multiple joins for beginners with examples Understanding the SQL Decimal data type DELETE CASCADE and UPDATE CASCADE in SQL Server foreign key SQL Not Equal Operator introduction and examples SQL CROSS JOIN with examples The Table Variable in SQL Server SQL Server table hints – WITH (NOLOCK) best practices

Trending

SQL Server Transaction Log Backup, Truncate and Shrink Operations Six different methods to copy tables between databases in SQL Server How to implement error handling in SQL Server Working with the SQL Server command line (sqlcmd) Methods to avoid the SQL divide by zero error Query optimization techniques in SQL Server: tips and tricks How to create and configure a linked server in SQL Server Management Studio SQL replace: How to replace ASCII special characters in SQL Server How to identify slow running queries in SQL Server SQL varchar data type deep dive How to implement array-like functionality in SQL Server All about locking in SQL Server SQL Server stored procedures for beginners Database table partitioning in SQL Server How to drop temp tables in SQL Server How to determine free space and file size for SQL Server databases Using PowerShell to split a string into an array KILL SPID command in SQL Server How to install SQL Server Express edition SQL Union overview, usage and examples

Solutions

Read a SQL Server transaction logSQL Server database auditing techniquesHow to recover SQL Server data from accidental UPDATE and DELETE operationsHow to quickly search for SQL database data and objectsSynchronize SQL Server databases in different remote sourcesRecover SQL data from a dropped table without backupsHow to restore specific table(s) from a SQL Server database backupRecover deleted SQL data from transaction logsHow to recover SQL Server data from accidental updates without backupsAutomatically compare and synchronize SQL Server dataOpen LDF file and view LDF file contentQuickly convert SQL code to language-specific client codeHow to recover a single table from a SQL Server database backupRecover data lost due to a TRUNCATE operation without backupsHow to recover SQL Server data from accidental DELETE, TRUNCATE and DROP operationsReverting your SQL Server database back to a specific point in timeHow to create SSIS package documentationMigrate a SQL Server database to a newer version of SQL ServerHow to restore a SQL Server database backup to an older version of SQL Server

Categories and tips

►Auditing and compliance (50) Auditing (40) Data classification (1) Data masking (9) Azure (295) Azure Data Studio (46) Backup and restore (108) ►Business Intelligence (482) Analysis Services (SSAS) (47) Biml (10) Data Mining (14) Data Quality Services (4) Data Tools (SSDT) (13) Data Warehouse (16) Excel (20) General (39) Integration Services (SSIS) (125) Master Data Services (6) OLAP cube (15) PowerBI (95) Reporting Services (SSRS) (67) Data science (21) ►Database design (233) Clustering (16) Common Table Expressions (CTE) (11) Concurrency (1) Constraints (8) Data types (11) FILESTREAM (22) General database design (104) Partitioning (13) Relationships and dependencies (12) Temporal tables (12) Views (16) ►Database development (418) Comparison (4) Continuous delivery (CD) (5) Continuous integration (CI) (11) Development (146) Functions (106) Hyper-V (1) Search (10) Source Control (15) SQL unit testing (23) Stored procedures (34) String Concatenation (2) Synonyms (1) Team Explorer (2) Testing (35) Visual Studio (14) DBAtools (35) DevOps (23) DevSecOps (2) Documentation (22) ETL (76) ►Features (213) Adaptive query processing (11) Bulk insert (16) Database mail (10) DBCC (7) Experimentation Assistant (DEA) (3) High Availability (36) Query store (10) Replication (40) Transaction log (59) Transparent Data Encryption (TDE) (21) Importing, exporting (51) Installation, setup and configuration (121) Jobs (42) ►Languages and coding (686) Cursors (9) DDL (9) DML (6) JSON (17) PowerShell (77) Python (37) R (16) SQL commands (196) SQLCMD (7) String functions (21) T-SQL (275) XML (15) Lists (12) Machine learning (37) Maintenance (99) Migration (50) Miscellaneous (1) ►Performance tuning (869) Alerting (8) Always On Availability Groups (82) Buffer Pool Extension (BPE) (9) Columnstore index (9) Deadlocks (16) Execution plans (125) In-Memory OLTP (22) Indexes (79) Latches (5) Locking (10) Monitoring (100) Performance (196) Performance counters (28) Performance Testing (9) Query analysis (121) Reports (20) SSAS monitoring (3) SSIS monitoring (10) SSRS monitoring (4) Wait types (11) ►Professional development (68) Professional development (27) Project management (9) SQL interview questions (32) Recovery (33) Security (84) Server management (24) SQL Azure (271) SQL Server Management Studio (SSMS) (90) SQL Server on Linux (21) ►SQL Server versions (177) SQL Server 2012 (6) SQL Server 2016 (63) SQL Server 2017 (49) SQL Server 2019 (57) SQL Server 2022 (2) ►Technologies (334) AWS (45) AWS RDS (56) Azure Cosmos DB (28) Containers (12) Docker (9) Graph database (13) Kerberos (2) Kubernetes (1) Linux (44) LocalDB (2) MySQL (49) Oracle (10) PolyBase (10) PostgreSQL (36) SharePoint (4) Ubuntu (13) Uncategorized (4) Utilities (21) Helpers and best practices BI performance counters SQL code smells rules SQL Server wait types © 2022 Quest Software Inc. ALL RIGHTS RESERVED. GDPR Terms of Use Privacy
Share:
0 comments

Comments (0)

Leave a Comment

Minimum 10 characters required

* All fields are required. Comments are moderated before appearing.

No comments yet. Be the first to comment!

How to connect to the Azure Storage Account with SQL Server Management Studio SSMS | Trend Now | Trend Now