【问题标题】:Store powershell result in json to Azure storage account以 json 格式将 powershell 结果存储到 Azure 存储帐户
【发布时间】:2021-12-04 03:16:50
【问题描述】:

我需要使用 windows powershell ISE 将 powershell json 输出存储到 azure 存储帐户中。 eg: "$result" 是要存储在 storage account 中的输出文件

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: powershell azure-blob-storage


【解决方案1】:

我已经在我的环境中测试过。

首先,我们可以使用以下命令将 PowerShell JSON 输出存储在本地文件中:

$result | out-file /path/to/file 

然后我们可以使用以下命令将文件从本地复制到 azure 存储帐户:

az storage blob upload --account-name mystorageaccount --account-key 0000-0000 --container-name mycontainer --file /path/to/file --name myblob

【讨论】:

  • 如果我必须在 Azure Runbook (powershell) 中完成整个活动并将结果直接上传到 Azure 存储帐户,如何实现? eg: "$result" & "$result1" 是直接推送到存储账户的输出文件
猜你喜欢
  • 2019-06-16
  • 2017-06-28
  • 2017-06-20
  • 2020-01-13
  • 1970-01-01
  • 2018-09-04
  • 1970-01-01
  • 2018-07-17
  • 2018-02-09
相关资源
最近更新 更多