首页 > 解决方案 > 如何通过 Azure 自动化部署文件共享快照计划程序?

问题描述

我想使用 Azure 自动化部署文件共享快照计划程序,我创建了一个 Runbook,但在 Internet 上找不到该 cmdlet。

(有一些关于如何从 0 创建快照的示例,但我想创建现有的文件共享快照,我尝试更改 cmdlet 以使其工作,但失败了。)。

是否有人可以告诉我有关正确的 cmdlet 或使用 Azure 自动化进行安排的某种方式。

非常感谢。

标签: azurestoragesnapshotfileshare

解决方案


请在你的运行手册中尝试下面的代码,它在我身边工作(如果你想参数化帐户名/密钥和文件共享名,你可以自己做或向我寻求帮助):

$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()

请注意,如果它提示the Snapshot() method is not found,您应该azure.storage从您的自动化帐户 -> 模块库安装模块,然后导入该模块。需要几分钟才能生效。


推荐阅读