LinuxCommandLibrary

az-storage-table

Manage Azure Storage tables and entities

TLDR

Create a new table in the storage account

$ az storage table create --account-name [storage_account_name] [[-n|--name]] [table_name] --fail-on-exist
copy

Generate a shared access signature for the table
$ az storage table generate-sas --account-name [storage_account_name] [[-n|--name]] [table_name] --permissions [sas_permissions] --expiry [expiry_date] --https-only
copy

List tables in a storage account
$ az storage table list --account-name [storage_account_name]
copy

Delete the specified table and any data it contains
$ az storage table delete --account-name [storage_account_name] [[-n|--name]] [table_name] --fail-not-exist
copy

SYNOPSIS

az storage table SUBCOMMAND [OPTIONS]

PARAMETERS

SUBCOMMANDS
    One of the available operations on Azure Storage Tables. This is the first argument after az storage table and dictates the action to be performed. Common subcommands include:
create: Create a new table.
delete: Delete an existing table.
exists: Check if a table exists.
generate-sas: Generate a Shared Access Signature for a table.
list: List tables within a storage account.
show: Get properties of a specific table.

--account-name NAME
    The name of the storage account to operate on. This is typically used in conjunction with --account-key.

--account-key KEY
    The storage account key to use for authentication. This is an alternative to --connection-string or --sas-token.

--connection-string STRING
    The connection string for the storage account. This provides all necessary authentication details and is an alternative to specifying --account-name and --account-key separately.

--name NAME
    The name of the specific table to operate on. This parameter is required for subcommands that target a single table, such as create, delete, or show.

--sas-token TOKEN
    The Shared Access Signature token to use for authorization. This offers granular, time-limited access and is an alternative to full account keys or connection strings.

--output FORMAT
    Output format for the command result. Common formats include 'json' (default), 'tsv', 'table', 'yaml', or 'none'.

--query JMESPATH
    A JMESPath query string to filter or transform the output of the command, allowing for custom data extraction.

DESCRIPTION

The az storage table command group in the Azure CLI provides a comprehensive interface for managing Azure Storage Tables. Azure Table storage is a NoSQL key/attribute data store, offering a highly scalable and cost-effective way to store structured, non-relational data in the cloud. This command group allows users to perform various operations directly on tables, including creating new tables, deleting existing ones, listing tables within a storage account, viewing specific table properties, and generating Shared Access Signatures (SAS) for secure, time-limited access. It interacts with the Azure Storage service to manage the table resource itself, distinct from managing entities (rows) within a table, which is handled by the az storage entity command group. Operations typically require specifying the target storage account, either by name and key, a connection string, or a SAS token, and proper Azure authentication through az login.

CAVEATS

Using az storage table commands necessitates the Azure CLI to be installed and properly configured, along with an active authenticated session against Azure (via az login). Appropriate permissions on the storage account are crucial; typically, 'Storage Account Contributor' or more specific data plane roles like 'Storage Table Data Contributor' are required. Table names must adhere to Azure naming conventions, including being unique within a storage account, starting with a letter or number, and containing only alphanumeric characters. All operations performed on Azure Storage services, including table management, incur costs based on usage and stored data.

USAGE CONTEXT AND AUTHENTICATION

Before executing az storage table commands, ensure you are logged into Azure using az login. You can specify the target storage account using its name and a key, a full connection string, or a SAS token provided directly within the command. For convenience, you can also set environment variables like AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY to avoid repeatedly typing account credentials for subsequent commands in the same session.

EXAMPLE: CREATE AND LIST TABLES

To create a new table named mydata within a storage account called mycliaccount, using its access key:

az storage table create --name mydata --account-name mycliaccount --account-key "<your_storage_account_key>"

To list all tables present in the same storage account, displaying the output as a formatted table:

az storage table list --account-name mycliaccount --account-key "<your_storage_account_key>" --output table

HISTORY

The az command is the core of the Azure CLI, designed to provide a unified command-line experience across all Azure services. It emerged as a modern, cross-platform alternative to older Azure management tools. The az storage command group, including az storage table, has been a foundational component of the Azure CLI since its early development, evolving alongside the Azure Storage service itself. Its design emphasizes modularity, allowing new features and service updates to be integrated efficiently. The Azure CLI, including its storage commands, is an open-source project actively maintained by Microsoft and a community of contributors.

SEE ALSO

az storage blob, az storage queue, az storage file, az storage account, az storage entity, az login, az group

Copied to clipboard