在远程经典虚拟机上运行命令/脚本 [英] run command/script on remote classic virtual machine

查看:407
本文介绍了在远程经典虚拟机上运行命令/脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍在使用经典虚拟机,是否可以在该经典VM上远程运行命令/脚本?谢谢.

I'm still using the classic virtual machine, is it possible to run a command/script on that classic VM remotely? Thanks.

推荐答案

你好

根据要尝试运行的确切命令/脚本以及是否要计划任务,您有一些选择.

You have a few options depending on the exact command/script you're trying to run and whether you want to schedule the task.

  1. 在VM上启用 PowerShell远程(假设它运行Windows)并创建NSG规则,以将本地TCP端口5986打开到特定的远程端口并锁定到公共IP地址. 请勿将端口5986开放给公共Internet.
  2. 从Azure门户在VM上安装自定义脚本扩展,可以使用该自定义脚本扩展.运行远程PowerShell脚本.根据您要实现的目标,您还可以查看期望状态配置"或"Chef/Puppet扩展".对于经典 您可以在设置>下找到虚拟机扩展名 选择虚拟机后,请在虚拟机刀片上单击.
  3. 创建Azure Runbook来执行脚本或操作,然后在大型自动化过程中按计划或触发器执行Runbook.可从Azure门户的
  1. Enable PowerShell remoting on the VM (assuming it runs Windows) and create an NSG rule to open up local TCP port 5986 to a specific remote port and lock down to a public IP address. Do not leave port 5986 open to the public Internet.
  2. Install the Custom Script Extension on the VM from the Azure portal which can be used to run remote PowerShell scripts. Depending on what you're trying to achieve, you could also look at the Desired State Configuration, or Chef/Puppet extensions. For classic VMs you can find this under Settings > Extensions on the VM blade once you have selected your VM.
  3. Create an Azure Runbook to execute your script or actions and then have the runbook execute on either a schedule or a trigger as part of a larger automation process. Runbooks are accessed from the Azure Portal under All Services > Management + governance > Automation Accounts

您能否提供有关您要实现的目标以及您的VM是运行Windows还是Linux的更多信息,以便我进一步介绍每个选项?

Could you provide more information on what you're trying to achieve and whether your VM is running Windows or Linux so I can dive into each option further?


这篇关于在远程经典虚拟机上运行命令/脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆