Create an Azure Storage Table
This guide will walk you through the process of creating a new table in Azure Table Storage using the Azure portal and the Azure CLI.
Prerequisites
- An Azure account. If you don't have one, sign up for a free account.
- An Azure Storage account. If you don't have one, you can create one through the Azure portal.
Using the Azure Portal
The Azure portal provides a user-friendly graphical interface for managing your Azure resources.
-
Navigate to your Storage Account:
Sign in to the Azure portal. In the search bar at the top, type "Storage accounts" and select it from the results. Choose the storage account where you want to create the table.
-
Access Table Storage:
In the left-hand navigation menu of your storage account, under the Data storage section, select Tables.
-
Create a Table:
Click the + Table button at the top of the Tables blade. A panel will appear asking for table details.
-
Enter Table Name:
In the Table name field, enter a unique name for your table. Table names must follow specific naming conventions: start with a letter, contain only lowercase letters and numbers, and be between 3 and 63 characters long.
-
Set Access Level:
Choose the desired access level for your table. For most use cases, Private is recommended for security.
-
Create the Table:
Click the OK button. Your new table will be created and listed in the Tables blade.
Tip: Azure Table Storage is schema-less. You don't need to define columns upfront. Columns are added implicitly when you insert entities with new properties.
Using the Azure CLI
The Azure Command-Line Interface (CLI) is a powerful tool for automating Azure resource management.
First, ensure you have the Azure CLI installed and are logged in to your Azure account:
az login
To create a table, you'll use the az storage table create command:
az storage table create \
--name MyNewTable \
--account-name mystorageaccountname \
--account-key YOUR_STORAGE_ACCOUNT_KEY
Explanation of Parameters:
--name(or-n): The name of the table to create. Follows the same naming conventions as mentioned for the portal.--account-name: The name of your Azure Storage account.--account-key: The access key for your storage account. You can find this under your storage account's Access keys section in the Azure portal. For security, consider using Shared Access Signatures (SAS) or managed identities for programmatic access in production environments.
If you prefer to use a connection string, you can use that instead of account name and key:
az storage table create \
--name MyOtherTable \
--connection-string "DefaultEndpointsProtocol=https;AccountName=mystorageaccountname;AccountKey=YOUR_STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net"
Upon successful execution, the CLI will return JSON output confirming the table creation.
Note: For production scenarios, avoid hardcoding storage account keys. Use environment variables, Azure Key Vault, or managed identities to securely manage credentials.
Next Steps
- Learn how to insert, query, and manage entities in your tables.
- Explore Azure Table Storage performance considerations.