<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Edwin M SarmientoFrom Backup Tape to Microsoft Azure &#8211; Edwin M Sarmiento</title>
	<atom:link href="https://www.edwinmsarmiento.com/from-backup-tape-to-microsoft-azure/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.edwinmsarmiento.com</link>
	<description>Intentional Excellence</description>
	<lastBuildDate>Mon, 13 Apr 2026 21:00:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">84283043</site>		<item>
		<title>From Backup Tape to Microsoft Azure</title>
		<link>https://www.edwinmsarmiento.com/from-backup-tape-to-microsoft-azure/</link>
		<comments>https://www.edwinmsarmiento.com/from-backup-tape-to-microsoft-azure/#respond</comments>
		<pubDate>Thu, 25 Jun 2015 01:25:10 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Azure Blob Storage]]></category>
		<category><![CDATA[Backup To Azure]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<guid isPermaLink="false">http://www.edwinmsarmiento.com/?p=1758</guid>

				<description><![CDATA[&#8220;Only wimps use tape backup: REAL men just upload their important stuff on ftp, and let the rest of the world mirror it&#8221; &#8211; Linus Torvalds &#8211; I really don&#8217;t have a clue whether that quote was intended as a joke or not but that&#8217;s beside the point. If you&#8217;ve worked in the IT industry for a [&#8230;]]]></description>
					<content:encoded><![CDATA[<img width="760" height="290" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-760x290.jpg" class="featured-image wp-post-image" alt="" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-760x290.jpg 760w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-300x114.jpg 300w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-1024x391.jpg 1024w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-518x198.jpg 518w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-82x31.jpg 82w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-600x229.jpg 600w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2.jpg 1400w" sizes="(max-width: 760px) 100vw, 760px" /><p style="text-align: center;"><em>&#8220;Only wimps use tape backup: REAL men just upload their important stuff on ftp, and let the rest of the world mirror it&#8221;</em><br />
<em> &#8211; Linus Torvalds &#8211;</em></p>
<p>I really don&#8217;t have a clue whether that quote was intended as a joke or not but that&#8217;s beside the point. If you&#8217;ve worked in the IT industry for a while, you know that backup tapes have a lot of operational challenges. Back when I was a data center engineer, we had our enterprise backups taken using Tivoli Storage Manager (SQL Server native backups taken as files by TSM,) stored on tape and delivered at a secure remote location. Imagine the pain that we engineers had to go thru to retrieve tapes for tasks like auditing, data comparison, root cause analysis and, worse, disaster recovery. The fact that we had to retrieve tapes for disaster recovery has redefined (and documented) what our recovery objectives and service level agreements look like. We kept a week-old backup on local disk before completely declaring them as &#8220;on tape.&#8221;</p>
<p>Tapes are still being used today, primarily because they are cheap. In fact, ask any CTO or CIO why they still use tape and they&#8217;ll tell you almost the same thing: &#8220;<em>it&#8217;s the cheapest storage solution around.</em>&#8221; But there are other options. One of them is Microsoft Azure. If you are running SQL Server 2012 Service Pack 1 with Cumulative Update 2, you have the option to backup your databases to Azure Blob Storage natively (earlier versions of SQL Server can use the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=40740&amp;WT.mc_id=Blog_SQL_Announce_DI" target="_blank">Microsoft® SQL Server® Backup to Microsoft Azure®Tool</a> to do so.) You do need the following to test this out in your environment:</p>
<ul>
<li>A Microsoft Azure account</li>
<li>An Azure Storage Account created to store the database backups</li>
<li>A SQL Server 2012 instance with SP1 and CU2 installed or later versions. The SQL Server instance needs to be able to connect to Microsoft Azure</li>
<li>A SQL Server login that has the <strong>db_backup</strong> operator role with <em>Alter any credential</em> permissions</li>
</ul>
<h3>Creating an Azure Storage Account using Windows PowerShell</h3>
<p>Refer to <a href="http://www.mssqltips.com/sqlservertip/3318/introduction-to-azure-powershell-modules-for-the-sql-server-dba-part-1/" target="_blank">this article</a> that I wrote last year on how to get started with Windows PowerShell for Azure. Be sure to import your Azure publish settings file for authentication and install the Azure PowerShell module prior to running all of these cmdlets. My biggest reason for using PowerShell when dealing with Azure objects is primarily for automation (aside from the fact that I am sometimes annoyed when my Internet browser freezes.) I&#8217;ll use the <a href="http://msdn.microsoft.com/en-us/library/dn495115.aspx" target="_blank">New-AzureStorageAccount</a> PowerShell cmdlet to create a new Azure Storage Account</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><span style="color: #0000ff;">New-AzureStorageAccount</span> <span style="color: #000080;">-StorageAccountName</span> <span style="color: #800000;">&#8216;sqldbbackups4azure&#8217;</span> <span style="color: #000080;">-Location</span> <span style="color: #800000;">&#8216;East US&#8217;</span></div>
<p><a href="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1.jpg"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-1759" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1.jpg" alt="Azure-SQL-Backup1" width="1212" height="396" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1.jpg 1212w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-300x98.jpg 300w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-1024x335.jpg 1024w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-760x248.jpg 760w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-518x169.jpg 518w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-82x27.jpg 82w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup1-600x196.jpg 600w" sizes="(max-width: 1212px) 100vw, 1212px" /></a></p>
<p>&nbsp;</p>
<p>Once the storage account has been created, we need to create a storage container. We first need to make sure that the storage containers are created in the context of the storage account we just created. We&#8217;ll use the <a href="https://msdn.microsoft.com/en-us/library/dn495189.aspx" target="_blank">Set-AzureSubscription</a> and <a href="https://msdn.microsoft.com/en-us/library/dn806381.aspx" target="_blank">New-AzureStorageContainer</a> PowerShell cmdlets for these tasks.</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><span style="color: #339966;">#Define default storage account</span><br />
<span style="color: #0000ff;">Set-AzureSubscription</span> <span style="color: #000080;">-SubscriptionName</span> <span style="color: #800000;">&#8216;whatever subscription you have&#8217;</span> <span style="color: #000080;">-CurrentStorageAccountName</span> <span style="color: #800000;">&#8216;sqldbbackups4azure&#8217;</span></p>
<p><span style="color: #339966;">#Create Azure storage container, allowing only the current user to have permissions</span><br />
<span style="color: #0000ff;">New-AzureStorageContainer</span> <span style="color: #800000;">&#8216;sqldbbackups4azure&#8217;</span> <span style="color: #000080;">-Permission</span> <span style="color: #666699;">Off</span></div>
<p>Once we&#8217;ve created the storage account and storage container, we will need the URL endpoint that defines the storage container as well as the storage access key. The storage access key will be used for creating the credential inside SQL Server. Running the New-AzureStorageContainer PowerShell cmdlet will give you the blob endpoint for the storage container. Use that as a reference to build the URL endpoint that you will use for your SQL Server backups. It should be in the form <span style="color: #800000;"><strong>blob endpoint + storage account container name.</strong></span></p>
<p><a href="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2.jpg"><img decoding="async" class="aligncenter size-full wp-image-1763" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2.jpg" alt="Azure-SQL-Backup2" width="1400" height="534" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2.jpg 1400w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-300x114.jpg 300w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-1024x391.jpg 1024w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-760x290.jpg 760w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-518x198.jpg 518w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-82x31.jpg 82w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup2-600x229.jpg 600w" sizes="(max-width: 1400px) 100vw, 1400px" /></a></p>
<p>In this example, the URL endpoint for the storage container is <strong>https://sqldbbackups4azure.blob.core.windows.net/sqldbbackups4azure</strong></p>
<p>We will also use the <a href="https://msdn.microsoft.com/en-us/library/azure/dn495235.aspx" target="_blank">Get-AzureStorageKey</a> PowerShell cmdlet to retrieve the storage key that we will use to build the credential.</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><span style="color: #008000;">#Retrieve Azure storage account key</span><br />
(<span style="color: #0000ff;">Get-AzureStorageKey</span> <span style="color: #800000;">&#8216;sqldbbackups4azure&#8217;</span>).Primary</div>
<p><a href="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3.jpg"><img decoding="async" class="aligncenter size-full wp-image-1764" src="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3.jpg" alt="Azure-SQL-Backup3" width="1020" height="208" srcset="https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3.jpg 1020w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3-300x61.jpg 300w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3-760x155.jpg 760w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3-518x106.jpg 518w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3-82x17.jpg 82w, https://www.edwinmsarmiento.com/wp-content/uploads/2015/06/Azure-SQL-Backup3-600x122.jpg 600w" sizes="(max-width: 1020px) 100vw, 1020px" /></a></p>
<p>&nbsp;</p>
<p><span style="color: #800000;"><strong>NOTE:</strong> </span>I&#8217;m only using this as an example. Don&#8217;t ever post your Azure storage keys publicly <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h3>Create a SQL Server Credential</h3>
<p>Once we have the Azure storage account key, we can now create a SQL Server credential that we can use to connect SQL Server to the Azure storage account. But what is a SQL Server credential, anyway?</p>
<p style="text-align: center;"><div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><strong>A SQL Server credential is an object that is used to store authentication information required to connect to a resource outside of SQL Server.</strong></div></p>
<p>Because we are connecting to a resource outside of SQL Server &#8211; our Azure blob storage &#8211; we need a credential that will store the authentication mechanism we used in order to access that resource. We&#8217;ll use the name <strong>myAzureBlobStoreCredential</strong> for the credential.</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><code style="font-size: 14px;"><span style="color: green;">--Create a credential to connect to the Azure storage account</span><span style="color: blue;"><br />
</span><span style="color: green;">--the IDENTITY parameter value should be the name of the storage account<br />
</span><span style="color: blue;">CREATE </span><span style="color: black;">CREDENTIAL myAzureBlobStoreCredential </span><span style="color: blue;">WITH </span><span style="color: #434343;">IDENTITY </span><span style="color: blue;">= </span><span style="color: red;">'sqldbbackups4azure'</span><span style="color: gray;">,<br />
</span><span style="color: black;">SECRET </span><span style="color: blue;">= </span><span style="color: red;">'lcbjFTKvf4eGg9n3RjqPFklzuwkZH8Ph6lB7aiZQe4iFINEJv/EYOCd+6VdtLPqGYjBnux57bHCdpKlgoFzHeg=='</span><span style="color: black;"><br />
</span></code> </div>
<p>A couple of things to note here to make sure you avoid the common pitfalls:</p>
<ul>
<li>The IDENTITY parameter needs to be the name of the Azure storage you created. In this example, it&#8217;s <strong>sqldbbackups4azure</strong>.</li>
<li>The SECRET parameter is the Azure storage account key that you want to use. There is a primary and a secondary storage account key. We only need one</li>
</ul>
<h3>Backup your SQL Server databases to Microsoft Azure</h3>
<p>So, we have the Azure storage account, a blob URL, and a storage account key. We can go ahead and backup our databases to Azure. Using the <strong>BACKUP DATABASE</strong> command,</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><code style="font-size: 14px;"><span style="color: green;">--Backup the database to the Azure storage using blob URL<br />
</span><span style="color: blue;">BACKUP DATABASE </span><span style="color: black;">Northwind<br />
</span><span style="color: blue;">TO </span><span style="color: black;">URL </span><span style="color: blue;">= </span><span style="color: red;">'https://sqldbbackups4azure.blob.core.windows.net/sqldbbackups4azure/Northwind2012.bak'<br />
</span><span style="color: blue;">WITH </span><span style="color: black;">CREDENTIAL </span><span style="color: blue;">= </span><span style="color: red;">'myAzureBlobStoreCredential'</span><span style="color: gray;">,<br />
</span><span style="color: black;">COMPRESSION</span><span style="color: gray;">, </span><span style="color: black;">STATS<br />
GO  </span></code> </div>
<p>This is the same BACKUP DATABASE command that we regularly use except that it uses the Azure storage container blob URL as a destination and the credential that we&#8217;ve created. Notice that I used the <strong>COMPRESSION</strong> and <strong>STATS</strong> options in the command. For one, I need to know how long my full database backups initially take to complete so that I&#8217;ll know if they still fall within the backup maintenance window. Second, because I&#8217;m copying the backup files onto Azure blob storage, the process will take up network bandwidth. I want to make sure that there is minimal impact to my network bandwidth when I run my backups. In countries where the Internet usage is metered, every bit of bandwidth saved means a lot. Of course, both of these depend a lot on your Internet subscription as well. Be sure to coordinate with your network engineers when you implement this feature. Besides, there&#8217;s a reason for the term &#8220;<a href="https://en.wikipedia.org/?title=Traffic_shaping" target="_blank">packet shaping</a>.&#8221; You don&#8217;t want your backups failing because your network engineers implemented new firewall rules to throttle the bandwidth.</p>
<h3>Restoring your SQL Server databases from backups in Microsoft Azure</h3>
<p>You probably know by now that <a href="https://www.edwinmsarmiento.com/is-a-successful-backup-really-a-successful-backup/" target="_blank">I don&#8217;t really believe in successful backups</a>. What I do believe in is successfully restoring your backups. Since we&#8217;ve already managed to backup our databases in our Azure storage account, let&#8217;s test restoring those backups using the RESTORE DATABASE command. Note that this looks exactly like your typical RESTORE command except that the source is the storage blob URL with the name of the backup file and the credential that we&#8217;ve created to access the Azure blob storage.</p>
<div style="background-color:#eeeeee;border:1px solid #D6D6D6;font-family:arial,helvetica,sans-serif;font-size:15px;line-height:20px;margin:8px 0 20px;padding:15px 20px;"><code style="font-size: 14px;"><span style="color: green;">--Restore database backups from Microsoft Azure<br />
</span><span style="color: blue;">RESTORE DATABASE </span><span style="color: black;">Northwind<br />
</span><span style="color: blue;">FROM </span><span style="color: black;">URL </span><span style="color: blue;">= </span><span style="color: red;">'https://sqldbbackups4azure.blob.core.windows.net/sqldbbackups4azure/Northwind2012.bak'<br />
</span><span style="color: blue;">WITH </span><span style="color: black;">CREDENTIAL </span><span style="color: blue;">= </span><span style="color: red;">'myAzureBlobStoreCredential'<br />
</span><span style="color: gray;">,</span><span style="color: black;">MOVE </span><span style="color: red;">'Northwind' </span><span style="color: blue;">TO </span><span style="color: red;">'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Northwind.mdf'<br />
</span><span style="color: gray;">,</span><span style="color: black;">MOVE </span><span style="color: red;">'Northwind_Log' </span><span style="color: blue;">TO </span><span style="color: red;">'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Northwind.ldf'<br />
</span><span style="color: gray;">,</span><span style="color: black;">STATS </span><span style="color: blue;">= </span><span style="color: black;">10<br />
GO </span></code> </div>
<p>Because of the need for the Azure storage account credential in the backup/restore process, you now have to include this in your disaster recovery runbook and coordinate with whoever is managing your Azure subscription.</p>
<h4>Additional Resources:</h4>
<ul>
<li><a href="https://msdn.microsoft.com/en-us/library/jj919148(v=sql.110).aspx" target="_blank">SQL Server Backup and Restore with Windows Azure Blob Storage Service</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/jj720558.aspx" target="_blank">Tutorial: SQL Server Backup and Restore to Windows Azure Blob Storage Service</a></li>
<li><a href="http://www.mssqltips.com/sqlservertip/3318/introduction-to-azure-powershell-modules-for-the-sql-server-dba-part-1/" target="_blank">Introduction to Azure PowerShell Modules for the SQL Server DBA Part 1</a></li>
</ul>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/from-backup-tape-to-microsoft-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">1758</post-id>	</item>
	</channel>
</rss>