79488208

Date: 2025-03-06 03:50:01
Score: 1
Natty:
Report link

I'm not seeing a better way than what you presented @Jason. I gave my service principal the Storage Blob Data Reader role and then created a condition (via the "Code" Editor type) to only allow the Blob.List SubOperation.

(
 (
 (ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'} AND SubOperationMatches{'Blob.List'})
 )
)

RBAC Example

(My other screenshots look like Jason's)

Then I tested using

# Authenticate
az login --service-principal -u $clientid -p $clientsecret --tenant $tenant
# Unsuccessful attempt to download. (az blob storage show is the same)
az storage blob download --container-name $container --name test.txt --subscription $subscriptionid --account-name $account
# Successful attempt to view the lastModified property
az storage blob list --container-name $container --account-name $account --query "[].properties.lastModified" | jq '.[]' -r
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Jason
  • Low reputation (1):
Posted by: Kevin Stevens