-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forbidden Response using Table-Level SAS Token on Get-AzStorageTable #14394
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage. Issue DetailsUsing AzTable 2.04 Sas Token was created 3 different ways Azure Portal - right Click on Table "Get SAS Token" Code is: $AzStorageAccount = "storage_accountname" throws DEBUG: 1:04:10 PM - GetAzureStorageTableCommand end processing, Start 7 remote calls. Finish 7 remote calls. Elapsed time 1538702.92 ms. Client operation id: Azure-Storage-PowerShell-ee008953-9bf3-4536-9ad2-74a5b8742830. DEBUG: AzureQoSEvent: CommandName - Get-AzStorageTable; IsSuccess - False; Duration - 00:00:01.8729751;; Exception - Microsoft.Azure.Cosmos.Table.StorageException: Forbidden RequestID:7b83f525-9002-0011-80a0-0b6c7f000000 hitting the URL in a browser works fine
|
@gwalkey If you would like to use the Get-AzStorageTable cmdlet then consider using an Account SAS instead. Per you above comments, you should already get account sas work. |
Let me recap
1) Account Level Token works with
a) REST API
b) Get-AzStorageTable (NOT THE RM Module, the AZ Module) (for some reason you are changing my request to using the RM module. Im not using the RM Module, im using AZ Module. See my Code Below)
2) Table-Level Token works fine in REST API, throws FORBIDDEN error with raud using Get-AzStorageTable
this is the bug im reporting,
obviously the Token is not the issue as it works with the REST API (Code Below)
It doesnt work with Get-AzStorageTable cmdlet
3) I will NEVER have access to an account-level token, the Boss gave me this token and said make it work with Powershell
|
Ill make it clearer: Get-AzStorageTable Fails with Table-Level SAS Token with ALL Permissions Succeeds with SAME TOKEN |
$tableSASUri = "https://[accountName].table.core.windows.net/[tableName]?sv=2017-07-29&tn=[tableName]&sig=[hidden]&se=2021-03-15T07%3A00%3A09Z&sp=raud"
$uri = [System.Uri]$tableSASUri
$CloudTable= New-Object -TypeName Microsoft.Azure.Cosmos.Table.CloudTable $uri
Get-AzTableRow -Table $CloudTable |
although you still misunderstand which cmdlet I am using ( NOT USING Get-AzureStorageTable), please read my code again Nowhere in MS Documentation is there an example of NOT using the AzModule and referencing the Cosmos Assembly Directly "3) If you just need to create a table object with the SAS for following inside table query, you can run it from a table SAS Uri like following:" This doc needs your example showing how to do this using a Table-Level SAS Token ONLY: thank you |
Thanks for your reply! Besides that, I am a little confused, I think you use "Get-AzStorageTable" , is that correct? (I do see it in your script. I don't think you are using "Get-AzStorageTable", just want to clarify the 2 names actually are old and new cmdlet name point to same function.) |
Is Table Storage not supported by MS Az Module? |
Also, according to these issues, AzTable seems unsupported by MS #12597 |
Thanks for your reply and questions! #3: Per the doc , even the table sas has permission raud, it only has permission to handle entities inside table , but don't have permission to get table properties like Get-AzStorageTable. This is server design, PowerShell has to follow it. #4: For "not documented", which document do you mean? There's document for AzTable like https://docs.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell#retrieve-all-entities #5: I will inform document team for your concern of the doc, and see if they can improve that. AzTable module not inside Azure Powershell release. Anyway, we will work with that module owner to make sure it can work with table cmdlets in Az.Storage module. |
never mind |
Using AzTable 2.04
Sas Token was created 3 different ways
Azure Portal - right Click on Table "Get SAS Token"
Powershell New-AzStorageTableSASToken
Azure Storage Explorer
All three SAS Tokens created on the Table ALONE fail
Using a SAS Token on the ENTIRE STORAGE ACCOUNT Always works
Code is:
Import-Module -Name Az.Storage
Import-Module -Name Az.Resources
Import-Module -Name AzTable
$AzStorageAccount = "storage_accountname"
$TableName = 'TableName'
$TableSasToken ="?st=2021-02-25T15%3A40%3A11Z&se=2022-01-01T04%3A59%3A00Z&sp=raud&sv=2018-03-28&tn=TableName&sig=mysig"
$StorageCtx = New-AzStorageContext -StorageAccountName $AzStorageAccount -SasToken $TableSasToken
$Table = Get-AzStorageTable -Name $tableName -Context $StorageCtx
throws
Forbidden
DEBUG: 1:04:10 PM - GetAzureStorageTableCommand end processing, Start 7 remote calls. Finish 7 remote calls. Elapsed time 1538702.92 ms. Client operation id: Azure-Storage-PowerShell-ee008953-9bf3-4536-9ad2-74a5b8742830.
DEBUG: AzureQoSEvent: CommandName - Get-AzStorageTable; IsSuccess - False; Duration - 00:00:01.8729751;; Exception - Microsoft.Azure.Cosmos.Table.StorageException: Forbidden
at Microsoft.WindowsAzure.Commands.Storage.Model.Contract.StorageTableManagement.DoesTableExist(CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
at Microsoft.WindowsAzure.Commands.Storage.Table.Cmdlet.GetAzureStorageTableCommand.d__12.MoveNext()
at Microsoft.WindowsAzure.Commands.Storage.Table.Cmdlet.GetAzureStorageTableCommand.WriteTablesWithStorageContext(IEnumerable`1 tableList)
at Microsoft.WindowsAzure.Commands.Storage.Table.Cmdlet.GetAzureStorageTableCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Request Information
RequestID:7b83f525-9002-0011-80a0-0b6c7f000000
RequestDate:Thu, 25 Feb 2021 18:04:08 GMT
StatusMessage:Forbidden
ErrorCode:
ErrorMessage:This request is not authorized to perform this operation.
RequestId:7b83f525-9002-0011-80a0-0b6c7f000000
Time:2021-02-25T18:04:08.4574077Z;
DEBUG: Finish sending metric.
DEBUG: 1:04:10 PM - GetAzureStorageTableCommand end processing.
hitting the URL in a browser works fine
using the same Table-level SAS Token against the REST API directly also works fine
The text was updated successfully, but these errors were encountered: