azure - 如何通过 Azure 自动化部署文件共享快照计划程序?
问题描述
我想使用 Azure 自动化部署文件共享快照计划程序,我创建了一个 Runbook,但在 Internet 上找不到该 cmdlet。
(有一些关于如何从 0 创建快照的示例,但我想创建现有的文件共享快照,我尝试更改 cmdlet 以使其工作,但失败了。)。
是否有人可以告诉我有关正确的 cmdlet 或使用 Azure 自动化进行安排的某种方式。
非常感谢。
解决方案
请在你的运行手册中尝试下面的代码,它在我身边工作(如果你想参数化帐户名/密钥和文件共享名,你可以自己做或向我寻求帮助):
$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
从您的自动化帐户 -> 模块库安装模块,然后导入该模块。需要几分钟才能生效。
推荐阅读
- c - 计算成绩时在 C 中输入验证
- html - 在角度材料表中动态地为每一行添加一个html按钮
- flutter - Flutter web - 服务器响应状态为 404(未找到),main.dart.js:1
- google-bigquery - 组织级别是否有任何 BigQuery 限制?
- python - 如何在 python 中实现这种递归?
- bash - bash 将带有特殊字符和换行符的文本附加到特定行的文件中
- python - 性能比较:为什么复制整个 numpy 矩阵然后更改一列比仅使用 numpy.column_stack 更快?
- javascript - 获取 SetState 的值未在反应中更新
- python - AWS Glue 连接到 RDS Mysql v8
- google-sheets - 使用正则表达式的 ImportXLM 函数