如何通过 Azure 自动化部署文件共享快照调度程序?
how to deploy Files share snapshot scheduler by Azure Automation?
我想使用 Azure 自动化部署文件共享快照计划程序,我创建了一个 runbook,但我在 Internet 上找不到该 cmdlet。
(有一些关于如何从 0 创建快照的示例,但我想创建现有的文件共享快照,并且我尝试更改 cmdlet 以使其工作,但失败了。)。
是否有人可以告诉我有关正确的 cmdlet 或某种使用 Azure 自动化安排它的方法。
非常感谢。
请在你的 runbook 中尝试下面的代码,它在我这边有效(如果你想参数化帐户名称/密钥和文件共享名称,你可以自己做或向我寻求帮助):
$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
模块,并导入该模块。需要几分钟才能生效。
我想使用 Azure 自动化部署文件共享快照计划程序,我创建了一个 runbook,但我在 Internet 上找不到该 cmdlet。
(有一些关于如何从 0 创建快照的示例,但我想创建现有的文件共享快照,并且我尝试更改 cmdlet 以使其工作,但失败了。)。
是否有人可以告诉我有关正确的 cmdlet 或某种使用 Azure 自动化安排它的方法。
非常感谢。
请在你的 runbook 中尝试下面的代码,它在我这边有效(如果你想参数化帐户名称/密钥和文件共享名称,你可以自己做或向我寻求帮助):
$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
模块,并导入该模块。需要几分钟才能生效。