Documenting Azure Storage Accounts

This is the basis for azure storage account documentation:
Add-AzureAccount

try
{
Add-Type -path “.\Newtonsoft.Json.6.0.8\lib\net40\Newtonsoft.Json.dll”
Add-Type -path “.\System.Spatial.5.6.4\lib\net40\System.Spatial.dll”
Add-Type -path “.\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll”
Add-Type -path “.\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll”
Add-Type -path “.\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll”
Add-Type -path “.\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll”
Add-Type -path “.\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll”

}
catch
{
write-host $_.Exception.Message
write-host $_.Exception.LoaderExceptions
}

Get-AzureStorageAccount | % {

$accountname = $_.StorageAccountName;
$pwd = (Get-AzureStoragekey -StorageAccountName $accountname).Primary;

$connectionString = “DefaultEndpointsProtocol=https;AccountName=$($accountname);AccountKey=$($pwd)”;
$account = [Microsoft.WindowsAzure.Storage.CloudStorageAccount]::Parse(“DefaultEndpointsProtocol=https;AccountName=$($accountname);AccountKey=$($pwd)”)

$cloud = $account.CreateCloudTableClient()

$cloud.ListTables() | select @{Name=’Account’;Expression={$accountname}},Name,@{Name=’Type’;Expression={‘Table Storage’}}

$blob = $account.CreateCloudBlobClient()

$blob.ListContainers() | select @{Name=’Account’;Expression={$accountname}},Name,@{Name=’Type’;Expression={‘Blob Accounts’}}

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s