[英]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.