paulomarquesc / AzureRmStorageTable

MIT License
40 stars 28 forks source link

Cannot find an overload for "ExecuteQuerySegmentedAsync" and the argument count: "2" #37

Closed allanmoller closed 5 years ago

allanmoller commented 5 years ago

Describe the bug When calling Get-AzTableRow i keep getting and "ExecuteQuerySegmentedAsync" error, i followed the guide, references in other issues creating my storage reference like this: $table = (Get-AzStorageTable -Context $storagecontext -Name $StorageTableName).CloudTable

i have also removed all RM modules.

I have the following modules:

Directory: \\xxxxx\My Documents\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Manifest 2.0.2 AzureRmStorageTable {Add-AzTableRow, Get-AzTableRow, Get-AzTableRowAll, Get-AzTableRowByPartitionKeyRowKey...}

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 1.5.2 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzCont... Script 1.5.1 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzCont... Script 1.0.1 Az.Aks {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script 1.1.0 Az.AnalysisServices {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesSe... Script 1.0.0 Az.ApiManagement {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementCustomHostnameCo... Script 1.0.0 Az.ApplicationInsights {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzA... Script 1.2.1 Az.Automation {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJo... Script 1.1.0 Az.Batch {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount...}
Script 1.0.0 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget... Script 1.2.0 Az.Cdn {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script 1.1.0 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesA... Script 1.8.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabili... Script 1.0.1 Az.ContainerInstance {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanc... Script 1.0.1 Az.ContainerRegistry {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzCont... Script 1.1.1 Az.DataFactory {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}
Script 1.0.0 Az.DataLakeAnalytics {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataL... Script 1.2.0 Az.DataLakeStore {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDat... Script 1.0.0 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-A... Script 1.0.0 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script 1.1.1 Az.EventGrid {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...} Script 1.1.0 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHu... Script 1.1.0 Az.HDInsight {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsight... Script 1.1.0 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIot... Script 1.2.0 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperatio... Script 1.2.1 Az.LogicApp {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccou... Script 1.1.0 Az.MachineLearning {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageH... Script 1.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.1.0 Az.Media {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMediaServiceKey, Get-AzMediaSer... Script 1.1.0 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script 1.7.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCe... Script 1.1.0 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey... Script 1.2.0 Az.OperationalInsights {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogData... Script 1.0.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}
Script 1.1.0 Az.PowerBIEmbedded {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa... Script 1.3.0 Az.RecoveryServices {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVa... Script 1.1.0 Az.RedisCache {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSched... Script 1.0.0 Az.Relay {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...} Script 1.4.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignmen... Script 1.3.1 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignmen... Script 1.0.0 Az.ServiceBus {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzS... Script 1.0.1 Az.ServiceFabric {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServ... Script 1.0.2 Az.SignalR {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script 1.9.0 Az.Sql {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActiv... Script 1.3.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKe... Script 1.2.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKe... Script 1.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStream... Script 1.0.1 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint... Script 1.2.0 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...} Manifest 2.0.2 AzTable {Add-AzTableRow, Get-AzTableRow, Get-AzTableRowAll, Get-AzTableRowByPartitionKeyRowKey...}
Script 5.1.2 Azure {Get-AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAutomationConnectio... Binary 2.0.2.4 AzureAD {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationExtensionPropert... Manifest 2.0.2 AzureRmStorageTable {Add-AzTableRow, Get-AzTableRow, Get-AzTableRowAll, Get-AzTableRowByPartitionKeyRowKey...}

Error Message Cannot find an overload for "ExecuteQuerySegmentedAsync" and the argument count: "2". At C:\Program Files\WindowsPowerShell\Modules\AzTable\2.0.2\AzureRmStorageTableCoreHelper.psm1:52 char:4

PowerShell Version Name Value


PSVersion 5.1.16299.1146
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.1146
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

paulomarquesc commented 5 years ago

Hi @allanmoller , can you please paste the code snippet, from how you get the table up to the cmdlet that is throwing the error?

Also, not that this will solve the issue, but in the meanwhile, I highly recommend removing the duplicated modules: Az.Accounts, Az.Resources and Az.Storage, leaving only the latest version of each.

samarths-msft commented 5 years ago

This repros for me as well. Here's the code snippet to get up to the failure: $myTable = Get-AzTableTable -ResourceGroup $resourceGroupName -StorageAccountName $storageAccountName ` -TableName "MyTable"

Then, I call this in a ForEach loop:

$row = Get-AzTableRow -table $myTable -partitionKey $someString1 ` -rowKey $someString2

if ($row) { Write-Warning "Storage table entry already exists. Skipping..." } else { Add-AzTableRow -table $myTable -partitionKey $someString1 -rowKey $someString2 -property @{"Prop1" = $val1 } }

I also followed the recommendation to remove duplicate modules. After that, I get two exceptions, not just one:

Cannot find an overload for "ExecuteQuerySegmentedAsync" and the argument count: "2". At C:\Program Files\WindowsPowerShell\Modules\AzTable\2.0.2\AzureRmStorageTableCoreHelper.psm1:52 char:4

Exception calling "Execute" with "1" argument(s): "Not Found" At C:\Program Files\WindowsPowerShell\Modules\AzTable\2.0.2\AzureRmStorageTableCoreHelper.psm1:239 char:10

paulomarquesc commented 5 years ago

Hi @samarths-msft, can you check that the modules left are the latest ones? The reason I'm insisting that this is due a conflict or not compatible module version is that I have a similar code running daily , always with the latest bits of the Az module: https://github.com/paulomarquesc/AzureRmStorageTable/blob/master/Tests/AzureRmStorageTable.Tests.ps1 and the results are published in the README.md file and I don't get a failure meaning that no breaking changes was introduced in the SDK/Az module.

samarths-msft commented 5 years ago

Hmm. I Uninstall-Module'd Az, AzTable, and AzureAD -- all versions. Then Install-Module'd all 3 again. Now I am not seeing this error. Thanks for your assistance in this matter!

paulomarquesc commented 5 years ago

Awesome, glad to hear that.

bjoernoltmanns commented 5 years ago

I'm having the same issue. The weird thing is, that it happened all of a sudden, without a change in code or any module update. I did the cleaning and removed duplicated versions already. I also re-installed the respective modules. Here is my module listing and my code:

Version Name


1.6.3 Az.Accounts 1.0.1 Az.Advisor 1.0.2 Az.Aks 1.1.1 Az.AnalysisServices 1.3.2 Az.ApiManagement 1.0.2 Az.ApplicationInsights 1.3.4 Az.Automation 1.1.2 Az.Batch 1.0.1 Az.Billing 1.3.1 Az.Cdn 1.2.1 Az.CognitiveServices 2.7.0 Az.Compute 1.0.1 Az.ContainerInstance 1.1.0 Az.ContainerRegistry 1.4.0 Az.DataFactory 1.0.1 Az.DataLakeAnalytics 1.2.3 Az.DataLakeStore 1.0.1 Az.DeploymentManager 1.0.0 Az.DevTestLabs 1.1.1 Az.Dns 1.2.2 Az.EventGrid 1.4.0 Az.EventHub 1.1.1 Az.FrontDoor 2.0.2 Az.HDInsight 1.0.0 Az.HealthcareApis 1.3.1 Az.IotHub 1.3.1 Az.KeyVault 1.3.1 Az.LogicApp 1.1.1 Az.MachineLearning 1.0.1 Az.ManagedServices 1.0.1 Az.MarketplaceOrdering 1.1.0 Az.Media 1.4.0 Az.Monitor 1.15.0 Az.Network 1.1.0 Az.NotificationHubs 1.3.3 Az.OperationalInsights 1.1.3 Az.PolicyInsights 1.1.0 Az.PowerBIEmbedded 1.4.5 Az.RecoveryServices 1.1.1 Az.RedisCache 1.0.1 Az.Relay 0.7.6 Az.ResourceGraph 1.7.0 Az.Resources 1.6.1 Az.Resources 1.3.0 Az.ServiceBus 1.1.1 Az.ServiceFabric 1.0.2 Az.SignalR 1.13.1 Az.Sql 1.8.0 Az.Storage 1.2.0 Az.StorageSync 1.0.0 Az.StreamAnalytics 1.0.1 Az.TrafficManager 1.4.0 Az.Websites 2.0.2.31 AzureAD 0.2.4.2 AzureAutomationAuthoringToolkit 2.0.2 AzureRmStorageTable 2.0.0 AzureServicePrincipalAccount

Connect to Azure Table Storage

Set-AzContext -Subscription $storageSubscriptionId | Out-Null $storageAccount = Get-AzStorageAccount -ResourceGroupName $storageResourceGroup -Name $storageAccountName $cloudTable = (Get-AzStorageTable –Name $storageTableName –Context $storageAccount.Context).CloudTable

$cloudTable = Get-AzTableTable -resourceGroup $storageResourceGroup -tableName $storageTableName -storageAccountName $storageAccountName # Result is the same as above

Get the Table

$table = Get-AzTableRow -Table $cloudTable -PartitionKey $partitionToWorkOn

The last line yields the exception described in the initial post here.