locked
FILE SHARE SNAPSHOT AUTO DELETION RRS feed

  • Question

  • Hi all,

    I need your help to create an automation script (runbook) that will delete the snapshots from a storage account that I use as a fileshare after X days.

    I attach you the runbook (that works perfectly) that in case anyone will need it, I need the help to create the second part, so the deletion of the file after X days.

    #import-module AzureRM.Storage
    $connectionstring="DefaultEndpointsProtocol=https;AccountName=MYACCOUNT;AccountKey=MYKEY==;EndpointSuffix=core.windows.net"
    $sharename=":fileshare4backup"
    $ctx = New-AzureStorageContext -ConnectionString $connectionstring
    ##create snapshot 
    $share=Get-AzureStorageShare -Context $ctx -Name fileshare4backup
    $share.Properties.LastModified 
    $share.IsSnapshot
    $snapshot=$share.Snapshot()

    This following is the url of the naming of the files:

    https://MYACCOUNT.file.core.windows.net/fileshare4backup?snapshot=2018-02-12T13:24:52.0000000Z

    Thank you very much for your help.
    • Edited by Ema_ele Monday, February 12, 2018 4:49 PM
    Monday, February 12, 2018 4:47 PM

Answers

All replies