Upload and download data using AzCopy
You can upload data to Azure Blob Storage using AzCopy. The only condition is that the storage account and destination container should already exist. In the following example, the CreateUserTemplate.csv file will be copied to the destcontainer. This example assumes that the CSV file is in the location that you are running the azcopy command.
azcopy copy “CreateUserTemplate.csv” “https://examref.blob.core.windows.net/ destcontainer/CreateUserTemplate.csv”
If you are using a SAS token, the syntax would be
azcopy copy “CreateUserTemplate.csv” “https://examref.blob.core.windows.net/ destcontainer/CreateUserTemplate.csv?<sas token>”
You can upload multiple files with folder structures using the –recursive=true option with
AzCopy.
azcopy copy “CreateUserTemplate.csv” “https://examref.blob.core.windows.net/ destcontainer/CreateUserTemplate.csv?<sas token>”
You can also download the data from Azure Blob Storage using AzCopy. In the following example, the CreateUserTemplate.csv file will be downloaded from the srccontainer:
azcopy copy “https://examref.blob.core.windows.net/srccontainer/CreateUserTemplate.csv ” “CreateUserTemplate.csv”
Async blob copy
The AzCopy application can also be used to copy between storage accounts. The following example shows how to copy the blob from the source storage account’s container to the desti- nation storage account’s container using a SAS token:
AzCopy copy “https://examref.blob.core.windows.net/srccontainer/[blob-path]?<sas token>” “https://examrefdest.blob.core.windows.net/destcontainer/[blob-path]?<sas token>”
Sync blob copy
You can use the azcopy sync command to synchronize copies between two blob containers. This command synchronizes the contents of a destination container with a source container by copying blobs if the last modified time of a blob in the destination is earlier than that of the corresponding blob in the source. By default, the recursive flag is true for the sync command and copies all subdirectories:
azcopy sync “https://examref.blob.core.windows.net/srccontainer/?<sas token>” “https://examref.blob.core.windows.net/destcontainer/”
Skill 2.3: Configure Azure Files and Azure Blob Storage
Azure Files is a fully managed file share service that offers endpoints for the Server Message Block (SMB) protocol, Network File System (NFS) protocol, and the Azure Files REST API. This allows you to create one or more file shares in the cloud (with a default maximum size of 5 TiB per share). You can enable large file share for a storage account and create file shares up to 100 TiB. Also, if you are using the Premium SKU, you get 100 TiB by default. Azure Files can be used as you would a regular Windows file server, such as for shared storage or for new uses such as part of a lift-and-shift migration strategy.
Create and configure a file share in Azure Storage
There are several common use cases for Azure Files. A few examples include the following:
- Migration of existing applications that require a file share for storage
- Shared storage of files, such as web content, log files, application configuration files, or even installation media
- Replacement of an existing file server
Figure 2-31 shows the hierarchy of files stored in Azure Files.
FIGURE 2-31 Azure Files entities and relationship hierarchy