Demo 03: Access storage for an Azure Linux virtual machine
Credential tasks
- Create a virtual machine (CLI).
- Add virtual machine data disks and configure partitions.
- Mount an SMB Azure file share on a Linux VM.
- Assign a managed identity on a Linux VM.
- Assign Azure roles.
- Transfer data to and from a Linux VM by using AzCopy.
Resource requirements
These resources can be created before or during the demonstration.
- Resource group
- Linux virtual machine.
- Storage account with file share and blob container.
- Uploaded files to use for testing.
- Managed identity.
Reference steps
Detailed steps are provided in these links.
- Quickstart: Create a Linux virtual machine with the Azure CLI on Azure
- Attach a data disk to a Linux VM
- Create an SMB file share
- Get started with AzCopy
Reference slides
Use these slides for additional context.
- Storage accounts
- Blob containers and files
- Files versus blobs
- Managed identities
- Role-based access control
Discussion points
Create a virtual machine using CLI - Reference #1
You can use an existing vm, rather than create another one.
-
Access the Cloud Shell.
-
Create the virtual machine with CLI. Point out this is the third way students have been shown to create vms.
Add a data disk to a Linux virtual machine - Reference #2
-
Review how to use the portal to add a data disk to a virtual machine. Students will use CLI in the exercise.
-
Connect to the virtual machine and use
lsblk
to list the disks. Note the disk size and that the disk is not mounted. -
Prepare the disk with
parted
andpartprobe
. Use the code in the reference link. -
Mount the disk and use
df
to list the mount point.
Access an SMB file share from the virtual machine - Reference #3 and student lab instructions
-
Locate the storage account and discuss file shares.
-
Assign a managed identity to the virtual machine. The identity should have access to the storage account.
-
Copy the portal script to access the file share from a Linux virtual machine.
-
Connect to the virtual machine and create a file with the script. You can use the vi editor.
-
Run the script and mount the file share.
Use AzCopy to copy a blob file to the data drive - Reference #4 and the student lab instructions.
-
Add the Blob Data Storage Contributor role to the virtual machine. Review other blob roles.
-
Connect to the virtual machine and install AzCopy. Review other tools that can be used for transfering files.
-
Use AzCopy to transfer a file from blob storage to the data drive. You can also transfer a file back to blob storage.