简体   繁体   English

使用 Azure PowerShell 列出容器上的现有 SASToken

[英]List existing SASTokens on a container using Azure powershell

When creating a SASToken via powershell it retunrs the created SAS token url from New-AzureStorageContainerSASToken comdlet.通过 powershell 创建 SASToken 时,它会从 New-AzureStorageContainerSASToken comdlet 中返回创建的 SAS 令牌 url。

$Context = New-AzureStorageContext -StorageAccountName $StorageAccount -StorageAccountKey $StorageAccountKey                                                        
$now = Get-Date

$sasUrl = New-AzureStorageContainerSASToken -Name mycontainer -Permission rwdl -StartTime $now.AddHours(-1) -ExpiryTime $now.AddMonths(1) -Context $context -FullUri  
echo $sasUrl 

But now in case I lost it, how can I list the exiting SASTokens?但现在万一我丢失了,我该如何列出现有的 SASToken? You may have few on the same container.您可能在同一个容器上很少。

Tried Get-AzureStorageContainer but this information is unavailable.尝试了 Get-AzureStorageContainer,但此信息不可用。
Played with other Get-AzureStorage* and failed to find it.和其他 Get-AzureStorage* 一起玩过,没找到。
Is this operation supported via powershell?是否通过 powershell 支持此操作?

无法获取 SAS URL 列表,因为它们未存储在 Azure 存储中的任何位置。

Probably a bit late.... but on this page: https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1可能有点晚了......但在这个页面上: https ://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1

It says: "The SAS token generated by the storage client library is not tracked by Azure Storage in any way. You can create an unlimited number of SAS tokens on the client side."它说:“存储客户端库生成的 SAS 令牌不会被 Azure 存储以任何方式跟踪。您可以在客户端创建无限数量的 SAS 令牌。”

HTH! Paul保罗

With Powershell perhaps not, but Perhaps possible with the REST API: https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts/listaccountsas使用 Powershell 可能不是,但可能使用 REST API: https ://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts/listaccountsas

For the POST request, some of the request body parameters are REQUIRED to be filled which will need trial and error as you may not remember for what duration the SAS was allowed for.对于 POST 请求,需要填写一些请求正文参数,这需要反复试验,因为您可能不记得允许 SAS 的持续时间。 But provided all the values at https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts/listaccountsas#request-body are somehow documented , then it should be programmatically possible to get the SAS token itself.但是,如果https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts/listaccountsas#request-body上的所有值都以某种方式记录在案,那么应该可以通过编程方式获取 SAS 令牌本身。

I think you don't understand how SAS token works: Generated SAS tokens are not stored anywhere because when you generate a SAS token, no call is made to the Azure Storage server.我认为您不了解 SAS 令牌的工作原理:生成的 SAS 令牌不会存储在任何地方,因为当您生成 SAS 令牌时,不会调用Azure 存储服务器。 This is just a local calculation based on the secret key (like an asymetrical encryption with public and private key)这只是基于密钥的本地计算(如公钥和私钥的不对称加密)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Powershell 和共享访问签名在 Azure blob 容器中列出文件、删除文件、写入文件 - How to to list files, delete files, write files, in an Azure blob container using Powershell and Shared Access Signature 使用 powershell 获取 azure 容器 blob 内容 - Get azure container blob contents using powershell Azure Storage Rest-API 通过 Powershell 列出容器内容 - Azure Storage Rest-API via Powershell to list container content 如何使用 powershell 将 Azure WebApp 连接到现有的 vnet - How to connect Azure WebApp to an existing vnet using powershell 使用 powershell 将 docker 映像推送到 azure 容器注册表存储库中 - Push docker image into azure container registries repository using powershell 是否可以使用Powershell更新Azure AD中已经存在的用户的SignInName - Is it possible to update the SignInNames of already existing users in Azure AD using Powershell 如何使用 PowerShell 向现有 Azure 存储 BLOB 添加块? - How to add block to existing Azure Storage BLOB using PowerShell? 使用PowerShell为Azure中的现有nic分配公共IP地址 - Assigning a public ip address to an existing nic in Azure using powershell 如何使用 PowerShell 向现有的 azure 资源添加标签 - How to add tags to existing azure resources using PowerShell 如何使用 PowerShell 获取现有 Azure DevOps 项目的项目 ID? - How to get project id for an existing Azure DevOps project using PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM