I want to use Azure Automation to deploy Files Share snapshots scheduler, I create a runbook, but I can't find the cmdlet at the internet.
(there have some samples about how to create a snapshot from 0, but I want to create the existing Files share snapshots, and I tried to change the cmdlet to make it work, it was failed.).
Is there someone can tell me about the right cmdlet or some way to schedule that with Azure Automation.
Thanks so much.
Please try the code below in your runbook, it works at my side(if you want to parameterized the account name / key and fileshare name, you can do it your self or ask me for help):
$context = New-AzureStorageContext -StorageAccountName your_storage_account -StorageAccountKey your_storage_account_key
$share = Get-AzureStorageShare -Context $context -Name your_file_share_name
$snapshot = $share.Snapshot()
Note that if it prompts that the Snapshot() method is not found
, you should install the azure.storage
module from your automation account -> Modules gallery, and import this module. It will take a few minutes to take effect.