Created
March 31, 2017 17:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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