Cannot find an overload for “Insert” and the argument count: “1”.
Cannot find an overload for “ExecuteQuery” and the argument count:
“1”.
The above error occurs when you have both the Azure.Storage and Az.Storage modules loaded at the same time. There are two different versions of the DLL file Microsoft.WindowsAzure.Storage.dll. In some cases, it would use the Azure and in other cases it would use the Az one. The problem is that the Azure.Storage module is required to query or write to a storage table.
As a workaround ,you need to force any query and entity objects to use the same version of the Microsoft.WindowsAzure.Storage.dll file, as the Azure.Storage module. You can do this by saving the version information to a variable, and then specifying it when you create these objects.
You can try with below where we create the $assemblySN variable with the assembly’s full name. Then , we add that to the New-Object command for creating the query object from the TableQuery class. :
$Ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey
$table = Get-AzureStorageTable -Name $TableName -Context $Ctx
#get the $table Assembly FullName
$assemblySN = $table.CloudTable.GetType().Assembly.FullName
#Create a table query.
$query = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Table.TableQuery,$assemblySN"
$query.FilterString = "(Timestamp ge datetime'2021-12-30T06:00:00Z' and Timestamp lt datetime'2021-12-30T12:00:00Z')"
$entities = $table.CloudTable.ExecuteQuery($query)
For more information you can refer the blog by Matthew Dowst.
Update:
If the Issue still occurs then you can use Aztable module like :
$cloudTable = (Get-AzStorageTable –Name $table -Context $Ctx).CloudTable
$data = Get-AzTableRow -table $cloudTable -customFilter "PartitionKey eq '$filedate'"