Get-StorageBlob
Azure: Gets storage blobs
param(
[Parameter(Mandatory = $true)]
[string]$Container,
[Parameter(Mandatory = $false)]
[string]$Blob,
[Parameter(Mandatory = $true)]
[string]$StorageAccountName
)
try {
Import-Module Az.Storage -ErrorAction Stop
$ctx = (Get-AzStorageAccount -ResourceGroupName "*" -Name $StorageAccountName -ErrorAction Stop).Context
[hashtable]$cmdArgs = @{ 'Container' = $Container; 'Context' = $ctx; 'ErrorAction' = 'Stop' }
if ($Blob) { $cmdArgs.Add('Blob', $Blob) }
$blobs = Get-AzStorageBlob @cmdArgs
Write-Output $blobs
} catch {
Write-Error $_
exit 1
}The name of the storage container.
The name or prefix of the blob(s) to list (optional).
The name of the storage account for context.