From 47205a456ffe9c975ce93326a0f24fdff2e1f410 Mon Sep 17 00:00:00 2001 From: Cameron Battagler Date: Thu, 16 Mar 2017 15:43:53 -0500 Subject: [PATCH] aligning AutoExportBlobRetention documentation and script to AutoExport script --- .../AutoExportBlobRetention.ps1 | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/samples/manage/azure-automation-automated-export/AutoExportBlobRetention.ps1 b/samples/manage/azure-automation-automated-export/AutoExportBlobRetention.ps1 index 7840a092..89d25746 100644 --- a/samples/manage/azure-automation-automated-export/AutoExportBlobRetention.ps1 +++ b/samples/manage/azure-automation-automated-export/AutoExportBlobRetention.ps1 @@ -1,14 +1,21 @@ -# The storage key for the storage account you are using. -$storageKey = Get-AutomationVariable -Name "STORAGEKEYVARIABLENAME"; -# The name of the storage container you are using. -$storageContainer = "STORAGECONTAINERNAME"; -# Set up the storage context for the storage account. -$context = New-AzureStorageContext -StorageAccountName "STORAGEACCOUNTNAME" -StorageAccountKey $storageKey -# Get all of the blobs in the storage account. -$blobs = Get-AzureStorageBlob -Container $storageContainer -Context $context +#Azure Automation String Variable name for your Storage Account Key +$storageKeyVariableName = "STORAGEKEYVARIABLENAME"; +#Name of your Storage Account +$storageAccountName = "STORAGEACCOUNTNAME"; +#Name of your Storage Container +$storageContainerName = "STORAGECONTAINERNAME"; # Set the number of days that you want the blob to be stored for. $retentionInDays = 30 + +# Get the storage key +$storageKey = Get-AutomationVariable -Name $storageKeyVariableName; +# Set up the storage context for the storage account. +$context = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageKey +# Get all of the blobs in the storage account. +$blobs = Get-AzureStorageBlob -Container $storageContainerName -Context $context + + foreach($blob in $blobs) { # Get the current time to compare to the time that the blob was created.