Hi,
Leveraging the cerebrata cmdlets for Azure, we can easily backup our blob containers via snapshot, this will prove useful for Page Blobs that are Random Access i.e. VHD’s on Cloud Drive
Here is how Purging Snapshots works
#requires -version 2.0 param ( [parameter(Mandatory=$true)] [string]$AzureAccountName, [parameter(Mandatory=$true)] [string]$AzureAccountKey, [parameter(Mandatory=$true)] [array]$BlobContainers ) $ErrorActionPreference = "Stop" if ((Get-PSSnapin -Registered -Name AzureManagementCmdletsSnapIn -ErrorAction SilentlyContinue) -eq $null) { throw "AzureManagementCmdletsSnapIn missing. Install them from Https://www.cerebrata.com/Products/AzureManagementCmdlets/Download.aspx" } Add-PSSnapin AzureManagementCmdletsSnapIn -ErrorAction SilentlyContinue function SnapShotBlobContainer { param ( $containers, $blobContainerName ) Write-Host "Starting snapshot $blobContainerName" $container = $containers | Where-Object { $_.BlobContainerName -eq $blobContainerName } if ($container -eq $null) { Write-Host "Container $blobContainerName doesn't exist, skipping snapshot" } else { Write-Host "Found blob container $blobContainerName" Checkpoint-BlobContainer -Name $container.BlobContainerName -SaveSnapshotInformation -AccountName $AzureAccountName -AccountKey $AzureAccountKey Write-Host "Snapshot complete for $blobContainerName" } } $containers = Get-BlobContainer -AccountName $AzureAccountName -AccountKey $AzureAccountKey foreach($container in $BlobContainers) { SnapShotBlobContainer $containers $container }
Then just call the script with the params. remember an array of items is parsed in like this:
-BlobContainers:@(‘container1’, ‘contaner2’) -AzureAccountName romikoTown -AzureAccountKey blahblahblahblahblehblooblowblab==