Book Image

Learning Microsoft Azure Storage

By : Mohamed Waly
Book Image

Learning Microsoft Azure Storage

By: Mohamed Waly

Overview of this book

Microsoft Azure Storage is the bedrock of Microsoft's core storage solution offering in Azure. No matter what solution you are building for the cloud, you'll find a compelling use for Azure Storage. This book will help you get up-to-speed quickly on Microsoft Azure Storage by teaching you how to use the different storage services. You will be able to leverage secure design patterns based on real-world scenarios and develop a strong storage foundation for Azure virtual machines. You will start this book with an introduction to Microsoft Azure storage and how it can be used to build large-scale, real-world applications using Azure storage services such as blob, table, queue, and file. This book will also teach you about the different types of Azure Storage. You will then find out the best practices for designing your Azure VM storage, whether it is Windows based or Linux based and how to migrate your storage in different scenarios. You will learn also how to plan and implement your SQL database solution on Azure, and how to build your SQL database in different service models (IaaS/PaaS). Moreover, you will also learn best practices for dealing with Azure Backup, the role of Azure Site Recovery, and the solutions they offer in different scenarios. Finally, you will use StorSimple to unlock the maximum value from all of your data, and some tools that will help you manage your storage on-and off-premise (Azure), such as AzCopy and Storage Explorer. Monitoring your storage in no laughing matter, so you will learn to monitor, diagnose and troubleshoot it.
Table of Contents (9 chapters)

Automating your tasks

It is no surprise that we commonly face repetitive and time-consuming tasks. For example, you might want to create multiple storage accounts. You would have to follow the previous guide multiple times to get your job done. This is why Microsoft supports its Azure services with multiple ways of automating most of the tasks that can be implemented in Azure. Throughout this book, two of the automation methods that Azure supports will be used.

Azure PowerShell

PowerShell is commonly used with most Microsoft products, and Azure is no less important than these products.

Mainly, you can use Azure PowerShell cmdlets to manage your Azure Storage, however, you should be aware that Microsoft Azure has two types of cmdlets: one for the classic portal, and another for the portal we are using.

The main difference between the cmdlets of the classic portal and the current portal is there will be an RM added to the cmdlet of the current portal.

For example, if you want to create a storage account in the classic portal, you would use the following cmdlet:

New-AzureStorageAccount

But for the current portal, you would use:

New-AzureRMStorageAccount

By default, you can use Azure PowerShell cmdlets in Windows PowerShell; you will have to install its module first.

Installing the Azure PowerShell module

Installing the Azure PowerShell module from the PowerShell Gallery

  1. Open PowerShell in elevated mode.
  2. To install the Azure PowerShell module for the current portal, run the Install-Module AzureRM cmdlet. If your PowerShell requires the NuGet provider, you will be asked to agree to install it and you will have to agree to the installation policy modification, as the repository is not available on your environment, as shown in the following screenshot:
Figure 1.10: Installing the AzureRM PowerShell module

Creating a storage account in the Azure portal using PowerShell

  1. Log in to your Azure account using the Login-AzureRmAccount cmdlet. You will be prompted to enter your account credentials:
Figure 1.11: Log in to Azure via PowerShell
  1. Create another storage account with the same properties as we used for the portal, but with a different name:
Figure 1.12: Creating a new storage account using PowerShell
  1. Congratulations! You have created a storage account using PowerShell.

Azure command-line interface

The Azure command-line interface (CLI) is open source, cross-platform, and supports implementing all the tasks you can do in the Azure portal with commands.

Azure CLI comes in two flavors:

  • Azure CLI 2.0, which only supports the current Azure portal
  • Azure CLI 1.0, which supports both portals

Throughout the book, we will be using Azure CLI 2.0. So, let’s get started with its installation.

Installing the Azure CLI 2.0

To understand what the Azure CLI 2.0 is capable of, we need to install it. Let's do so by following these steps:

  1. Download Azure CLI 2.0 from the following link: https://azurecliprod.blob.core.windows.net/msi/azure-cli-2.0.12.msi.
  2. Once downloaded, you can start the installation by following the screenshots shown here:
    1. Run the executable files as administrator, and once the wizard opens, click on Install:
Figure 1.13: Installing the Azure CLI 2.0
    1. Once you click on Install, it will start to validate your environment to check whether it is compatible with it or not, then it starts the installation:
Figure 1.14: Installing Azure CLI 2.0
    1. Once the installation completes, you can click on Finish, and you are good to go:
Figure 1.15: Installing Azure CLI 2.0
  1. Once done, you can open the cmd and type az to access Azure CLI commands, as shown in the following diagram:
Figure 1.16: Opening the Azure CLI using CMD

Creating a Storage account using the Azure CLI 2.0

Let's get our hands dirty with the Azure CLI 2.0 to create an Azure Storage account:

  1. Log in to your Azure account using the az login command. You have to open the URL that pops up on the CLI and enter the code, as shown in the following screenshot:
Figure 1.17: Logging in to Azure via the Azure CLI 2.0
  1. Create another storage account with the same properties as we used for the portal, but with a different name, as shown in the following screenshot:
Figure 1.18: Creating an Azure storage account using the Azure CLI 2.0