Get total no of record in Azure table storage using az or powershell command

Jignesh Vala 61 Reputation points
2021-10-06T05:21:22.253+00:00

Hi Team,

I want to get total no of record in Azure table storage using az or powershell command or through table storage api Please let me know if it's possible.

Actually we need to run this command/api on daily basis to get a count and generate report.

Thanks in advance.

Best Regards,
Jignesh

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
171 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. KalyanChanumolu-MSFT 8,336 Reputation points
    2021-10-06T06:15:57.173+00:00

    @Jignesh Vala Welcome to Microsoft Q&A forums.

    Unfortunately, there is no way to return the count of records in Azure Tables.
    You will need to fetch the records by partition and count them on the client side.

    We will take your feedback and add it to our feature backlog. The product team will prioritize it for a future release.

    ----------

    If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

    0 comments No comments

  2. sadomovalex 3,631 Reputation points
    2021-10-06T16:00:33.243+00:00

    I used this script for getting total number of records from Azure storage table:

    function GetTable($connectionString, $tableName)
    {
        $context = New-AzStorageContext -ConnectionString $connectionString
        $azureStorageTable = Get-AzStorageTable $tableName -Context $context
        $azureStorageTable.CloudTable
    }
    
    function GetTableCount($table)
    {
     (Get-AzTableRow -table $table | measure).Count    
    }
    
    $connectionString = "..."
    $table = GetTable $connectionString "MyTableName"
    GetTableCount $table
    
    0 comments No comments

  3. Peter 11 Reputation points
    2022-02-25T07:49:06.93+00:00

    I tried this script but this takes forever on a table with a big row count

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.