An open API service indexing awesome lists of open source software.

https://github.com/tenmax/azurekit

azurekit is a CLI toolkit to interact with microsoft azure blob storage.
https://github.com/tenmax/azurekit

azure-storage-blob cli-toolkit

Last synced: 6 months ago
JSON representation

azurekit is a CLI toolkit to interact with microsoft azure blob storage.

Awesome Lists containing this project

README

          

# AzureKit
*azurekit* is a CLI toolkit to interact with [microsoft azure blob storage](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/#blob-storage). There are several commands included.

1. [azruecat](#azurecat) - Output a blob content to stdout.
2. [azuresink](#azuresink) - Pipe stdin to a azure storage blob.
3. [azuresas](#azuresas) - Generate the Shared-Access-Signature to stdout.
4. [azuretbl2csv](#azuretable2csv-and-azuretable2json) - Dump azure table as csv file.
5. [azuretbl2json](#azuretable2csv-and-azuretable2json) - Dump azure table as json file.

# Requirement
Java 8

# Getting Start

1. First, you must prepare your [Connection String](https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/) for your storage account. The format is

```bash
DefaultEndpointsProtocol=[http|https];AccountName=myAccountName;AccountKey=myAccountKey
```

2. Download from [release](https://github.com/tenmax/azurekit/releases).

3. Run the commands.

## AzureCat

Usage

1. Print a resource

```bash
azurecat https://.blob.core.windows.net//
```

2. Concatenate and print the resources with prefix

```bash
azurecat --prefix https://.blob.core.windows.net//
```
3. Concatenate and print the resources with prefix and the resource should match the postfix

```bash
azurecat --prefix --postfix csv https://.blob.core.windows.net//
```

4. Decode the resource by gzip compression format.

```bash
azurecat -z --prefix --postfix gz https://.blob.core.windows.net//
```

The full help for `azurecat`

```
usage: azurecat [-c ]
-b Set the read buffer size in KBytes
-c The connection string
-h The help information
--postfix keep only the blob which has the path with the
specified postfix. The postfix only be used while
prefix is used.
--prefix cat all the blobs with the prefix
-v The version
-z The gzip format
```

## AzureSink

Usage

1. Upload the content 'helloword' to the given path

```bash
echo 'helloworld' | azuresink -c http://.blob.core.windows.net//
```

The full help for `azuresink`

```
usage: azuresink [-c ]
-c The connection string
-f Force upload even the blob exists
-h The help information
-v The version
```

## AzureSAS

Usage

1. Get the SAS url with 1 day expiration duration.

```bash
azuresas -c http://.blob.core.windows.net//
```

The full help for `azuresas`

```
usage: azuresas [-c ] -e
-c The connection string
-e The seconds to expired. (default=86400s)
-h The help information
-v The version
```

## AzureTable2CSV and AzureTable2JSON

Usage

1. Dump a table

```bash
azuretbl2csv -c https://.table.core.windows.net/
azuretbl2json -c https://.table.core.windows.net/
```

2. Select some columns

```bash
azuretbl2json -C "column1,column2" https://.table.core.windows.net/
```
3. Apply filter

```bash
azuretbl2json -f "(PartitionKey eq 'pk1' and RowKey eq 'rk1')" https://.table.core.windows.net/
```

The full help for `azuretbl2json`

```
usage: azuretbl2json [-c ]
-c The connection string
-C The selected columns
-f The filter string
-H,--no-header-row Do not output column names.
-t The take count. Default=1000
```

# Configuration File

You can put your connection strings at `~/.azure/storagekeys` line by line

Here is the example.

```
DefaultEndpointsProtocol=https;AccountName=myAccountName1;AccountKey=myAccountKey1
DefaultEndpointsProtocol=https;AccountName=myAccountName2;AccountKey=myAccountKey2
```

then, you can use the resource directly without connection string specified.

```bash
echo 'helloworld' | azurecat https://.blob.core.windows.net//
```

# Installation

## Mac

Install azurekit via [Homebrew](http://brew.sh/).

```bash
brew tap tenmax/tap
brew update
brew install azurekit
```

Upgrade azurekit

```bash
brew update
brew upgrade azurekit
```

## Docker

Run azurekit via [Docker](https://hub.docker.com/r/tenmax/azurekit).

```bash
docker run --rm -it tenmax/azurekit
```