0

Regardless of the type of storage accounts in Azure. Is there any way to create SAS token in Powershell or portal(doesn't seem like) that has exclusive access to a blob and not rest of blobs in the same storage account

Seems below command is available but maybe for different storage account type and not necessary for a blob


New-AzStorageBlobSASToken; 


I did create SAS token with below PowerShell script but this token is for the whole blob service

$SA = Get-AzStorageAccount | Select-Object StorageAccountName,ResourceGroupName,Location,SkuName,CreationTime | Out-GridView -PassThru
$key = Get-AzStorageAccountKey -ResourceGroupName $SA.ResourceGroupName -Name $SA.StorageAccountName
$context = New-AzStorageContext -StorageAccountName $SA.StorageAccountName -StorageAccountKey $key.value[0]
$sas = New-AzStorageAccountSASToken -Service Blob, File, Table, Queue -ResourceType Service, Container, Object -Permission "racwdlup" -Context $context
Write-Output $sas

1 Answer 1

2

New-AzStorageBlobSASToken does exactly that. It creates a SAS token for one specific blob (think of blob=file in this case)

https://learn.microsoft.com/en-us/powershell/module/az.storage/new-azstorageblobsastoken?view=azps-2.7.0#examples

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your response, I was able to create the SAS token. But when I'm trying to use it in Azure storage explorer I get this response, do you know what does that means: Invalid resource in SAS token. Only blob container ('c') resources are supported.
@BenyaminFamili, it means that you cannot use blob_uri + sas_token to login into azure storage explorer, at least you need a container + sas_token. See here for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.