简体   繁体   English

将 json 中的 powershell 结果存储到 Azure 存储帐户

[英]Store powershell result in json to Azure storage account

I need to store the powershell json output into azure storage account using windows powershell ISE.我需要使用 windows powershell ISE 将 powershell json 输出存储到 azure 存储帐户中。 Eg: "$result" is the output file to be stored in storage account例如:“$result”是要存储在存储帐户中的输出文件

I have tested in my environment.我已经在我的环境中进行了测试。

Firstly, we can store the PowerShell JSON output in a local file using below command :首先,我们可以使用以下命令将 PowerShell JSON 输出存储在本地文件中:

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

Then we can copy the file from local to azure storage account using below command :然后我们可以使用以下命令将文件从本地复制到 azure 存储帐户:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM