【问题标题】:Could Azure CLI upload/update a script which was code by azure cli and powershell?Azure CLI 可以上传/更新由 azure cli 和 powershell 编写的脚本吗?
【发布时间】:2020-10-16 08:34:52
【问题描述】:

Azure CLI 是否可以上传/更新由 azure cli 和 powershell 编写的脚本?

例如
有一个 demo.ps1:

$json = az group list;
sendemail --body $json --to "xxxx@google.com" --title "xxx";

我想上传 demo.ps1 并在 azure 上创建一个任务作业

az somecommand create task --time "every 3 hour" --file demo.ps1

上传taskjob,如:

az somecommand update task --time "every 3 hour" --file demo.ps1

我尝试过并且知道的:

  • 我尝试了自动化运行手册,但它can't support azure cli
  • 我尝试了天蓝色逻辑,但它only support javascript
  • 我可以创建一个 ubuntu 虚拟机并使用 crontab 来完成,但它对于轻量级的工作来说太重了

【问题讨论】:

    标签: azure azure-powershell azure-cli


    【解决方案1】:

    定时上传脚本没有意义,但是定时运行脚本有意义。

    如您所知,Azure 自动化 Runbook 不支持 Azure CLI。 但是power shell con 可以完成 CLI 所做的大部分工作,您可以尝试在 runbook 中使用 power shell 命令,并链接计划来运行脚本。

    【讨论】:

    • 谢谢,我投了赞成票,但你不能在 cloud shell 上创建corntab
    • @Wei ,抱歉之前的有效解决方案,我更新我的答案,请检查。
    猜你喜欢
    • 1970-01-01
    • 2019-04-24
    • 1970-01-01
    • 1970-01-01
    • 2017-10-10
    • 1970-01-01
    • 1970-01-01
    • 2020-12-28
    • 1970-01-01
    相关资源
    最近更新 更多