Skip to content

Instantly share code, notes, and snippets.

@jeffpatton1971
Created March 31, 2017 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffpatton1971/f94dfe8b635258277980b91372f2676e to your computer and use it in GitHub Desktop.
Save jeffpatton1971/f94dfe8b635258277980b91372f2676e to your computer and use it in GitHub Desktop.
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