Blob Storage¶
Process files with blob triggers and read/write blobs using bindings in PowerShell.
Blob Trigger¶
function.json:
{
"bindings": [
{
"name": "InputBlob",
"type": "blobTrigger",
"direction": "in",
"path": "uploads/{name}",
"connection": "AzureWebJobsStorage"
}
]
}
run.ps1:
param($InputBlob, $TriggerMetadata)
$name = $TriggerMetadata.name
Write-Information "Processing blob '$name' ($($InputBlob.Length) bytes)"
The blob binding delivers content as a byte[] by default. For text, convert:
Output Blob Binding¶
Add an output binding to write a derived file:
{
"name": "OutputBlob",
"type": "blob",
"direction": "out",
"path": "processed/{name}",
"connection": "AzureWebJobsStorage"
}
Using the Az.Storage Module¶
For dynamic paths or listing operations, use the module with a managed identity:
Connect-AzAccount -Identity
$ctx = New-AzStorageContext -StorageAccountName $env:StorageAccountName -UseConnectedAccount
Get-AzStorageBlob -Container "uploads" -Context $ctx
Blob trigger scaling
Blob triggers on Consumption can lag under high volume. For latency-sensitive processing, prefer an Event Grid-based blob trigger or a queue.