Skip to content

Instantly share code, notes, and snippets.

@marinnedea
Last active August 1, 2018 16:48
Show Gist options
  • Save marinnedea/1edc6d58366f4c9a1771ac145bff42fc to your computer and use it in GitHub Desktop.
Save marinnedea/1edc6d58366f4c9a1771ac145bff42fc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# THIS IS A SAMPLE FILE!
# USE ACTUAL DATA WHEN DEPLOYING IT!
# AzCli 2.0 command:
# az vmss extension set \
# --publisher Microsoft.Azure.Extensions \
# --version 2.0 \
# --name CustomScript \
# --resource-group myResourceGroup \
# --vmss-name myScaleSet \
# --settings '{"fileUris":["Your_URL_to_the_gist_here"],"commandToExecute":"./smbfstab.sh"}'
# DOCS:
# https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-linux#create-a-persistent-mount-point-for-the-azure-file-share-with-etcfstab
# https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/quick-create-cli#deploy-sample-application
# Check if the mountpoint exists, else create it
mountpoint=/some/directory
[ ! -d $mountpoint ] && mkdir -p $mountpoint
# Add the AFS connect entry to /etc/fstab
sudo bash -c 'echo "//<storage-account-name>.file.core.windows.net/<share-name> $mountpoint cifs nofail,vers=<smb-version>,user=<username>,password=<password>,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab'
# mount everything
mount -a
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment