[英]Create a Shared Access Signature (SAS) for an Azure Cloud Storage Account with powershell
How do I create a SAS url for my entire cloud storage account? 如何为整个云存储帐户创建SAS URL?
I noticed the azure powershell cmdlets have a lot of ways to create SAS urls for specific resources (eg blob, queue, etc..), but I would like to create one SAS for all of them with powershell 我注意到azure powershell cmdlet有很多方法可以为特定资源(例如blob,queue等)创建SAS url,但是我想为所有使用powershell的SAS创建一个SAS URL。
I assume that you want to use Azure storage account SAS . 我假设您要使用Azure存储帐户SAS 。 More details please refer to the New-AzureStorageAccountSASToken
更多详细信息,请参阅New-AzureStorageAccountSASToken
New-AzureStorageAccountSASToken
-Service <SharedAccessAccountServices>
-ResourceType <SharedAccessAccountResourceTypes>
[-Permission <String>]
[-Protocol <SharedAccessProtocol>]
[-IPAddressOrRange <String>]
[-StartTime <DateTime>]
[-ExpiryTime <DateTime>]
[-Context <IStorageContext>]
[<CommonParameters>]
example : New-AzureStorageAccountSASToken -Service Blob,File,Table,Queue -ResourceType Service,Container,Object -Permission "racwdlup" -Context $ctx
Edit: 编辑:
I have already tried this API.
我已经尝试过此API。 It does not allow you to specify which Azure StorageAccount to generate the SAS for.
它不允许您指定要为其生成SAS的Azure存储帐户。
I test with resource mangment storage account, it works correctly on my side. 我使用资源管理存储帐户进行了测试,它在我这方面可以正常工作。 Details please refer to the screenshot.
详细信息请参考屏幕截图。
$resourceGroup = "Resource group"
$storageAccountName = "account name "
Login-AzureRmAccount
$storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroup -Name $storageAccountName
$ctx = $storageAccount.Context
$accountSAS = New-AzureStorageAccountSASToken -Service Blob,File,Table,Queue -ResourceType Service,Container,Object -Permission "racwdlup" -Context $ctx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.