FileUploaderCLI Tool

For fun, I decided to make a CLI tool for bash that helps speed up the process a bit for uploading files into an Azure storage account.

Features

  • Uploads file to Azure Storage Account
  • Checks if a storage account exists before uploading file
  • Interactive prompts: If you didn’t provide any arguments when running the command, it will interactively prompt you for missing details
  • Command-line arguments

Prerequisites

To use this tool, you must have:

  • Bash
  • Azure CLI
  • jq: used for parsing JSON
  • a Valid Azure subscription

Installation Steps

Clone the repo from github:

    git clone https://github.com/yourusername/FileUploaderCLI.git cd FileUploaderCLI

    Ensure the azure cli is installed:

    az --version
    1. Install jq for parsing:
      • For Ubuntu systems:
        sudo apt-get install jq
      • For macOS:
        brew install jq

    How to Use FileUploaderCLI

    FileUploaderCLI can be run interactively or with arguments

    Command-Line Arguments

    You can provide necessary arguments when running this tool.

    ./stfileupload.sh --file-name example.txt --storage-account mystorageaccount --container mycontainer

    Running Interactively

    If you would rather not deal with arguments, simply run it, and it will prompt you for the missing information.

    ./stfileupload.sh

    Displaying Help Information

    For usage instructions, use the –help argument

    ./stfileupload.sh --help

    How it Works

    Here is what happens when the script is run:

    • Checks for required arguments: The script will first check if the required arguments are provided. if any are missing, it will interactively prompt you for these upon running the script
    • Verify storage account: The script connects to Azure to check if the storage account you provided exists before running anything else. If it does not exist, the script will display an error message and stop.
    • Upload the file: Once the storage account has verified that the storage account you provided indeed exists, it will then upload your file to the specified container in your storage account

    Leave a Reply

    Your email address will not be published. Required fields are marked *