MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.01k stars 21k forks source link

Add-AzTableRow throws error: MethodInvocationException: Exception calling "Execute" with "1" argument(s): "The specified resource does not exist." #122161

Open msetodev opened 2 weeks ago

msetodev commented 2 weeks ago

I cannot seem to get a new row added to my table via PowerShell.....

$clientId = "my_client_id" # Azure AD App Reg $clientSecret = "my_secret" $tenantId = "my_tenant_id"

$secureClientSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force $credential = New-Object PSCredential($clientId, $secureClientSecret) Connect-AzAccount -ServicePrincipal -Credential $credential -TenantId $tenantId Set-AzContext -Subscription "my_subscription_id"

$storageAccountName = "my_storage_account_name" $storageTableName = "my_table_name" $ctx = New-AzStorageContext -StorageAccountName $storageAccountName $cloudTable = (Get-AzStorageTable -Name $storageTableName -Context $ctx).CloudTable

$partitionKey1 = "abc" $rowKey1 = "def" Add-AzTableRow -Table $cloudTable -PartitionKey $partitionKey1 -RowKey $rowKey1

I keep getting the following error:

MethodInvocationException: Exception calling "Execute" with "1" argument(s): "The specified resource does not exist."

PS Version 7.4.2 running from VS Code

I made sure the service principal has Storage Table Contributor and there are no storage firewalls enabled

Following this article - https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

msetodev commented 2 weeks ago

I see it mentions line 266 of AzureRmStorageTableCoreHelper.psm1, which is the following:

return ($Table.Execute([Microsoft.Azure.Cosmos.Table.TableOperation]::Insert($entity)))

Is this trying to use CosmosDB instead of a table operation within an Azure Storage account??

PesalaPavan commented 2 weeks ago

@msetodev It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!!

msetodev commented 2 weeks ago

@msetodev

It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!!

Hey, I added the link!

PesalaPavan commented 2 weeks ago

@msetodev Thanks for your feedback! We will investigate and update as appropriate.

SaibabaBalapur-MSFT commented 2 weeks ago

@msetodev I'd recommend working closer with our support team via an Azure support request. Or you can leverage our Q&A forum by posting your issue there so our community, and MVPs can further assist you in troubleshooting this issue or finding potential workarounds.Teams Q&A forum for technical questions about the configuration and administration of Microsoft Teams on Windows.Microsoft Teams Community forum

msetodev commented 1 week ago

@msetodev I'd recommend working closer with our support team via an Azure support request. Or you can leverage our Q&A forum by posting your issue there so our community, and MVPs can further assist you in troubleshooting this issue or finding potential workarounds.Teams Q&A forum for technical questions about the configuration and administration of Microsoft Teams on Windows.Microsoft Teams Community forum

Well that team surely has access to this channel, so why not it be addressed here?

SaibabaBalapur-MSFT commented 1 week ago

@msetodev I'm going to assign this to the document author so they can take a look at it accordingly.

@akashdubey-ms please review it.