【问题标题】:how to deploy Files share snapshot scheduler by Azure Automation?如何通过 Azure 自动化部署文件共享快照计划程序?
【发布时间】:2018-12-14 12:22:40
【问题描述】:

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

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

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

非常感谢。

【问题讨论】:

  • 您的意思是要对现有文件共享进行快照吗?
  • 是的。刚才我发现了一些东西,我使用这个 cmdlet 来获取我现有的 StorageAccount : $resourceGroup = "myexistingresourcegroup" $storageAccountName = "myexistingstorageaccount" $storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroup ` -Name $storageAccountName 但是当我去下一个步骤,它显示“无法获取存储上下文。”
  • docs.microsoft.com/ja-jp/azure/storage/files/… docs.microsoft.com/ja-jp/azure/storage/common/… 这里有一些网站可能有用,但我不知道如何对现有文件共享进行快照。
  • 我会在几秒钟后发布我的答案,如果有任何问题请告诉我。

标签: azure storage snapshot fileshare


【解决方案1】:

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

$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 模块,然后导入此模块。需要几分钟才能生效。

【讨论】:

  • @Arthur,你能帮我把它标记为答案吗?谢谢:)
  • @Arthur,我从未尝试过删除或保留它们,但它应该只是一些 powershell 脚本。如果您有任何问题,请随时将您的问题发布到 stackoverflow,我们可以帮助您解决。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-05-18
  • 1970-01-01
  • 2019-07-12
  • 2022-10-21
  • 2012-09-16
  • 1970-01-01
  • 2013-10-28
相关资源
最近更新 更多