Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple script to return the blobs in a container, you will need to be logged into an Azure subscription with Login-AzureRMAccount before this will return anything
param
(
[Parameter(Mandatory=$true,Position=0)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true,Position=1)]
[string]$StorageAccountName,
[Parameter(Mandatory=$true,Position=2)]
[string]$Container
)
try
{
$ErrorActionPreference = 'Stop';
$Error.Clear();
$ResourceGroup = Get-AzureRmResourceGroup -ResourceGroupName $ResourceGroupName;
$StorageAccount = Get-AzureRmStorageAccount -ResourceGroupName $ResourceGroup.ResourceGroupName -StorageAccountName $StorageAccountName;
$StorageAccountContainer = Get-AzureStorageContainer -Name $Container -Context $StorageAccount.Context;
$StorageAccountContainer.CloudBlobContainer.ListBlobs();
}
catch
{
throw $_;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.