-
请使用来自的最新Azure Powershell
https://github.com/Azure/azure-powershell/releases
(当前为6.9.0)
-
如果您需要在没有读取权限的情况下使用SAS上载blob,则需要添加
-Force
Set-AzureStorageBlobContent
cmdlet。这是因为默认情况下,我们将检查dest blob是否存在(需要读取权限),并提醒用户weather覆盖dest blob是否存在。
$sas = New-AzureStorageBlobSASToken -container $containerName -Blob $blobname -Permission w -Context $ctxkey
$ctxsas = New-AzureStorageContext -StorageAccountName $StorageAccountName -SasToken $sas
$a = Set-AzureStorageBlobContent -File $localSrcFile -Container $containerName -Blob $blobname -Force -Context $ctxsas
除此之外,如果您使用最新版本的Azure Powershell,Get-AzureStorageContainer也可以与SAS一起使用。(无论如何,无法获取容器ACL,因为需要密钥权限)