Skip to content

Instantly share code, notes, and snippets.

@DiHo78
Last active December 6, 2019 17:16
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 DiHo78/3f405dfbac22aca556e096d5189d97de to your computer and use it in GitHub Desktop.
Save DiHo78/3f405dfbac22aca556e096d5189d97de to your computer and use it in GitHub Desktop.
AzureBlockBlobStorageAccessTierChange.ps1
Login-AzureRmAccount
$StgAcc = "HierkommtMeinStorageAccountNameRein"
$StgKey = "HierMeinGeheimerAccessKey"
$ctx = New-AzureStorageContext -StorageAccountName $StgAcc -StorageAccountKey $StgKey
#welche Cotnainer habe ich denn?
Get-AzureStorageContainer -Context $ctx
#wir picken uns mal einen heraus
$Container = "raw2016"
#Get all the blobs in container
$blob = Get-AzureStorageBlob -Container $Container -Context $ctx | Where-Object {($_.Name -like "*PASSCAMP*") -and ($_.name -notlike "*THUMB*") -and ($_.name -notlike "*.db*" )}
#$blob | ogv
#nur zum test bzgl. der laufzeit
get-date
#Set tier of all the blobs to Archive
$blob.icloudblob.setstandardblobtier("Archive")
#nur zum test bzgl. der laufzeit
get-date
#nochmal gucken
$blob = Get-AzureStorageBlob -Container $Container -Context $ctx | Where-Object {$_.Name -like "*PASSCAMP*"}
$blob | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment