Last active
February 6, 2021 09:32
-
-
Save codexponent/948f3cfb8055b8aec82a5750f8851a6e to your computer and use it in GitHub Desktop.
Mounting the Azure File Share with Azure Virtual Machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | |
| sudo apt update | |
| sudo apt install cifs-utils | |
| mkdir data | |
| az login | |
| resourceGroupName="<your-resource-group>" | |
| storageAccountName="<your-storage-account>" | |
| fileShareName="<your-file-share>" | |
| mntPath="/home/azureuser/data/$storageAccountName/$fileShareName" | |
| sudo mkdir -p $mntPath | |
| httpEndpoint=$(az storage account show \ | |
| --resource-group $resourceGroupName \ | |
| --name $storageAccountName \ | |
| --query "primaryEndpoints.file" | tr -d '"') | |
| smbPath=$(echo $httpEndpoint | cut -c7-$(expr length $httpEndpoint))$fileShareName | |
| storageAccountKey=$(az storage account keys list \ | |
| --resource-group $resourceGroupName \ | |
| --account-name $storageAccountName \ | |
| --query "[0].value" | tr -d '"') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment