Creating and configuring Azure Storage

Posted: October 20, 2017 in Azure

New-Storage-Storage Account

0

Installing AzCopy

AzCopy is a command-line utility designed for copying data to and from Microsoft Azure Blob, File, and Table storage using simple commands

Download and install tool from here

Creating system variable for AzureCopy

In system properties in advanced click Environment Variables

1

Under System variable click New

2

give variable a name and value (with quotes)

"C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"

3

Sign Out and Sign in to apply changes and test it type %azcopy% in cmd

4

Creating folder in Azure

Add-AzureAccount

$shareName = "assets"

$storageAccountName = "invoices"

Declares variables named _$shareName_ for the file share 

$shareName = "assets"
$folderName = "invoices"

# Get the storage account key and context
$storageAccountKey = (Get-AzureRmStorageAccountKey -Name mystorage102017 -ResourceGroupName myrg1).Value[0]
$ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
# create a share
$s = New-AzureStorageShare -Name $shareName -Context $ctx
# create a new folder in the share

New-AzureStorageDirectory -Share $s -Path $folderName

Upload files to Azure

All Resources-Storage Account-Files

7.png

8.PNG

9

9-1

Copy files to Azure

destkey can be found by clicking to Acess keys in storage account properties

0

%AzCopy% /Dest:https://mystorage102017.blob.core.windows.net/asset-images /destkey:yS+7qMMIdhGwGYr+ssLnCCOiRt+oe2Ii/6Cco9ID8msrFna5UI9F73MEX8lAOOzPjcDJYF7EJOevoVTdreWdLg== /Source:"C:\Users\asset-images"

5

6.PNG

By default uploaded files are not visible by default

9-2

To enable access we need to create shared access signature (SAS)

by clicking Shared access signature, here we can set permission level-set SAS expiry date

Click Generate SAS and copy it somewhere

10

11.png

Copy link of files we want to have access to

9-1

and append SAS key

https://mystorage102017.file.core.windows.net/assets/Invoice00001.docx?sv=2017-04-17&ss=bfqt&srt=sco&sp=r&se=2017-10-20T07:35:21Z&st=2017-10-18T23:35:21Z&spr=https&sig=Ns3B6Z66AL3iTQMtIQaqT47cW3zNCGsyxTqIJpuF1O8%3D

12.PNG

Accessing share from Azure VM

net use z: \\storage_account.file.core.windows.net\assets /u:storage_account

 

14

when prompted, enter storage key

 

13.png

 

15

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s