Azure存储表条目删除

时间:2017-10-17 13:42:40

标签: azure-devops azure-table-storage

我在Azure表存储中有一些现有数据。因此,当我部署csv文件时,最新的更改正在部署,但是azure表存储中存在的数据不会被覆盖,或者旧数据不会被删除。例如:I现有的azure存储中有3行数据,当我部署有5行的csv文件时,5行数据正在部署,3行的旧数据没有删除。它应该被覆盖但是没有发生。请帮助我。 - 订阅详情:

$subscriptionName = "Tech Enabled Solutions"
        $resourceGroupName = "abc"
        $storageAccountName = "defghi"
        $location = "North Central US"
        $tableName = "TestTable"
        # Get the storage key for the storage account
        $storageAccountKey = "12345678990"
    # Get a storage context
        $ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
        $table = Get-AzureStorageTable -Name $tableName -Context $ctx -ErrorAction Ignore
        #If the table exists, start deleting its entities.
        if ($table -ne $null) 
        {
         $table=Get-AzureStorageTableRowAll -table $table | Remove-AzureStorageTableRow -table $table -Context $ctx
        }

1 个答案:

答案 0 :(得分:0)

Get-AzureStorageTableRowAll命令位于AzureRmStorageTable模块中,因此请在call命令之前安装它。

将此命令添加到脚本中以安装该模块:

Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
Install-Module -Name AzureRmStorageTable -Force -Verbose -Scope CurrentUser
相关问题